Skip to content

Commit

Permalink
compile with nccl2 (#8411)
Browse files Browse the repository at this point in the history
* compile with nccl2

* add ncclGroup; it is necessary in nccl2

* add back libnccl-dev
  • Loading branch information
Yang Yang(Tony) committed Feb 13, 2018
1 parent dafc7e3 commit 87f4311
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ include(external/boost) # download boost
include(external/any) # download libn::any
include(external/eigen) # download eigen3
include(external/pybind11) # download pybind11
include(external/nccl)
include(external/cares)
include(external/grpc)

Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(WITH_GPU)
cc_library(enforce SRCS enforce.cc DEPS nccl)
cc_library(enforce SRCS enforce.cc DEPS)
else()
cc_library(enforce SRCS enforce.cc)
endif()
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/platform/dynload/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce)
nv_library(dynload_cuda SRCS cublas.cc cudnn.cc curand.cc nccl.cc
DEPS dynamic_loader nccl)
DEPS dynamic_loader)
cc_library(dynload_warpctc SRCS warpctc.cc DEPS dynamic_loader warpctc)
2 changes: 2 additions & 0 deletions paddle/fluid/platform/nccl_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ TEST(NCCL, all_reduce) {

VLOG(1) << "Invoking ncclAllReduce";

dynload::ncclGroupStart();
for (int i = 0; i < dev_count; ++i) {
VLOG(1) << "Invoking ncclAllReduce with device " << i;
SetDeviceId(i);
Expand All @@ -97,6 +98,7 @@ TEST(NCCL, all_reduce) {
ncclSum, comms[i], data[i]->dev_ctx.stream()));
VLOG(1) << "Invoked ncclAllReduce for device " << i;
}
dynload::ncclGroupEnd();

VLOG(1) << "Invoked ncclAllReduce";

Expand Down
5 changes: 4 additions & 1 deletion paddle/scripts/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function cmake_gen() {
Configuring cmake in /paddle/build ...
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
${PYTHON_FLAGS}
-DWITH_DSO=ON
-DWITH_DOC=OFF
-DWITH_GPU=${WITH_GPU:-OFF}
-DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF}
Expand All @@ -57,6 +58,7 @@ EOF
cmake .. \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} \
${PYTHON_FLAGS} \
-DWITH_DSO=ON \
-DWITH_DOC=OFF \
-DWITH_GPU=${WITH_GPU:-OFF} \
-DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF} \
Expand Down Expand Up @@ -171,7 +173,7 @@ EOF
if [[ ${WITH_GPU} == "ON" ]]; then
NCCL_DEPS="apt-get install -y libnccl-dev &&"
else
NCCL_DEPS=""
NCCL_DEPS=""
fi

cat >> /paddle/build/Dockerfile <<EOF
Expand All @@ -187,6 +189,7 @@ EOF
ldconfig
${DOCKERFILE_CUDNN_DSO}
${DOCKERFILE_GPU_ENV}
ENV NCCL_LAUNCH_MODE PARALLEL
ADD go/cmd/pserver/pserver /usr/bin/
ADD go/cmd/master/master /usr/bin/
# default command shows the paddle version and exit
Expand Down

0 comments on commit 87f4311

Please sign in to comment.