安裝TensorRT


下載對應的tar版本:https://developer.nvidia.com/nvidia-tensorrt-6x-download

  1. 解壓安裝包
version="6.0.1.8"
os="Ubuntu-16.04"
arch=$(uname -m)
cuda="cuda-10.2"
cudnn="cudnn7.6"
tar xzvf TensorRT-${version}.${os}.${arch}-gnu.${cuda}.${cudnn}.tar.gz
  1. 解壓得到TensorRT-6.0.1.8的文件夾,將里邊的lib絕對路徑添加到環境變量中
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/qian/TensorRT-6.0.1.8/lib
  1. 安裝TensorRT
cd TensorRT-${version}/python

# If using Python 2.7:
sudo pip2 install tensorrt-*-cp27-none-linux_x86_64.whl

# If using Python 3.x:
sudo pip3 install tensorrt-*-cp3x-none-linux_x86_64.whl
  1. 安裝Python UFF wheel文件。僅當計划將TensorRT與TensorFlow一起使用時,才需要此選項。
cd TensorRT-${version}/uff

# If using Python 2.7:
sudo pip2 install uff-0.6.9-py2.py3-none-any.whl

# If using Python 3.x:
sudo pip3 install uff-0.6.9-py2.py3-none-any.whl

# In either case, check the installation with:
which convert-to-uff
  1. Install the Python graphsurgeon wheel file.
cd TensorRT-${version}/graphsurgeon

# If using Python 2.7:
sudo pip2 install graphsurgeon-0.4.5-py2.py3-none-any.whl

# If using Python 3.x:
sudo pip3 install graphsurgeon-0.4.5-py2.py3-none-any.whl

  1. 為了避免后邊deepstream找不到tensorrt的庫,建議把tensorrt的庫和頭文件添加到系統路徑下
# TensorRT路徑下
sudo cp -r ./lib/* /usr/lib
sudo cp -r ./include/* /usr/include
  1. 如果要使用python接口的tensorrt,則需要安裝pycuda
pip install 'pycuda>=2019.1.1'
  1. 測試
cd ~/TensorRT-6.0.1.8/samples/
sudo make
cd ../bin
./sample_int8 mnist


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM