Skip to content

Commit

Permalink
Use open-source NCCL2 in PyTorch (pytorch#12312)
Browse files Browse the repository at this point in the history
Summary:
- Removed the old nccl file
- Make open-source NCCL a submodule
- CMake to make NCCL itself

NCCL2 now is in the default build.
Pull Request resolved: pytorch#12312

Differential Revision: D10190845

Pulled By: teng-li

fbshipit-source-id: 08d42253b774149a66919d194f88b34628c39bae
  • Loading branch information
teng-li authored and facebook-github-bot committed Oct 4, 2018
1 parent 6b79e16 commit ae7a7fb
Show file tree
Hide file tree
Showing 63 changed files with 12 additions and 9,561 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@
[submodule "third_party/ideep"]
path = third_party/ideep
url = https://github.com/intel/ideep
[submodule "third_party/nccl/nccl"]
path = third_party/nccl/nccl
url = https://github.com/NVIDIA/nccl
2 changes: 1 addition & 1 deletion cmake/External/nccl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (NOT __NCCL_INCLUDED)
target_include_directories(__caffe2_nccl INTERFACE ${NCCL_INCLUDE_DIRS})
else()
# build directory
set(nccl_PREFIX ${PROJECT_SOURCE_DIR}/third_party/nccl)
set(nccl_PREFIX ${PROJECT_SOURCE_DIR}/third_party/nccl/nccl)

# we build nccl statically, but want to link it into the caffe shared library
# this requires position-independent code
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def run(self):
if USE_ROCM:
CAFFE2_LIBS.extend(['-Wl,--no-as-needed', os.path.join(lib_path, 'libcaffe2_hip.so'), '-Wl,--as-needed'])
THD_LIB = os.path.join(lib_path, 'libTHD.a')
NCCL_LIB = os.path.join(lib_path, 'libnccl.so.1')
NCCL_LIB = os.path.join(lib_path, 'libnccl.so.2')
C10D_LIB = os.path.join(lib_path, 'libc10d.a')

# static library only
Expand All @@ -863,7 +863,7 @@ def run(self):
CAFFE2_LIBS.append(os.path.join(lib_path, 'libcaffe2_gpu.dylib'))
if USE_ROCM:
CAFFE2_LIBS.append(os.path.join(lib_path, 'libcaffe2_hip.dylib'))
NCCL_LIB = os.path.join(lib_path, 'libnccl.1.dylib')
NCCL_LIB = os.path.join(lib_path, 'libnccl.2.dylib')

if IS_WINDOWS:
CAFFE2_LIBS = [os.path.join(lib_path, 'caffe2.lib')]
Expand Down
2 changes: 0 additions & 2 deletions third_party/nccl/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion third_party/nccl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ string(REPLACE "-gencode;" "-gencode=" NVCC_GENCODE "${NVCC_GENCODE}")
message(STATUS "Set NVCC_GENCODE for building NCCL: ${NVCC_GENCODE}")

ADD_CUSTOM_COMMAND(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/nccl
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib/libnccl.so
COMMAND env CUDA_HOME=${CUDA_TOOLKIT_ROOT_DIR} NVCC=${CUDA_NVCC_EXECUTABLE} BUILDDIR=${CMAKE_CURRENT_BINARY_DIR} NVCC_GENCODE="${NVCC_GENCODE}" make -j${NUM_JOBS}
)
Expand Down
31 changes: 0 additions & 31 deletions third_party/nccl/LICENSE.txt

This file was deleted.

260 changes: 0 additions & 260 deletions third_party/nccl/Makefile

This file was deleted.

Loading

0 comments on commit ae7a7fb

Please sign in to comment.