Skip to content

Commit 87f4311

Browse files
author
Yang Yang(Tony)
authored
compile with nccl2 (#8411)
* compile with nccl2 * add ncclGroup; it is necessary in nccl2 * add back libnccl-dev
1 parent dafc7e3 commit 87f4311

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ include(external/boost) # download boost
142142
include(external/any) # download libn::any
143143
include(external/eigen) # download eigen3
144144
include(external/pybind11) # download pybind11
145-
include(external/nccl)
146145
include(external/cares)
147146
include(external/grpc)
148147

paddle/fluid/platform/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if(WITH_GPU)
2-
cc_library(enforce SRCS enforce.cc DEPS nccl)
2+
cc_library(enforce SRCS enforce.cc DEPS)
33
else()
44
cc_library(enforce SRCS enforce.cc)
55
endif()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce)
22
nv_library(dynload_cuda SRCS cublas.cc cudnn.cc curand.cc nccl.cc
3-
DEPS dynamic_loader nccl)
3+
DEPS dynamic_loader)
44
cc_library(dynload_warpctc SRCS warpctc.cc DEPS dynamic_loader warpctc)

paddle/fluid/platform/nccl_test.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ TEST(NCCL, all_reduce) {
8989

9090
VLOG(1) << "Invoking ncclAllReduce";
9191

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

101103
VLOG(1) << "Invoked ncclAllReduce";
102104

paddle/scripts/docker/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function cmake_gen() {
3434
Configuring cmake in /paddle/build ...
3535
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
3636
${PYTHON_FLAGS}
37+
-DWITH_DSO=ON
3738
-DWITH_DOC=OFF
3839
-DWITH_GPU=${WITH_GPU:-OFF}
3940
-DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF}
@@ -57,6 +58,7 @@ EOF
5758
cmake .. \
5859
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} \
5960
${PYTHON_FLAGS} \
61+
-DWITH_DSO=ON \
6062
-DWITH_DOC=OFF \
6163
-DWITH_GPU=${WITH_GPU:-OFF} \
6264
-DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF} \
@@ -171,7 +173,7 @@ EOF
171173
if [[ ${WITH_GPU} == "ON" ]]; then
172174
NCCL_DEPS="apt-get install -y libnccl-dev &&"
173175
else
174-
NCCL_DEPS=""
176+
NCCL_DEPS=""
175177
fi
176178

177179
cat >> /paddle/build/Dockerfile <<EOF
@@ -187,6 +189,7 @@ EOF
187189
ldconfig
188190
${DOCKERFILE_CUDNN_DSO}
189191
${DOCKERFILE_GPU_ENV}
192+
ENV NCCL_LAUNCH_MODE PARALLEL
190193
ADD go/cmd/pserver/pserver /usr/bin/
191194
ADD go/cmd/master/master /usr/bin/
192195
# default command shows the paddle version and exit

0 commit comments

Comments
 (0)