Windows Service failed to detect and read properties all GPUs by cudaGetDeviceCount(), and ...GetPro

Hi,

My system has two GPU cards: K20C and GTX 580 with Windows 7 64-bit Enterprise OS. cudaGetDeviceCount() and cudaGetDeviceProperties() are called within a C# Window Service via DllImport method. cudaGetDeviceCount() return one GPU card, and cudaGetDeviceProperties() return the OK for device 0. If I call cudaGetDeviceProperties() for device 1, cuda error is returned with error code = 10 and error message = invalid device ordinal.

If instead the cuda APIs are called within a C# console application, cudaGetDeviceCount() return 2 cards and cudaGetDeicePropoerties() return the right properties for both cards.

If that one GPU you see when running from a Windows Service is the Tesla board in TCC mode that would match the CUDA documentation:
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-microsoft-windows/index.html#driver-model
“TCC allows the use of CUDA from within processes running as Windows services, which is not possible for WDDM devices.”

There are 3 cards in the system, a k20c, a gtx 580, a gtx 780 ti. Only the first one, the k20c, is recognized. I doubt the order of the cards matters.

You mention you have 2 cards, then you say it’s 3… If only the K20c is recognized and not the other two, it seems you have to install the consumer driver (ideally the same version) on top of the existing install without a ‘clean installation’ to be able to use all 3 cards at the same time with CUDA.

That being said, Detlef’s answer is correct – your consumer level cards are not able to use CUDA processes spawned by a Windows service. I believe there is a workaround… see here:

https://devtalk.nvidia.com/default/topic/408076/running-cuda-in-a-service-example-of-a-cuda-service-in-vista-server-2008-and-windows-7/