I’m trying to use TensorRT for the first time.
Environment:
OS: Ubuntu on Amazon AWS EC2 instance
python 3.7
tensorflow 2.0
I’ve built a model in tensorflow and am trying to convert it using TensorRT following the Tensorflow 2.0 example here:
https://docs.nvidia.com/deeplearning/frameworks/tf-trt-user-guide/index.html#usage-example
When I run:
converter = trt.TrtGraphConverterV2(input_saved_model_dir='models/mymodel')
I get the error:
2019-11-14 17:29:07.427738: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘libnvinfer.so.5’; dlerror: libnvinfer.so.5: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:/home/ubuntu/src/cntk/bindings/python/cntk/libs:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/usr/lib64/openmpi/lib/:/usr/local/cuda/lib64:/usr/local/lib:/usr/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/mpi/lib:/lib/:
2019-11-14 17:29:07.427783: F tensorflow/compiler/tf2tensorrt/stub/nvinfer_stub.cc:49] getInferLibVersion symbol not found.
Aborted (core dumped)
Looking at the thread here, it seems like it may be an issue with needing to set LD_LIBRARY_PATH:
https://devtalk.nvidia.com/default/topic/1036527/tensorrt/importerror-libnvinfer-so-4-cannot-open-shared-object-file-no-such-file-or-directory/
However, when I google setting the LD_LIBRARY_PATH, it seems only necessary when manually installing TensorRT from tar. I have not built/installed TensorRT separately and am just using what’s bundled in with Tensorflow 2.0. Can anyone advise on what’s wrong?
Thanks