No cuda-capable device is available? Strange problem

I am using Geforce 210 as GPGPU device. When I run the following code, sometimes it incurs the error like “no CUDA-capable device is available”. When I reboot the computer, the problem is gone. But this does not mean the problem is gone forever. It will make appearance somewhat in a random sense. I don’t know why. Please give me some hint. I am using Ubuntu 9.10. Cheers.

------------------------------------- the code excerption--------------------------------------------------------------------

int gpu_idx = 0; // Only one GPU is availabe on the system.

struct cudaDeviceProp prop; 
cudaGetDeviceProperties(&prop, device);

display_device_info(&prop);   // Never reports error here. 

PRINTF("---Start to Set Device---\n");
cudaError_t cuda_err; 

if ((cuda_err = cudaGetLastError()) != cudaSuccess) {	
    printf("ERROR: CUDA error: %s\n", cudaGetErrorString(cuda_err));  // this line reports the mentioned error randomly. 


Do you have your GPU set to compute exclusive mode? The error you are getting typically indicates that the GPU is in use by another application for GPUs in compute exclusive mode.

Thanks for your hints. However, the GPU is also used by as display card, in addition to doing some non-graphical computations. In this case, I am wondering whether it is not problematic to set it to compute exclusive mode.

it’s probably an out of memory error

happens to me quite a lot with linux (especially after hibernate). Changing the screen resolution seems to reset the driver and solve the problem (moving from 1680x1050 <-> auto in nvidia settings works as well)

Check your access to the device. This happens to me on 1 machine when after a reboot the permissions are ‘gone’. You need to have rw on the device. Other machines are oke…