Cuda 9.0 on Ubuntu 16.04: cudaGetDeviceCount returned 35

I’m new in linux and I intend to use CUDA. I followed the instructions on [url][/url]. After installing my nvidia gpu which is GEFORCE 820M, nvidia-340 to be specific. I installed CUDA 9.0.xx next and extracted and compiled with the sample. I tried to run ./deviceQuery and resulted in:

./deviceQuery Starting…

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

cudaGetDeviceCount returned 35
→ CUDA driver version is insufficient for CUDA runtime version
Result = FAIL


$ lspci -v | grep -i nvidia
04:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev a1)
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_340

$ uname -r

$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 340.107 Thu May 24 21:54:01 PDT 2018
GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)

$ nvidia-smi
Tue Nov 13 08:01:21 2018
| NVIDIA-SMI 340.107 Driver Version: 340.107 |
| 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 820M Off | 0000:04:00.0 N/A | N/A |
| N/A 57C P0 N/A / N/A | 261MiB / 2047MiB | N/A Default |

| Compute processes: GPU Memory |
| GPU PID Process name Usage |
| 0 Not Supported |

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

I would appreciate all of help that I can help since I’m have trouble with it in 3 weeks and have reinstalled my Ubuntu 10x now.

Thanks a lot.

geforce 820m is an old GPU

CUDA 8 was the last version that supports that GPU. And if you want to use CUDA 8, you will need a newer driver than 340.xx. The driver that comes with the CUDA 8 toolkit installer should be fine.