Skip to content

Commit c70ddb0

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into feature/polish_visit_data_type
2 parents 741401e + ded2153 commit c70ddb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5653
-171
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
2525
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
2626
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
2727

28-
find_package(Sphinx)
2928
if(NOT CMAKE_CROSSCOMPILING)
3029
find_package(CUDA QUIET)
3130
endif(NOT CMAKE_CROSSCOMPILING)
@@ -226,5 +225,7 @@ if(WITH_PYTHON)
226225
endif()
227226

228227
if(WITH_DOC)
228+
find_package(Sphinx REQUIRED)
229+
find_python_module(recommonmark REQUIRED)
229230
add_subdirectory(doc)
230231
endif()

cmake/external/mkldnn.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ ExternalProject_Add(
5656
GIT_TAG "v0.14"
5757
PREFIX ${MKLDNN_SOURCES_DIR}
5858
UPDATE_COMMAND ""
59+
# Patch MKLDNN to compile with gcc 4.8, the related issue is in intel/mkl-dnn#237.
60+
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/mkldnn.hpp ${MKLDNN_SOURCES_DIR}/src/extern_mkldnn/include/mkldnn.hpp
5961
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR}
6062
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
6163
CMAKE_ARGS -DMKLROOT=${MKLML_ROOT}

doc/v2/build_and_install/build_from_source_cn.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
----------------
2020

2121
PaddlePaddle需要使用Docker环境完成编译,这样可以免去单独安装编译依赖的步骤,可选的不同编译环境Docker镜像
22-
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ 找到。或者
23-
参考下述可选步骤,从源码中构建用于编译PaddlePaddle的Docker镜像。
22+
可以在 `这里 <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ 找到,您也可以
23+
在 `这里 <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`_ 找到 paddle_manylinux_devel
24+
镜像的编译以及使用方法。或者参考下述可选步骤,从源码中构建用于编译PaddlePaddle的Docker镜像。
2425

2526
如果您选择不使用Docker镜像,则需要在本机安装下面章节列出的 `编译依赖`_ 之后才能开始编译的步骤。
2627

doc/v2/build_and_install/build_from_source_en.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ How To Build
2222
You need to use Docker to build PaddlePaddle
2323
to avoid installing dependencies by yourself. We have several pre-built
2424
Docker images `here <https://hub.docker.com/r/paddlepaddle/paddle_manylinux_devel/tags/>`_ ,
25+
you can also find how to build and use paddle_manylinux_devel Docker image from
26+
`here <https://github.com/PaddlePaddle/Paddle/tree/develop/tools/manylinux1/>`_
2527
Or you can build your own image from source as the optional step below:
2628

2729
.. code-block:: bash

paddle/fluid/framework/operator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ class ExecutionContext {
192192
return op_.Attr<T>(name);
193193
}
194194

195+
bool HasInput(const std::string& name) const { return op_.HasInputs(name); }
196+
197+
bool HasOutput(const std::string& name) const { return op_.HasOutputs(name); }
198+
195199
size_t InputSize(const std::string& name) const {
196200
return op_.Inputs(name).size();
197201
}

paddle/fluid/framework/parallel_executor.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ ParallelExecutor::ParallelExecutor(
5858
const std::unordered_set<std::string> &bcast_vars,
5959
const ProgramDesc &main_program, const std::string &loss_var_name,
6060
Scope *scope, const std::vector<Scope *> &local_scopes, bool allow_op_delay,
61-
bool use_default_grad_scale, bool balance_parameter_opt_between_cards)
61+
bool use_default_grad_scale, bool balance_parameter_opt_between_cards,
62+
size_t num_trainers, size_t trainer_id)
6263
: member_(new ParallelExecutorPrivate(places)) {
6364
member_->global_scope_ = scope;
6465

@@ -80,7 +81,13 @@ ParallelExecutor::ParallelExecutor(
8081

8182
// Bcast Parameters to all GPUs
8283
#ifdef PADDLE_WITH_CUDA
83-
member_->nccl_ctxs_.reset(new platform::NCCLContextMap(member_->places_));
84+
auto *nccl_id_var = scope->FindVar(NCCL_ID_VARNAME);
85+
ncclUniqueId *nccl_id = nullptr;
86+
if (nccl_id_var != nullptr) {
87+
nccl_id = nccl_id_var->GetMutable<ncclUniqueId>();
88+
}
89+
member_->nccl_ctxs_.reset(new platform::NCCLContextMap(
90+
member_->places_, nccl_id, num_trainers, trainer_id));
8491
#endif
8592
if (platform::is_gpu_place(places[0]) && member_->local_scopes_.size() != 1 &&
8693
local_scopes.empty()) { // Is CUDA

paddle/fluid/framework/parallel_executor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class ParallelExecutor {
4141
const std::string& loss_var_name, Scope* scope,
4242
const std::vector<Scope*>& local_scopes,
4343
bool allow_op_delay, bool use_default_grad_scale,
44-
bool balance_parameter_opt_between_cards);
44+
bool balance_parameter_opt_between_cards,
45+
size_t num_trainers = 1, size_t trainer_id = 0);
4546

4647
~ParallelExecutor();
4748

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
cc_library(dot SRCS dot.cc)
1+
cc_library(analysis SRCS dot.cc node.cc node.h)
2+
cc_test(test_node SRCS node_tester.cc DEPS analysis)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
15+
namespace paddle {
16+
namespace inference {
17+
namespace analysis {
18+
19+
enum class Device { CPU, GPU };
20+
21+
} // namespace analysis
22+
} // namespace inference
23+
} // namespace paddle

paddle/fluid/inference/analysis/dot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <glog/logging.h>
2323
#include <sstream>
24+
#include <string>
2425
#include <unordered_map>
2526
#include <vector>
2627

0 commit comments

Comments
 (0)