以Tar包的方式安装TensorRT
准备TensorRT的C++环境

准备工作
TensorRT依赖CUDA与cuDNN,具体的版本信息可以通过官方给出的支持矩阵找到:
Support Matrix :: NVIDIA Deep Learning TensorRT Documentation
These support matrices provide a look into the supported platforms, features, and hardware capabilities of the NVIDIA TensorRT 8.2.5 APIs, parsers, and layers.
TensorRT 8.2.5支持的CUDA版本还是比较齐全的。不过cuDNN的版本只显示了8.2.1。所以需要根据你的实际需求确定CUDA版本。由于我计划使用ONNXRUNTIME,同样查询官方给出的支持矩阵:
TensorRT
Instructions to execute ONNX Runtime on NVIDIA GPUs with the TensorRT execution provider
ONNX Runtime | TensorRT | CUDA |
---|---|---|
master | 8.2 | 11.4 |
1.11 | 8.2 | 11.4 |
这里显示1.11版本支持的CDUA为11.4。
下载安装包
从官网下载安装包。注意这里可能需要以开发者账户登录。
NVIDIA TensorRT
NVIDIA TensorRT What is NVIDIA TensorRT Features Key Products Performance Framework Integrations Success Stories Introductory Resources NVIDIA TensorRT NVIDIA® TensorRT™, an SDK for high-performance deep learning inference, includes a deep learning inference optimizer and runtime that delivers low l…

安装
首先解压安装包:
tar xzvf TensorRT-8.2.5.1.Linux.x86_64-gnu.cuda-11.4.cudnn8.2.tar.gz
然后将安装包拷贝到你计划使用的位置:
sudo mv TensorRT-8.2.5.1 /usr/local/
完成。
使用
设定动态链接库的环境变量:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/TensorRT-8.2.5.1/lib
你也可以将这行指令加入到 home
目录下的 .bashrc
中。
Comments ()