Skip to content

Commit 5a433ec

Browse files
authored
Merge pull request #10134 from luotao1/tensorrt_include
refine tensorrt cmake and dockerfile
2 parents 576b9fd + 71f51ff commit 5a433ec

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
4949
RUN curl -s -q https://glide.sh/get | sh
5050

5151
# Install TensorRT
52-
# The unnecessary files has been removed to make the library small. It only contains include and lib now.
52+
# following TensorRT.tar.gz is not the default official one, we do two miny changes:
53+
# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now,
54+
# and its size is only one-third of the official one.
55+
# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle.
56+
# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details.
5357
RUN wget -qO- http://paddlepaddledeps.bj.bcebos.com/TensorRT-4.0.0.3.Ubuntu-16.04.4.x86_64-gnu.cuda-8.0.cudnn7.0.tar.gz | \
5458
tar -xz -C /usr/local && \
5559
cp -rf /usr/local/TensorRT/include /usr && \

cmake/tensorrt.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ if(TENSORRT_FOUND)
3030

3131
message(STATUS "Current TensorRT header is ${TENSORRT_INCLUDE_DIR}/NvInfer.h. "
3232
"Current TensorRT version is v${TENSORRT_MAJOR_VERSION}. ")
33+
include_directories(${TENSORRT_INCLUDE_DIR})
34+
list(APPEND EXTERNAL_LIBS ${TENSORRT_LIBRARY})
3335
endif()

paddle/fluid/inference/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ endif()
2121

2222
if(WITH_TESTING)
2323
add_subdirectory(tests/book)
24-
if (TENSORRT_FOUND)
25-
add_subdirectory(tensorrt)
26-
endif()
24+
endif()
25+
26+
if (TENSORRT_FOUND)
27+
add_subdirectory(tensorrt)
2728
endif()

0 commit comments

Comments
 (0)