Skip to content

Commit 3301d44

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into feature/add_reduce_op_handle
2 parents 3c5bbf4 + 1866597 commit 3301d44

File tree

22 files changed

+407
-15
lines changed

22 files changed

+407
-15
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_F
3939
option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF)
4040
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND})
4141
option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND})
42+
option(WITH_TENSORRT "Compile PaddlePaddle with TensorRT support." OFF)
4243
option(WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON)
4344
option(WITH_TESTING "Compile PaddlePaddle with unit testing" OFF)
4445
option(WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON)
@@ -181,6 +182,11 @@ if(WITH_GPU)
181182
include(cuda)
182183
endif(WITH_GPU)
183184

185+
# TensorRT depends on GPU.
186+
if (NOT WITH_GPU)
187+
set(WITH_TENSORRT OFF)
188+
endif()
189+
184190
if(WITH_AMD_GPU)
185191
find_package(HIP)
186192
include(hip)

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin
4545
# install glide
4646
RUN curl -s -q https://glide.sh/get | sh
4747

48+
# Install TensorRT
49+
# The unnecessary files has been removed to make the library small.
50+
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 | \
51+
tar -xz -C /usr/local && \
52+
cp -rf /usr/local/TensorRT/include /usr && \
53+
cp -rf /usr/local/TensorRT/lib /usr
54+
4855
# git credential to skip password typing
4956
RUN git config --global credential.helper store
5057

@@ -57,7 +64,7 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
5764
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
5865
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
5966
# version(1.7.1 for now), which causes building documentation failed.
60-
RUN pip install --upgrade pip && \
67+
RUN pip install --upgrade pip==9.0.3 && \
6168
pip install -U wheel && \
6269
pip install -U docopt PyYAML sphinx==1.5.6 && \
6370
pip install sphinx-rtd-theme==0.1.9 recommonmark

cmake/external/grpc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ExternalProject_Add(
3333
extern_grpc
3434
DEPENDS protobuf zlib
3535
GIT_REPOSITORY "https://github.com/grpc/grpc.git"
36-
GIT_TAG "v1.11.x"
36+
GIT_TAG "v1.10.x"
3737
PREFIX ${GRPC_SOURCES_DIR}
3838
UPDATE_COMMAND ""
3939
CONFIGURE_COMMAND ""

doc/fluid/api/layers.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ multiplex
473473
.. autofunction:: paddle.fluid.layers.multiplex
474474
:noindex:
475475

476+
label_smooth
477+
------------
478+
479+
.. autofunction:: paddle.fluid.layers.label_smooth
480+
:noindex:
481+
476482
ops
477483
===
478484

doc/fluid/dev/index_cn.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.. toctree::
55
:maxdepth: 1
66

7+
api_doc_std_cn.md
78
new_op_cn.md
89
new_op_kernel.md
910
use_eigen_cn.md

doc/fluid/dev/index_en.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Development
44
.. toctree::
55
:maxdepth: 1
66

7+
api_doc_std_en.md
78
new_op_en.md
89
new_op_kernel.md
910
use_eigen_en.md

paddle/fluid/framework/details/multi_devices_graph_builder.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ MultiDevSSAGraphBuilder::MultiDevSSAGraphBuilder(
5555
}
5656
}
5757

58-
void MultiDevSSAGraphBuilder::CreateOpHandleIOs(SSAGraph *result, OpDesc *op,
58+
void MultiDevSSAGraphBuilder::CreateOpHandleIOs(SSAGraph *result,
59+
const OpDesc &op,
5960
const platform::Place &p,
6061
const size_t &i) const {
6162
auto *op_handle = result->ops_.back().get();
62-
op_handle->dev_ctxes_[p] = const_cast<platform::DeviceContext *>(
63-
platform::DeviceContextPool::Instance().Get(p));
63+
op_handle->dev_ctxes_[p] = platform::DeviceContextPool::Instance().Get(p);
6464

65-
auto var_names = op->InputArgumentNames();
65+
auto var_names = op.InputArgumentNames();
6666

6767
for (auto &each_var_name : var_names) {
6868
VarHandle *var = CreateOrGetLatestVarHandle(result, each_var_name, p, i);
6969
op_handle->AddInput(var);
7070
}
7171

72-
var_names = op->OutputArgumentNames();
72+
var_names = op.OutputArgumentNames();
7373

7474
for (auto &each_var_name : var_names) {
7575
CreateOpOutput(result, op_handle, each_var_name, p, i);
@@ -107,7 +107,7 @@ std::unique_ptr<SSAGraph> MultiDevSSAGraphBuilder::Build(
107107
result.ops_.emplace_back(new SendOpHandle(*op, s, p));
108108
// Create inputs for output on original place and no ssa output
109109
// is created for send op.
110-
CreateOpHandleIOs(&result, op, p, 0);
110+
CreateOpHandleIOs(&result, *op, p, 0);
111111
continue;
112112
}
113113

@@ -117,7 +117,7 @@ std::unique_ptr<SSAGraph> MultiDevSSAGraphBuilder::Build(
117117

118118
result.ops_.emplace_back(new ComputationOpHandle(*op, s, p));
119119
auto *op_handle = result.ops_.back().get();
120-
CreateOpHandleIOs(&result, op, p, i);
120+
CreateOpHandleIOs(&result, *op, p, i);
121121

122122
auto var_names = op->OutputArgumentNames();
123123

paddle/fluid/framework/details/multi_devices_graph_builder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class MultiDevSSAGraphBuilder : public SSAGraphBuilder {
4545
std::unique_ptr<SSAGraph> Build(const ProgramDesc &program) const override;
4646

4747
private:
48-
void CreateOpHandleIOs(SSAGraph *result, OpDesc *op, const platform::Place &p,
49-
const size_t &i) const;
48+
void CreateOpHandleIOs(SSAGraph *result, const OpDesc &op,
49+
const platform::Place &p, const size_t &i) const;
5050

5151
private:
5252
std::string loss_var_name_;

paddle/fluid/framework/program_desc_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ TEST(ProgramDesc, copy_ctor) {
6666

6767
for (size_t i = 0; i < global_block->OpSize(); ++i) {
6868
auto op_origin = global_block->Op(i);
69-
auto op_copy = global_block->Op(i);
69+
auto op_copy = global_block_copy->Op(i);
7070

7171
ASSERT_EQ(op_origin->Type(), op_copy->Type());
7272
ASSERT_EQ(op_origin->Inputs(), op_copy->Inputs());
@@ -131,7 +131,7 @@ TEST(ProgramDescBind, serialize_and_deserialize) {
131131

132132
for (size_t i = 0; i < global_block->OpSize(); ++i) {
133133
auto op_origin = global_block->Op(i);
134-
auto op_restored = global_block->Op(i);
134+
auto op_restored = global_block_restored->Op(i);
135135

136136
ASSERT_EQ(op_origin->Type(), op_restored->Type());
137137
ASSERT_EQ(op_origin->Inputs(), op_restored->Inputs());

paddle/fluid/inference/CMakeLists.txt

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

2222
if(WITH_TESTING)
2323
add_subdirectory(tests/book)
24+
if (WITH_TENSORRT)
25+
add_subdirectory(tensorrt)
26+
endif()
2427
endif()

0 commit comments

Comments
 (0)