int deviceCount,slot=0;
int *devloc;
cudaGetDeviceCount(&deviceCount);
devloc=(int *)malloc(deviceCount*sizeof(int));
devloc[0]=999;
for (dev = 0; dev < deviceCount; ++dev)
{
cudaGetDeviceProperties(&deviceProp, dev);
if(deviceProp.kernelExectimeoutEnabled==0)
{
devloc[slot]=dev;
slot++;
};
}
// Now use devloc to assign devices
cudaSetDevice(devloc[myrank]);
I have the same problem and I couldn’t find any solution. I did quite a bit of research and I couldn’t get anything to work. I was told to use deviceProp.kernelExectimeoutEnabled==0 as well but this condition is fullfiled by my 2 graphics cards. I’ve seen so many people looking for a way to detect if one given device is connected to a screen and no one seems to have a solution.
I’m not an expert in OpenGL at all, but could one imagine a test (through some kind of rendering command maybe) that would fail if a device is not connected to a screen?
NVIDIA> is there any plan to add this property (to be attached to a screen or not) to cudaDeviceProp in the near future? I don’t know if it’s technically possible but that would be a nice feature to add for sure.