How to build mxnet with tensorrt support?

#1

Hi, I noticed the USE_TENSORRT option in CMakeLists.txt and tried to compile mxnet from source with the cmd like below

cmake -GNinja -DUSE_CUDA=ON -DUSE_MKL_IF_AVAILABLE=OFF -DUSE_OPENCV=ON -DUSE_CUDNN=ON -DUSE_TENSORRT=ON ..

But get some error messages below

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:
ONNX_LIBRARY
    linked by target "im2rec" in directory /home/lhy/Documents/Lib/incubator-mxnet
    linked by target "mxnet" in directory /home/lhy/Documents/Lib/incubator-mxnet
    linked by target "mxnet_unit_tests" in directory /home/lhy/Documents/Lib/incubator-mxnet/tests
    linked by target "mlp_cpu" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "lenet_with_mxdataiter" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "alexnet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "mlp_gpu" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "lenet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "googlenet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "charRNN" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "inception_bn" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "mlp" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "resnet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "image-classification-predict" in directory /home/lhy/Documents/Lib/incubator-mxnet/example/image-classification/predict-cpp
ONNX_PROTO_LIBRARY
    linked by target "im2rec" in directory /home/lhy/Documents/Lib/incubator-mxnet
    linked by target "mxnet" in directory /home/lhy/Documents/Lib/incubator-mxnet
    linked by target "mxnet_unit_tests" in directory /home/lhy/Documents/Lib/incubator-mxnet/tests
    linked by target "mlp_cpu" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "lenet_with_mxdataiter" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "alexnet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "mlp_gpu" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "lenet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "googlenet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "charRNN" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "inception_bn" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "mlp" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "resnet" in directory /home/lhy/Documents/Lib/incubator-mxnet/cpp-package/example
    linked by target "image-classification-predict" in directory /home/lhy/Documents/Lib/incubator-mxnet/example/image-classification/predict-cpp

I did not find any related doc in this page. Any help is appreciated.

#2

Install several things such as protobuf, tensorRT library, onnx, onnx-tensorrt.

Follow these two links:


#3

Thank you. The problem has been solved now.