From 466d177d09a1c73793c7eb5dafaedc388673b361 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Tue, 16 Apr 2019 15:02:17 +0800 Subject: [PATCH] add pybind dependency test=develop --- paddle/fluid/framework/fleet/nccl_wrapper.cc | 10 +++++----- paddle/fluid/framework/fleet/nccl_wrapper.h | 1 + paddle/fluid/pybind/fleet_wrapper_py.cc | 1 - paddle/fluid/pybind/nccl_wrapper_py.cc | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/framework/fleet/nccl_wrapper.cc b/paddle/fluid/framework/fleet/nccl_wrapper.cc index 9a39da6dca..0df6aca8b1 100644 --- a/paddle/fluid/framework/fleet/nccl_wrapper.cc +++ b/paddle/fluid/framework/fleet/nccl_wrapper.cc @@ -24,9 +24,9 @@ std::shared_ptr NCCLWrapper::s_instance_ = NULL; bool NCCLWrapper::is_initialized_ = false; void NCCLWrapper::InitNCCL() { - platform::dynload::ncclCommInitRank( + PADDLE_ENFORCE(platform::dynload::ncclCommInitRank( &(nccl_info_.comm_), nccl_info_.global_ranks_, nccl_info_.nccl_id_, - nccl_info_.my_global_rank_); + nccl_info_.my_global_rank_)); return; } @@ -55,9 +55,9 @@ void NCCLWrapper::SyncVar(const int root_rank, const Scope& scope, auto var = scope.FindVar(name); LoDTensor* tensor = var->GetMutable(); int32_t total_size = tensor->numel(); - platform::dynload::ncclBcast(reinterpret_cast(tensor->data()), - total_size, ncclFloat, root_rank, - nccl_info_.comm_, nccl_info_.stream_); + PADDLE_ENFORCE(platform::dynload::ncclBcast( + reinterpret_cast(tensor->data()), total_size, ncclFloat, + root_rank, nccl_info_.comm_, nccl_info_.stream_)); cudaStreamSynchronize(nccl_info_.stream_); } } diff --git a/paddle/fluid/framework/fleet/nccl_wrapper.h b/paddle/fluid/framework/fleet/nccl_wrapper.h index 5d73cba892..eb4e5e19a3 100644 --- a/paddle/fluid/framework/fleet/nccl_wrapper.h +++ b/paddle/fluid/framework/fleet/nccl_wrapper.h @@ -24,6 +24,7 @@ limitations under the License. */ #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable_helper.h" +#include "paddle/fluid/platform/dynload/nccl.h" #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN namespace paddle { diff --git a/paddle/fluid/pybind/fleet_wrapper_py.cc b/paddle/fluid/pybind/fleet_wrapper_py.cc index 77f15db8d6..2f6a7d2480 100644 --- a/paddle/fluid/pybind/fleet_wrapper_py.cc +++ b/paddle/fluid/pybind/fleet_wrapper_py.cc @@ -36,7 +36,6 @@ limitations under the License. */ #include "paddle/fluid/pybind/fleet_wrapper_py.h" namespace py = pybind11; -namespace pd = paddle::framework; namespace paddle { namespace pybind { diff --git a/paddle/fluid/pybind/nccl_wrapper_py.cc b/paddle/fluid/pybind/nccl_wrapper_py.cc index aec4f44635..bbba03f666 100644 --- a/paddle/fluid/pybind/nccl_wrapper_py.cc +++ b/paddle/fluid/pybind/nccl_wrapper_py.cc @@ -29,6 +29,7 @@ limitations under the License. */ #include "paddle/fluid/framework/async_executor.h" #include "paddle/fluid/framework/data_feed.h" #include "paddle/fluid/framework/data_feed.pb.h" +#include "paddle/fluid/framework/fleet/nccl_wrapper.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/inference/io.h" #include "paddle/fluid/platform/place.h" -- GitLab