tensorRT安裝


1.cmake升級

 cmake --version   3.10.0

1)卸載cmake

    sudo apt-get remove cmake 

2)下載cmake源碼

 從https://cmake.org/download/下載cmake源碼,如cmake-3.17.1.tar.gz

3)在cmake源碼所在文件夾中打開命令終端,解壓文件:

tar -zxv -f cmake-3.17.1. tar .gz
4)進入解壓后的cmake文件,執行:
. /bootstrap
5) 編譯構建:
make
6) 安裝
sudo make install
7) cmake --version

若出現以下版本信息說明安裝成功,可以使用了。

如果出現bash: /usr/bin/cmake: No such file or directory

則是因為cmake 安裝在了/usr/local/bin/cmake,把該路徑下的文件拷貝到問題路徑下即可

2.TensorRT安裝

 進入官網:https://developer.nvidia.com/nvidia-tensorrt-8x-download,下載對應版本

 1)tar xzvf TensorRT-8.0.1.6.Linux.x86_64-gnu.cuda-11.3.cudnn8.2.tar.gz

2)安裝TensorRT wheel 文件,根據python版本選擇,這里是python3.6

cd TensorRT-8.0.1.6/python
pip install tensorrt-8.0.1.6-cp36-none-linux_x86_64.whl

3)安裝graphsurgeon wheel文件

cd TensorRT-8.0.1.6/graphsurgeon
pip install graphsurgeon-0.4.5-py2.py3-none-any.whl

4)安裝完后,需要更新系統的環境

# TensorRT
export LD_LIBRARY_PATH=/home/you_name/soft_file/TensorRT-8.0.1.6/lib:$LD_LIBRARY_PATH
export CUDA_INSTALL_DIR=/usr/local/cuda-11.3
export CUDNN_INSTALL_DIR=/usr/local/cuda-11.3
驗證一下是否成功

5)驗證demo

切換到你包的位置:cd ~~~/TensorRT-8.0.1.6

  • 1、在 ./samples/sampleMNIST 目錄下執行 make 命令。可執行文件生成在 ./bin/ 目錄下。
  • 2、在 ./ 目錄下運行 ./bin/sample_mnist 即可看到預期結果。

3.下載onnx轉tensorrt代碼

   https://github.com/onnx/onnx-tensorrt

 


免責聲明!

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



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