Mxnet 1.6 - TensorRT not working

Hi,

I am trying to optimize mxnet models using it’s contrib.tensorrt module. I am following this tutorial: https://mxnet.apache.org/api/python/docs/tutorials/performance/backend/tensorrt/tensorrt.

However, the following line causes an error:

trt_sym = sym.get_backend_symbol('TensorRT')

.

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/mxnet/symbol/symbol.py", line 2717, in get_backend_symbol
    check_call(_LIB.MXGenBackendSubgraph(self.handle, c_str(backend), ctypes.byref(out)))
  File "/usr/local/lib/python3.6/dist-packages/mxnet/base.py", line 255, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [15:07:42] src/c_api/../operator/subgraph/subgraph_property.h:502: Check failed: it != backend_map_.end(): SubgraphProperty TensorRt is not found in SubgraphBackendRegistry
Stack trace:
  [bt] (0) /usr/local/mxnet/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4c) [0x7f7662eebc]
  [bt] (1) /usr/local/mxnet/libmxnet.so(mxnet::op::SubgraphBackendRegistry::GetSubgraphBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x150) [0x7f79b80268]
  [bt] (2) /usr/local/mxnet/libmxnet.so(MXGenBackendSubgraph+0xf8) [0x7f79b78750]
  [bt] (3) /usr/lib/aarch64-linux-gnu/libffi.so.6(ffi_call_SYSV+0x64) [0x7fa83bfd28]
  [bt] (4) /usr/lib/aarch64-linux-gnu/libffi.so.6(ffi_call+0xc8) [0x7fa83c0698]
  [bt] (5) /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-aarch64-linux-gnu.so(_ctypes_callproc+0x41c) [0x7fa83e31ac]
  [bt] (6) /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-aarch64-linux-gnu.so(+0x104c0) [0x7fa83e34c0]
  [bt] (7) python3(_PyObject_FastCallDict+0xd0) [0x6057e0]
  [bt] (8) python3() [0x529738]

I am using mxnet 1.6 installed from the precompiled wheel. (https://devtalk.nvidia.com/default/topic/1070767/jetson-nano/i-was-unable-to-compile-and-install-mxnet1-5-with-tensorrt-on-the-jetson-nano-is-there-someone-have-compile-it-please-help-me-thank-you-/post/5426042/#5426042)

It seems that this error is caused because this wheel was not build with the USE_TENSORRT option. I tried to compile mxnet from source with the USE_TENSORRT option but it asks for cmake version 3.13, and the latest in jetson Xavier is 3.10.

Hi,

I’m not sure if we added the TensorRT support when building the package.

Maybe you can also build it from source for us.
The cmake 3.13 can be upgraded with these command:

wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0/
cd cmake-3.13.0/
./bootstrap --system-curl 
make -j8
echo 'export PATH=/home/nvidia/cmake-3.13.0/bin/:$PATH' >> ~/.bashrc
source ~/.bashrc

Thanks.