Install/Update CUDA on Ubuntu Machines
Introduction
This document contain the step to install/update CUDA on Ubuntu machines
Installation
Step 1. Download cuda from NVIDIA official website. Either Deb (local), deb (network), or runfile (local) would work.
![example image](/assets/img/posts/install_cuda/cuda.png)
Step 2. Follow the instructions on the NVIDIA official website to download CUDA.
![example image](/assets/img/posts/install_cuda/install_cuda.png)
Step 3. Reboot the machine
$ sudo reboot
Step 4. Check system cuda after reboot
![example image](/assets/img/posts/install_cuda/check_cuda.png)
Step 5. Setup the environment in ~/.bashrc. Please see the official document.
### add cuda path in ~/.bashrc
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Step 6. Source new environment
$ source ~/.bashrc
Step 7. Test driver
$ nvidia-smi
![example image](/assets/img/posts/install_cuda/test_driver.png)
Step 8. Test cuda compiler
$ nvcc -V
![example image](/assets/img/posts/install_cuda/test_cudnn.png)