1

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.

  • Related https://askubuntu.com/questions/672430/devicequery-fails-on-cuda-7-5-installation-ubuntu-14-0-4 – user.dz Jun 12 '16 at 09:13
  • can you share the path in which your CUDA samples are installed? This usually happens due to permission. – pradyot Jun 14 '16 at 08:38
  • Hi @pradyot, the path where I am running ./deviceQuery is /usr/local/cuda/samples/1_Utilities/deviceQuery – kanghj91 Jun 19 '16 at 08:20
  • Yea, that's it, to modify or run any file in/usr directory you need root privileges. That is why you need to run your executable files with sudo . If you install your CUDA samples in home directory, then you need not use sudo . Go through this link and this, it might help. – pradyot Jun 19 '16 at 16:58
  • @pradyot, that is strange because after the first run of sudo ./deviceQuery, subsequent runs without sudo can work. – kanghj91 Jun 20 '16 at 01:45
  • Well according to cuda toolkit documentIf 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

1 Answers1

0

When I build i had to do:

sudo make -j4

Otherwise some errors pop out, then I had same problem.

Change permissions from inside samples folder:

sudo chmod 755 -Rf *
sudo chown nobody:nogroup -Rf

Hope its not to layman way tho :D