Skip to content

Latest commit

 

History

History
113 lines (108 loc) · 3.69 KB

Install_For_Ubuntu18.04.md

File metadata and controls

113 lines (108 loc) · 3.69 KB

1. Install Tool Chains

sudo apt-get update 
sudo apt-get install build-essential 
sudo apt-get install git
sudo apt-get install gdb
sudo apt-get install cmake
sudo apt-get install pkg-config libgtk-3-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev 
sudo apt-get install libopencv-dev  
# pkg-config --modversion opencv

2. Install Nvidia Libs

2.1 install nvidia driver470

ubuntu-drivers devices
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-driver-470-server # for ubuntu18.04
nvidia-smi

2.2 install cuda11.3

wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run
sudo sh cuda_11.3.0_465.19.01_linux.run

The cuda installation process will have a window display.

  • select:[continue] -> [accept] -> Press enter to cancel the first and second options like the following(it is important!) -> [Install]
CUDA Installer
[ ] Driver        # cancel the first
    [ ] 465.19.01 # cancel the second
[X] CUDA Toolkit 11.3 
[X] CUDA Samples 11.3 
[X] CUDA Demo Suite 11.3 
[X] CUDA Documentation 11.3 0tions 

The bash window prints the following, which means the installation is OK.

#===========
#= Summary =
#===========

#Driver:   Not Selected
#Toolkit:  Installed in /usr/local/cuda-11.3/
#......

add environment variables:

vim ~/.bashrc

Copy and paste the following into .bashrc

# cuda v11.3
export PATH=/usr/local/cuda-11.3/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-11.3
source ~/.bashrc
nvcc -V

The bash window prints the following content:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:15:46_PDT_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0

2.3 install cudnn8.2

tar -zxvf cudnn-11.3-linux-x64-v8.2.0.53.tgz

copy cudnn to cuda11.3's install dir

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
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

2.4 download tensorrt8.4.2.4

  • enter: https://developer.nvidia.cn/nvidia-tensorrt-8x-download
  • select: I Agree To the Terms of the NVIDIA TensorRT License Agreement
  • select: TensorRT 8.4 GA Update 1
  • select: TensorRT 8.4 GA Update 1 for Linux x86_64 and CUDA 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6 and 11.7 TAR Package
  • you will download file: "TensorRT-8.4.2.4.Linux.x86_64-gnu.cuda-11.6.cudnn8.4.tar.gz"
tar -zxvf TensorRT-8.4.2.4.Linux.x86_64-gnu.cuda-11.6.cudnn8.4.tar.gz
# test
cd TensorRT-8.4.2.4/samples/sampleMNIST
make
cd ../../bin/

Change the following path to your path!(it is important!)

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/xxx/temp/TensorRT-8.4.2.4/lib
./sample_mnist

The bash window prints digit recognition task information, which indicats tensorrt8.4.2.4 is installed normally.