Forked from maky-hnou/Install CUDA 10.1 and Cudnn 7.6.5 on Ubuntu18.04
Last active
December 8, 2020 19:49
-
-
Save GuoleiSun/d7413130ebf2b5fe1bb68f4c7cf4802e to your computer and use it in GitHub Desktop.
Install Nvidia driver, cuda10.1 and cudnn 7.6.5 on Ubuntu 18.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Nvidia driver, Cuda 10.1 and Cudnn 7.6.5 on Ubuntu 18.04 | |
| ## Start clean | |
| sudo apt purge nvidia* | |
| sudo apt remove nvidia-* | |
| sudo rm /etc/apt/sources.list.d/cuda* | |
| sudo apt autoremove && apt autoclean | |
| sudo rm -rf /usr/local/cuda* | |
| ## Run update | |
| sudo apt update | |
| ## Install some dependencies | |
| sudo apt install -y g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev | |
| ## Add CUDA repository | |
| sudo add-apt-repository ppa:graphics-drivers/ppa | |
| sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | |
| echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list | |
| ## two ways to install nvidia driver | |
| 1. install the newest version of nvidia driver, which may not be suitable for you | |
| sudo apt install -y nvidia-driver-440 | |
| 2. install specific version of nvidia driver | |
| 2.1 download the nvidia driver: https://www.nvidia.com/Download/index.aspx?lang=en-us | |
| 2.2 sudo chmod +x NVIDIA-Linux-x86_64-410.66.run | |
| sudo ./NVIDIA-Linux-x86_64-410.66.run | |
| sudo reboot | |
| 2.3 The distribution-provided pre-install script failed! Are you sure you want to continue? --> yes | |
| Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? --> No | |
| Nvidia's 32-bit compatibility libraries? --> No | |
| Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. --> Yes | |
| ## Install CUDA-10.1 | |
| sudo apt-get -o Dpkg::Options::="--force-overwrite" install cuda-10-1 cuda-drivers | |
| ## Set CUDA paths | |
| echo 'export PATH=/usr/local/cuda-10.1/bin:$PATH' >> ~/.bashrc | |
| echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc | |
| source ~/.bashrc | |
| sudo ldconfig | |
| ## Download Cudnn 7.6.5 for CUDa 10.1 | |
| - Go to https://developer.nvidia.com/cudnn | |
| - Create an account | |
| - Download the suitable version of Cudnn from https://developer.nvidia.com/rdp/cudnn-download | |
| - Extract the downloaded file `tar -xzvf <filename>` | |
| - Copy the following files into the CUDA directory | |
| sudo cp -P cuda/include/cudnn.h /usr/local/cuda-10.1/include/ | |
| sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.1/lib64/ | |
| sudo chmod a+r /usr/local/cuda-10.1/lib64/libcudnn* | |
| ## Restart the PC | |
| Restart your PC to apply the changes | |
| ## Check that everything went the right way | |
| nvidia-smi | |
| nvcc -V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment