Skip to content

installation notes for tensorrt, cuda, cudnn, torch2tr, anaconda3, pytorch

Notifications You must be signed in to change notification settings

CV-ZMH/Setup-guide-for-deeplearning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Installation Notes for Tensorrt, Cuda, Cudnn, Anaconda, Pytorch, Tensorflow, Torch2trt in Ubuntu 18.04

Table of content

  1. Install nvidia driver 450
  2. Install cuda-10.2 and cudnn 8.0.5
  3. Install Anaconda and Create Environment
  4. Install TensorRT-7.2.3
  5. Install Torch2trt

Install Nvidia Driver 450

Run below command to install nvidia driver

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
# exact version 450.102.04
sudo apt-get install nvidia-driver-450

Then reboot and check the nvidia driver

init 6
nvidia-smi

Install Cuda and Cudnn

Step 1. CUDA 10.2 Deb File

cd (cuda download directory)
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
  • Then add these cuda environment variables in ~/.bashrc file.
nano ~/.bashrc
# add these variables in the bottom of ~/.bashrc file
export PATH=/usr/local/cuda-10.2/bin:/usr/local/cuda-10.2/NsightCompute-2019.1${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  • Then activate these variable with this command
source ~/.bashrc

Step 2. CUDNN 8.0.5 Deb Files

sudo dpkg -i libcudnn8_8.0.5.39-1+cuda10.2_amd64.deb
sudo dpkg -i libcudnn8-dev_8.0.5.39-1+cuda10.2_amd64.deb       
sudo dpkg -i libcudnn8-samples_8.0.5.39-1+cuda10.2_amd64.deb      

Install Anaconda and Create Environment

  • Download and install anaconda
  • Then create virtual environment
conda create -n dev python=3.7
conda activate dev
pip install torch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2
python -c "import torch; print('Cuda:', torch.cuda.is_available())"
conda activate dev
conda install tensorflow-gpu=2.2.0
python -c "import tensorflow as tf; print('Cuda:', tf.test.is_gpu_available())"

-Install other python computer vision packages

pip install Cython
pip install pycocotools
pip install -r ~/requirements.txt

Install TensorRT

# extract tensorrt tar file
tar xzvf <downloaded TensorRT tar file>

Note* You can check official tensorrt installation instruction from here.

  • Then add these tensorrt environment variables in ~/.bashrc file.
nano ~/.bashrc
# change your tensorrt extracted folder path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<your tensorrt extracted folder>/lib
export PATH=$PATH:<your tensorrt extracted folder>/bin
  • Then activate these variables with this command
source ~/.bashrc
  • Install python packages from your tenssorrt extracted folder.
 cd <your tensorrt extracted folder>
 pip install python/tensorrt-7.1.3.4-cp<your python version>.whl
 pip install graphsurgeon/*.whl
 pip install uff/*.whl

Install Torch2trt

  • Install Torch2trt
sudo apt-get install libprotobuf* protobuf-compiler ninja-build
git clone https://github.com/NVIDIA-AI-IOT/torch2trt.git
cd Torch2trt
python setup.py install --plugins

Bravo!!! ENJOY your deep learning journey.

|

About

installation notes for tensorrt, cuda, cudnn, torch2tr, anaconda3, pytorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published