Runtime Cuda Error, Sample fluidsGL

I am trying to run the CUDA sample code called fluidsGL available with the toolkit v8.0,
but I’m getting the following error message:

fluidsGL Starting…

NOTE: The CUDA Samples are not meant for performance measurements. Results may v
ary when GPU Boost is enabled.

CUDA device [GeForce GTX 1050] has 5 Multi-Processors
C:/ProgramData/NVIDIA Corporation/CUDA Samples/v8.0/5_Simulations/fluidsGL/fluid : getLastCudaError() CUDA error : cudaMalloc failed : (46) al
l CUDA-capable devices are busy or unavailable.
Presione una tecla para continuar . . .

I had no idea how to solve it, Is it due to a wrong allocation of memory in an old
sample code?

I run it on an I7 12 Gb, with a GTX 1050 2Gb.


Is this on a laptop? If so you may need to modify an application profile to run it correctly:

No, it was not made on a laptop but on a desktop.

Is the display being hosted from that GTX 1050 GPU or from some other device?

The display is managed by the integrated intel graphics card onboard.

That is the problem. This sample code (and some others) use CUDA/OpenGL interop.

The OpenGL context is getting created on the Intel graphics, and that is not usable for CUDA/OpenGL interop. You need to have the OpenGL context on a NVIDIA GPU.

Oh ! I changed the monitor to one connected to the GTX the sample just works fine.
Is it something to do with OpenGL?

thankx txbob!

My nvidia control panel is slightly different from the one shown in the link above and did not let me choose the graphics card from the context menu.

However, changing the monitor was enough.