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?