Skip to content

Commit

Permalink
feat(TRT): port to TensorRT 21.04/7.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fantes authored and mergify[bot] committed May 25, 2021
1 parent dd71a35 commit 4377451
Show file tree
Hide file tree
Showing 8 changed files with 359 additions and 245 deletions.
21 changes: 12 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -926,27 +926,27 @@ if (USE_TENSORRT)
set(TENSORRT_INC_DIR /usr/include/x86_64-linux-gnu)
endif()

if (NOT EXISTS "${TRTTESTDIR}/libnvinfer.so")
message(FATAL_ERROR "Could not find TensorRT ${TENSORRT_LIB_DIR}/libnvinfer.so, please provide tensorRT location as TENSORRT_DIR or (TENSORRT_LIB_DIR _and_ TENSORRT_INC_DIR)")
if (NOT EXISTS "${TRTTESTDIR}/libnvinfer.so.7")
message(FATAL_ERROR "Could not find TensorRT ${TENSORRT_LIB_DIR}/libnvinfer.so.7, please provide tensorRT location as TENSORRT_DIR or (TENSORRT_LIB_DIR _and_ TENSORRT_INC_DIR)")
else()
message(STATUS "Found TensorRT libraries : ${TRTTESTDIR}/libnvinfer.so")
endif()

set(TENSORRT_LIB_DIR ${CMAKE_BINARY_DIR}/tensorrt-oss/bin/ ${TENSORRT_LIB_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(TENSORRT_LIBS nvinfer nvcaffeparser nvinfer_plugin nvonnxparser )
set(TENSORRT_LIBS /usr/lib/x86_64-linux-gnu/libnvinfer.so.7 nvcaffeparser nvinfer_plugin nvonnxparser )

if (NOT TENSORRT_VERSION)
if (EXISTS "${TRTTESTDIR}/libnvinfer.so.7.1.3")
set(TENSORRT_VERSION 20.09)
message(STATUS "Found TensorRT libraries version 7.1.3")
if (EXISTS "${TRTTESTDIR}/libnvinfer.so.7.2.3")
set(TENSORRT_VERSION 21.04)
message(STATUS "Found TensorRT libraries version 7.2.3")
# TODO(sileht): Update trt-oss patches for 7.2.2
# elseif (EXISTS "${TRTTESTDIR}/libnvinfer.so.7.2.2")
# set(TENSORRT_VERSION 20.12)
# message(STATUS "Found TensorRT libraries version 7.2.2")
elseif (EXISTS "${TRTTESTDIR}/libnvinfer.so.7")
set(TENSORRT_VERSION 20.09)
message(WARNING "No supported TensorRT version found assuming 20.09/7.1.3")
set(TENSORRT_VERSION 21.04)
message(WARNING "No supported TensorRT version found assuming 21.04/7.2.3")
else()
message(FATAL_ERROR "No supported TensorRT version found")
endif()
Expand All @@ -967,6 +967,9 @@ if (USE_TENSORRT)
set(TRT_PATCHES
${TRT_PATCHES_PATH}/0001-support-for-refinedet.patch
${TRT_PATCHES_PATH}/0003-c++14.patch
${TRT_PATCHES_PATH}/0002-find-myelin.patch
${TRT_PATCHES_PATH}/0006-find-7.patch
${TRT_PATCHES_PATH}/0008-cuda13.patch
)

# Tensorrt uses its own protobuf version (3.0.0) and this cannot be overrided
Expand All @@ -977,7 +980,7 @@ if (USE_TENSORRT)
GIT_REPOSITORY https://github.com/NVIDIA/TensorRT.git
GIT_TAG ${TENSORRT_VERSION}
GIT_CONFIG advice.detachedHead=false
PATCH_COMMAND git reset --hard && git apply ${TRT_PATCHES}
PATCH_COMMAND git reset --hard && git submodule foreach --recursive git reset --hard && git apply ${TRT_PATCHES}
CMAKE_ARGS ${TRT_FLAGS}
INSTALL_COMMAND ""
)
Expand Down
4 changes: 2 additions & 2 deletions docker/gpu_tensorrt.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax = docker/dockerfile:1.0-experimental
FROM nvcr.io/nvidia/tensorrt:20.12-py3 AS build
FROM nvcr.io/nvidia/tensorrt:21.04-py3 AS build

ARG DEEPDETECT_RELEASE=OFF
ARG DEEPDETECT_ARCH=gpu
Expand Down Expand Up @@ -110,7 +110,7 @@ RUN --mount=type=cache,target=/ccache/ mkdir build && cd build && ../build.sh
RUN ./docker/get_libs.sh

# Build final Docker image
FROM nvcr.io/nvidia/tensorrt:20.12-py3 AS runtime
FROM nvcr.io/nvidia/tensorrt:21.04-py3 AS runtime

ARG DEEPDETECT_ARCH=gpu

Expand Down
Loading

0 comments on commit 4377451

Please sign in to comment.