Varying success when running cuda_samples post install

I installed CUDA 8.0 on my Windows 10 system which has a 1080 TI. I also installed the driver suggested. My end goal is to compile openCV with CUDA support, so I want to ensure that CUDA was installed OK and running fine on my system. I ran devicequery.exe which indicated that the system PASSED. I then ran various samples with no issues. However, none of the simulations in cuda_samples will run. I see different errors, but most frequently the error is that all CUDA enabled devices are busy or unavailable.

Aside: I initally thought things were OK and compiled opencv with cuda support, but after compilation the cv::cuda::getCudaEnabledDeviceCount function returns 0…

For ref:
Device query
deviceQuery.exe Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: “GeForce GTX 1080 Ti”
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 11264 MBytes (11811160064 bytes)
(28) Multiprocessors, (128) CUDA Cores/MP: 3584 CUDA Cores
GPU Max Clock rate: 1582 MHz (1.58 GHz)
Memory Clock rate: 5505 Mhz
Memory Bus Width: 352-bit
L2 Cache Size: 2883584 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
CUDA Device Driver Mode (TCC or WDDM): WDDM (Windows Display Driver Model)
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 1080 Ti
Result = PASS


fluidsGL Starting…

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

CUDA device [GeForce GTX 1080 Ti] has 28 Multi-Processors
C:/ProgramData/NVIDIA Corporation/CUDA Samples/v8.0/5_Simulations/fluidsGL/ : getLastCudaError() CUDA error : cudaMalloc failed : (46) all CUDA-capable devices are busy or unavailable.
Press any key to continue . . .


all CUDA-capable devices are busy or unavailable

The CUDA samples that do CUDA/Graphics interop often require special setup and handling. In this particular case, the error is likely due to the fact that the OpenGL context got instantiated on a non-NVIDIA GPU, and the CUDA context got instantiated on the NVIDIA GPU, and that won’t work for CUDA/OpenGL interop. Both contexts need to be instantiated on a NVIDIA device.

This problem comes up from time to time, people ask about it, so a bit of searching will lead you to descriptions of what may be done about it.

You also don’t indicate if your display is hosted on a NVIDIA GPU or another GPU, so this is just speculation.

The problem of the cv call returning 0 is probably separate from this, so I suspect that is a different issue.

Thanks for the response.

I have two monitors, one using the graphics on my intel processor, the other using the NVIDIA - I see how this could have unintended consequences. I should probably move to using the intel graphics for monitors and reserve the NVIDIA for computation.

With that, I will conclude CUDA is installed and working properly because the all non simulation cuda_samples run. Now to debug issues with openCV compilation. Thanks again.