Tensorrt: How to build TensorRT parsers?

Created on 17 Jul 2020  路  3Comments  路  Source: NVIDIA/TensorRT

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

OSS Build question

All 3 comments

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

I solved this error using these commands prior the build:

``bash 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"

Problem solved.... Thank you ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yflv-yanxia picture yflv-yanxia  路  3Comments

WangXuanBT picture WangXuanBT  路  3Comments

AlphaJia picture AlphaJia  路  3Comments

sbbug picture sbbug  路  5Comments

stengoes picture stengoes  路  6Comments