问题说明
使用trtexec报错
trtexec: command not found
①使用在官网上下载的
https://developer.nvidia.com/tensorrt/download
②使用下载好的tar包
③在使用其指令时出现标题错误
④为了使 PATH 的更改在容器重启后仍然有效,可以将 export 命令添加到容器的启动脚本或者 .bashrc / .profile 等 Shell 初始化文件中。例如,编辑 /root/.bashrc 文件,在文件末尾添加上述 export 命令
echo "export PATH=\$PATH:TensorRT-1.0.1.6/targets/x86_64-linux-gnu/bin" >> /root/.bashrc
tips:
补充命令(在多人协同服务器时,可以使用,目的是只改变自己的编译环境,不影响他人) 添加自己的CUDA环境。只在本次使用有效。
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../TensorRT-8.5/TensorRT-8.5.1.7/lib
tips:
补充命令(在多人协同服务器时,可以使用,目的是只改变自己的编译环境,不影响他人) 添加自己的CUDA环境。只在本次使用有效。
export PATH=/data/mayu/CUDA/bin${PATH:+:${PATH}}
LD_LIBRARY_PATH=/data/mayu/CUDA/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
⑤再次使用命令
trtexec --help
=== Model Options ===
--onnx=<file> ONNX model
=== Build Options ===
--minShapes=spec Build with dynamic shapes using a profile with the min shapes provided
--optShapes=spec Build with dynamic shapes using a profile with the opt shapes provided
--maxShapes=spec Build with dynamic shapes using a profile with the max shapes provided
--minShapesCalib=spec Calibrate with dynamic shapes using a profile with the min shapes provided
--optShapesCalib=spec Calibrate with dynamic shapes using a profile with the opt shapes provided
--maxShapesCalib=spec Calibrate with dynamic shapes using a profile with the max shapes provided
Note: All three of min, opt and max shapes must be supplied.
However, if only opt shapes is supplied then it will be expanded so
that min shapes and max shapes are set to the same values as opt shapes.
Input names can be wrapped with escaped single quotes (ex: 'Input:0').
Example input shapes spec: input0:1x3x256x256,input1:1x3x128x128
For scalars (0-D shapes), use input0:scalar or simply input0: with nothing after the colon.
Each input shape is supplied as a key-value pair where key is the input name and
value is the dimensions (including the batch dimension) to be used for that input.
Each key-value pair has the key and value separated using a colon (:).
Multiple input shapes can be provided via comma-separated key-value pairs, and each input name can
contain at most one wildcard ('*') character.
--inputIOFormats=spec Type and format of each of the input tensors (default = all inputs in fp32:chw)
See --outputIOFormats help for the grammar of type and format list.
Note: If this option is specified, please set comma-separated types and formats for all
inputs following the same order as network inputs ID (even if only one input
needs specifying IO format) or set the type and format once for broadcasting.
--outputIOFormats=spec Type and format of each of the output tensors (default = all outputs in fp32:chw)
Note: If this option is specified, please set comma-separated types and formats for all
outputs following the same order as network outputs ID (even if only one output
needs specifying IO format) or set the type and format once for broadcasting.
IO Formats: spec ::= IOfmt[","spec]
IOfmt ::= type:fmt
type ::= "fp32"|"fp16"|"bf16"|"int32"|"int64"|"int8"|"uint8"|"bool"
fmt ::= ("chw"|"chw2"|"chw4"|"hwc8"|"chw16"|"chw32"|"dhwc8"|
"cdhw32"|"hwc"|"dla_linear"|"dla_hwc4")["+"fmt]