Skip to content

Instantly share code, notes, and snippets.

@arundasan91
Last active April 23, 2022 08:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arundasan91/5a364ca299728a6445b5aeda6931648f to your computer and use it in GitHub Desktop.
Save arundasan91/5a364ca299728a6445b5aeda6931648f to your computer and use it in GitHub Desktop.
Install CUDA and Machine Learning packages for Ubuntu from Scratch
cd ~
mkdir .packages
cd .packages
# Install CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda-10-1
# Add the following to ~/.bashrc and run source ~/.bashrc
# export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1${PATH:+:${PATH}}
# export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64\
# ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# Install CuDNN by downloading the same from developer.nvidia.com/cudnn to .packages folder
# Version 7.5.0 for CUDA 10.1
# Assuming that the CuDNN package is in .packages folder, continue; else comment the following few lines.
tar -xzf cudnn-10.1-linux-x64-v7.5.0.56.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
# Install NCCL by downloading the same from developer.nvidia.com/nccl to .packages folder
# Version 2.56 for CUDA 10.1
wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt update
sudo apt install libnccl2=2.5.6-1+cuda10.1 libnccl-dev=2.5.6-1+cuda10.1
# Install required packages
# pip3 install --user torch torchvision
# pip3 install --user tensorflow-gpu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment