I've spent a couple of days on this and am at my wit's end as to how to move forward.
I have an ASUS Zenbook UX303UB with Windows 10 and Ubuntu 16.04 Dual boot. It has an NVIDIA GeForce 940M dedicated GPU with 2GB memory. I use Ubuntu primarily for programming. I want to play around with some deep learning tools like tensorflow and theano, for which I first need CUDA to work. Only CUDA 8.0rc appears to work with Ubuntu 16.04 officially.
First, I went to the NVIDIA website and downloaded the CUDA 8.0 runfile. I followed their instructions to install and did so in TTY1, including blacklisting noveau and adding
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
to the end of the .bashrc file.
When I try the test example that NVIDIA provides,
$ cd NVIDIA_CUDA-8.0_Samples/5_Simulations/nbody
$ make
my output is:
>>> WARNING - libGLU.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - gl.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - glu.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o bodysystemcuda.o -c bodysystemcuda.cu
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o nbody.o -c nbody.cpp
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -ftz=true -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o render_particles.o -c render_particles.cpp
[@] /usr/local/cuda-8.0/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o nbody bodysystemcuda.o nbody.o render_particles.o -L/usr/lib/nvidia-361 -lGL -lGLU -lX11 -lglut
[@] mkdir -p ../../bin/x86_64/linux/release
[@] cp nbody ../../bin/x86_64/linux/release
when I then do
$ ./nbody -benchmark -numbodies=256000 -device=0
I get the message
bash: ./nbody: No such file or directory
In the diagnosis process, I realized 2 things:
1) nvidia-smi
doesn't seem to work (nvidia-smi: command not found
)
2) When I do cat /proc/driver/nvidia/version
I get cat: /proc/driver/nvidia/version: No such file or directory
I then decided perhaps there is some trouble with the NVIDIA driver. So I followed the instructions on
Issues with Nvidia graphics driver and CUDA after apt-get upgrade
Basically, to purge all nvidia drivers, turn off lightdm and enter runlevel3, and install the NVIDIA driver runfile from NVIDIA's website.
However, there is an installation error and it aborts.
I then reboot and purge all nvidia drivers and do a sudo apt-get install nvidia-367
I'm back to square one now. Additional diagnostic information as follows:
$ sudo nvidia-modprobe
sudo: nvidia-modprobe: command not found
$ uname -r
4.4.0-36-generic
$ dpkg -l | grep ii | grep -i linux-headers
ii linux-headers-4.4.0-31 4.4.0-31.50 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-31-generic 4.4.0-31.50 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-34 4.4.0-34.53 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-34-generic 4.4.0-34.53 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-36 4.4.0-36.55 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-36-generic 4.4.0-36.55 amd64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-generic 4.4.0.36.38 amd64 Generic Linux kernel headers
$ dpkg -l | grep -i nvidia
ii bbswitch-dkms 0.8-3ubuntu1 amd64 Interface for toggling the power on NVIDIA Optimus video cards
ii libcuda1-367 367.44-0ubuntu0~gpu16.04.1 amd64 NVIDIA CUDA runtime library
ii nvidia-367 367.44-0ubuntu0~gpu16.04.1 amd64 NVIDIA binary driver - version 367.44
ii nvidia-opencl-icd-367 367.44-0ubuntu0~gpu16.04.1 amd64 NVIDIA OpenCL ICD
ii nvidia-prime 0.8.2 amd64 Tools to enable NVIDIA's Prime
ii nvidia-settings 370.23-0ubuntu0~gpu16.04.1 amd64 Tool for configuring the NVIDIA graphics driver
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Wed_May__4_21:01:56_CDT_2016
Cuda compilation tools, release 8.0, V8.0.26
Any help would be much appreciated, as I have come very close to breaking ubuntu a bunch of times!!
Best Answer
I solved it by following this tutorial: http://kislayabhi.github.io/Installing_CUDA_with_Ubuntu/
Follow it loosely, i.e. download and install the lastest driver from nvidia's website instead of downloading and installing nvidia-367 which the tutorial recommends.