-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tensorrt #9891
add tensorrt #9891
Conversation
dependency has been installed in docker image.
b7cd337
to
0e8e85f
Compare
CMakeLists.txt
Outdated
@@ -39,6 +39,7 @@ option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_F | |||
option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF) | |||
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND}) | |||
option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND}) | |||
option(WITH_TENSORRT "Compile PaddlePaddle with TensorRT support." ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will turn off this latter. Changing TeamCity config should more cautious.
Dockerfile
Outdated
@@ -45,6 +45,12 @@ ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin | |||
# install glide | |||
RUN curl -s -q https://glide.sh/get | sh | |||
|
|||
# Install TensorRT | |||
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 | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 这里的tar.gz和官网下载的有所不同,只包含了include和lib包,目的是为了让包减少2/3的大小,从而节省下载时间。需要加comment说明一下。
- 根据这个包下载的,里面还有targets目录,该目录可以在打包的时候去掉。
TensorRT
├── include
├── lib
└── targets
- 这里使用的
NvInfer.h
,是对原来的版本做了一点修改的,不然会报错。可以写一个issue说明下报错情况,然后在这里加一个comment。
Dockerfile
Outdated
@@ -57,8 +63,7 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8 | |||
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U | |||
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest | |||
# version(1.7.1 for now), which causes building documentation failed. | |||
RUN pip install --upgrade pip && \ | |||
pip install -U wheel && \ | |||
RUN pip install -U wheel && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#9926 merge后,这里需要更新下。
@@ -1,6 +1,6 @@ | |||
cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce) | |||
|
|||
list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc nccl.cc) | |||
list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc nccl.cc tensorrt.cc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要加编译选项来选择是否添加tensorrt.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
// Fix the dynload issue, the following two API are implemented in TensorRT's | ||
// header file, cannot load from the dynamic library. So create our own | ||
// implementation and directly trigger the method from the dynamic library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
58-60的注释需要更新下:
- fix the dynload issue: 请问issue在哪儿?
- API-》APIs
- but can not loaded from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改了
CMakeLists.txt
Outdated
@@ -179,6 +180,7 @@ set(EXTERNAL_LIBS | |||
|
|||
if(WITH_GPU) | |||
include(cuda) | |||
set(WITH_TENSORRT ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句可以去掉。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Dockerfile
Outdated
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 | \ | ||
tar -xz -C /usr/local && \ | ||
cp -rf /usr/local/TensorRT/include /usr/local && \ | ||
cp -rf /usr/local/TensorRT/lib /usr/local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在直接复制到 /usr下了,可以后续pr改下
编译成功,运行单测存在:
将 |
0b5ce6c
to
5132a2b
Compare
d6d030b
to
1fe9f63
Compare
@@ -58,3 +58,11 @@ void GetWarpCTCDsoHandle(void** dso_handle); | |||
* | |||
*/ | |||
void GetLapackDsoHandle(void** dso_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DynamicLoader.h 可以不用修改,是老paddle用的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
fixs: #9921
This is a naive test for TensorRT library integration with Paddle.