sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-390 nvidia-modprobe
To verify installation, restart your machine with reboot
and type nvidia-smi
.
The CUDA runfile installer can be downloaded from NVIDIA’s website. Choose the runfile option. Choose the deb (local) option. Download and follow installation instructions:
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Go to the cuDNN download page (need registration) and select the latest cuDNN 7.3.1 version made for CUDA 9.0. Download all 3 .deb files: the runtime library, the developer library, and the code samples library for Ubuntu 16.04. In your download folder, install them in the same order:]
sudo dpkg -i libcudnn7_7.3.1.20-1+cuda9.0_amd64.deb (the runtime library),
sudo dpkg -i libcudnn7-dev_7.3.1.20–1+cuda9.0_amd64.deb (the developer library), and
sudo dpkg -i libcudnn7-doc_7.3.1.20–1+cuda9.0_amd64.deb (the code samples).
Now we can verify the cuDNN installation (below is just the official guide, which surprisingly works out of the box):
Copy the code samples somewhere you have write access: cp -r /usr/src/cudnn_samples_v7/ ~.
Go to the MNIST example code: cd ~/cudnn_samples_v7/mnistCUDNN.
Compile the MNIST example: make clean && make.
Run the MNIST example: ./mnistCUDNN
. If your installation is successful, you should see Test passed!
at the end of the output.
Go to NCCL download page and select latest version 2.3.5 for CUDA 9.0 Download deb file and run command:
sudo dpkg -i nccl-repo-ubuntu1604-2.3.5-ga-cuda9.0_1-1_amd64.deb
sudo apt update
sudo apt install libnccl2 libnccl-dev
- Create a new file
myenv.sh
and move it into/etc/profile.d
sudo nano /etc/profile.d/myenv.sh
- Set content
#!/bin/sh
export CUDA_HOME=/usr/local/cuda
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64:$LD_LIBRARY_PATH
export INCLUDE_PATH=$CUDA_HOME/include:$INCLUDE_PATH