TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

How to build TensorRT parsers?

Open peijason opened this issue 6 years ago • 4 comments

Description

Failed to configure TensorRT parsers with BUILD_PARSERS ON, with the following ERROR messages:

 Building for TensorRT version: 7.1.3, library version: 7

 Generated: ....../TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx_onnx2trt_onnx-ml.proto

 Generated: ....../TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-operators_onnx2trt_onnx-ml.proto

 ERRORCannot find TensorRT library.

 CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
 Please set them or make sure they are set and tested correctly in the CMake files:
 TENSORRT_LIBRARY_INFER
     linked by target "nvonnxparser_static" in directory ....../TensorRT/parsers/onnx
     linked by target "nvonnxparser" in directory ....../TensorRT/parsers/onnx
 TENSORRT_LIBRARY_INFER_PLUGIN
     linked by target "nvonnxparser_static" in directory ....../TensorRT/parsers/onnx
     linked by target "nvonnxparser" in directory ....../TensorRT/parsers/onnx
 TENSORRT_LIBRARY_MYELIN
     linked by target "nvonnxparser_static" in directory ....../TensorRT/parsers/onnx
     linked by target "nvonnxparser" in directory ....../TensorRT/parsers/onnx

Environment

TensorRT Version: 7.1.3.4 (current git) GPU Type: Geforce 1050 Ti Nvidia Driver Version: 450.57 CUDA Version: 11.0 CUDNN Version: 8.0.1 (beta) Operating System + Version: Ubuntu 20.04 Python Version (if applicable): 3.8.2 TensorFlow Version (if applicable): 2.2.0 PyTorch Version (if applicable): NOT Installed yet Baremetal or Container (if container which image + tag): N/A

I can proceed with BUILD_PARSERS OFF. However, we prefer building out the TensorRT Parsers. Has anybody done that before?

Cheers

peijason avatar Jul 17 '20 02:07 peijason

Do you have libnvinfer.so.7 in your LD_LIBRARY_PATH?

rajeevsrao avatar Jul 20 '20 17:07 rajeevsrao

I solved this error using these commands prior the build:

export TRT_SOURCE=`pwd`

export TRT_RELEASE=`pwd`/TensorRT-7.1.3.4

export TENSORRT_LIBRARY_INFER=$TRT_RELEASE/targets/x86_64-linux-gnu/lib/libnvinfer.so.7

export TENSORRT_LIBRARY_INFER_PLUGIN=$TRT_RELEASE/targets/x86_64-linux-gnu/lib/libnvinfer_plugin.so.7

export TENSORRT_LIBRARY_MYELIN=$TRT_RELEASE/targets/x86_64-linux-gnu/lib/libmyelin.so

# Edit: You will need to install python3.7, and python2 because currently TensorRT does not generate .whl files for python3.8, while some submodules require python2

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt-get update

sudo apt-get install python3.7 python-dev

# Also had issues with GCC/G++ version. GCC-7 and G++7 worked.

sudo apt install cmake gcc-7 g++-7

# In case Cuda host compiler reports unknown
# Modify paths according to your cuda installation and versions

sudo ln -s /usr/bin/gcc-7 /usr/lib/cuda-10.2/bin/gcc

sudo ln -s /usr/bin/g++-7 /usr/lib/cuda-10.2/bin/g++

# The command used for cmake
# Modify according versions and GPU ARCH
cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_OUT_DIR=`pwd`/out -DCMAKE_CXX_COMPILER=/usr/bin/g++-7 -DCUDA_VERSION="10.2" -DCUDNN_VERSION="7.6.5" -DGPU_ARCHS="75"

kotzir avatar Aug 16 '20 01:08 kotzir

Problem solved.... Thank you ...

peijason avatar Aug 17 '20 17:08 peijason

I have the same issue and tried above solution but nothing changed, is there anyone who faced with this issue and solved it?

tugbakara avatar Aug 22 '23 11:08 tugbakara