If I run ./deviceQuery without sudo:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL
But running it with sudo (sudo ./deviceQuery) works, and after I run it once with sudo, subsequent runs of ./deviceQuery without sudo also results in pass.
My guess is that the first run with sudo initialises some files correctly which would otherwise cause it to fail. I am not sure how to debug this further, however.
./deviceQueryis/usr/local/cuda/samples/1_Utilities/deviceQuery– kanghj91 Jun 19 '16 at 08:20/usrdirectory you need root privileges. That is why you need to run your executable files withsudo. If you install your CUDA samples in home directory, then you need not usesudo. Go through this link and this, it might help. – pradyot Jun 19 '16 at 16:58If a CUDA-capable device and the CUDA Driver are installed but deviceQuery reports that no CUDA-capable devices are present, this likely means that the /dev/nvidia* files are missing or have the wrong permissions.so after your first sudo execution all permissions would have set. I am not sure, but do look for the solution. – pradyot Jun 20 '16 at 03:44