Skip to content

Instantly share code, notes, and snippets.

@ArashHosseini
Last active February 5, 2022 21:16
Show Gist options
  • Save ArashHosseini/47a88c250ba47a231d224c883c8cef63 to your computer and use it in GitHub Desktop.
Save ArashHosseini/47a88c250ba47a231d224c883c8cef63 to your computer and use it in GitHub Desktop.
#Installation Steps:
#0) Purge Nvidia and CUDA
#1) Install CUDA Toolkit
#2) Install Nvidia Driver
#3) Install Cudnn
#4) Install and create virtual environment
#5) Install Tensorflow, Pytorch etc.
#System:
#Driver Version: 455.45.01
#CUDA Version: 11.1.1
#Tensorflow Version tf-nightly-gpu==2.5.0.dev20201209
#Python Version: 3.8
#OS: Ubuntu 20 LTS
#GPU: Rtx 3090
#0) Purge Nvidia and CUDA###########################################################
sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
sudo apt-get --purge remove "*nvidia*"
sudo rm -rf /usr/local/cuda*
sudo apt-get purge nvidia
#1) Install CUDA Toolkit############################################################
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
#visit https://developer.nvidia.com/cuda-11-download-archive
wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run
chmod +x ./cuda_11.1.1_455.32.00_linux.run
#update ~/.bashrc
export PATH=/usr/local/cuda-11.0/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64:${LD_LIBRARY_PATH}
export CUDA_HOME=/usr/local/cuda
#reboot system
sudo reboot
#2) Install Nvidia Driver###################################################
#visit Nvidia driver: https://www.nvidia.com/Download/Find.aspx and download
chmod +x NVIDIA-Linux-x86_64-455.45.01.run
sudo ./NVIDIA-Linux-x86_64-455.45.01.run
#sudo reboot
sudo reboot
#3) Install Cudnn###########################################################
#login & download cuDNN: https://developer.nvidia.com/cudnn
tar -xzvf cudnn-11.1-linux-x64-v8.0.5.39.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
#4) Install and create virtual environment###################################
sudo apt-get install python3.8-venv
mkdir env_38; cd env_38
python3.8 -m venv tf25
#activate env
source tf25/bin/activate
#5) Install Tensorflow and torch##################################################
#install tf
pip install tf-nightly-gpu==2.5.0.dev20201209
#verify installation
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
#install pytorch
pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment