CUDA is not active unless I run it with sudo privillages ?

I am using ubuntu 13.10 at my computer and installed CUDA 6.0. For every reboot I run deviceQuery it gives;

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

However, if I run it with sudo once, it works flawlessly even without sudo privileges for the subsequent tries.

What could be the reason and possible solution to such problem ?

This is discussed in a number of places. There are certain system files that must be created at each boot cycle to use a GPU. Creation of these files requires root privilege. This reason is mentioned in the linux getting started guide:

[url]CUDA Toolkit Documentation

“If 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.”

You can read more about it here, as well as a possible solution:

[url]http://www.resultsovercoffee.com/2011/01/cuda-in-runlevel-3.html[/url]

Hi,

Yes your problem may be related to the confusing html LAYOUT of the install Guide:
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#abstract

After install (opensuse12.3 but I think this is generic to several linux’s) I got a:

FATAL: Module nvidia_uvm not found. error and

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

The problem for me was I didnt install the additional packages…

The install guide’s:

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#abstract

HTML is formated such that it says do-

  1. Package Manager Installation

3.1. Prerequisites

3.X.

Well after I did my specific OS I figured I was done with the 3.X section and neglected 3.8 :

3.8. Additional Package Manager Capabilities
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#package-manager-additional

IT SHOULD BE FORMATED SO THAT

3.1. Prerequisites

3.2.X.

3.3 Additional Package Manager Capabilities

SO Folks DONT SKIP THIS INPORTANT STEP!!!
It seem’s like others are also having this problem… I will cross post!!
Good Luck…

On the bright side this install (os and cuda) only took a day (85% being opensuse’s)!
This is far better then the cuda 5.5 which had to be done by manually shuting down the
graphics subsystem! That and fedora which trashed my drives took a month to set up!

But I have to say for those who are new… stick with it … It is well worth it!
Cuda will change how you solve computational problems… and for the better!

-bitwisecm

I think if would be helpful if you could file an enhancement request for the documentation, using the bug reporting form linked from the registered developer website. Please prefix the synopsis with "RFE: " to mark it as a “request for enhancement” rather than a bug.

I now got the same problem after updating my system from SLES12SP1 to SLES12SP2 and subsequently updating the nvidia drivers (now 367.57). Has anyone have a solution?

I am trying to run basic cuda samples included within the cuda directory. But all files are under root access and require sudo with every action. is this the reason I am not able to install tensorflow ?

This seems wrong. How did you install CUDA?

I have the problem of the original poster. No CUDA examples work (giving the original poster error message) until at least one of them is run with sudo. Only then they will work also without sudo.

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
nvidia-smi
Sat Jan 13 17:17:45 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.12                 Driver Version: 390.12                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   45C    P8    N/A /  N/A |    438MiB /  4042MiB |      7%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1175      G   /usr/lib/xorg/Xorg                           251MiB |
|    0      2191      G   compiz                                       105MiB |
|    0     22048      G   ...-token=66A499926B7F83A4D6350846F6AAE0DB    80MiB |
+-----------------------------------------------------------------------------+

I have installed CUDA with the runfile.

The linked solution was “fairly well-tested on RHEL/CentOS systems, but probably works on other distros with no or minor modifications”. But I have Ubuntu 16.04 LTS. Should I adopt that solution nevertheless to avoid having to start the first CUDA example as sudo?


I don’t know if this is related to this problem or not. If not, please tell me and I will open another thread.

The installation guide wants me to run

/usr/bin/nvidia-persistenced --verbose

at root, but I don’t have such program

whereis nvidia-persistenced 
nvidia-persistenced:

What should I do?

[url]Installation Guide Linux :: CUDA Toolkit Documentation