I tried to install CUDA on Ubuntu but got errors.
I follow official guide for installation. And actually I succeed on my own mac. But on ubuntu 18.04 machine, when I tried to test those samples, it showed that no CUDA-capable device detected, but actually there is an nvidia GPU, GTX470. Also, "nvidia-smi" command doesn't work, saying can't find the CUDA driver, but actually, if we run apt-get install cuda driver, it showed that cuda driver is already installed. You may check the error image:
21 Answer
Use the installation guide provided here by eromod. This worked for me on 18.04 on different computers, other than the official version.
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo ubuntu-drivers autoinstallreboot
sudo apt install nvidia-cuda-toolkit gcc-6
nvcc --version 1