Unverified Commit 9664cdff authored by Jinjing Zhou's avatar Jinjing Zhou Committed by GitHub
Browse files

[Build] Make nccl optional (#3056)

* fix

* remove nvidiasmi

* fix

* fix docs

* fix

* fix

* 1

* fix

* remove

* skip deprecated kernel

* fix

* Revert "skip deprecated kernel"

This reverts commit c5ceb7f60dbbaf065b81cc3680757fd611d90ad3.

* fix
parent 115ac0b9
...@@ -23,6 +23,7 @@ endif() ...@@ -23,6 +23,7 @@ endif()
# and add set(OPTION VALUE) to override these build options. # and add set(OPTION VALUE) to override these build options.
# Alernatively, use cmake -DOPTION=VALUE through command-line. # Alernatively, use cmake -DOPTION=VALUE through command-line.
dgl_option(USE_CUDA "Build with CUDA" OFF) dgl_option(USE_CUDA "Build with CUDA" OFF)
dgl_option(USE_NCCL "Build with NCCL support" OFF)
dgl_option(USE_SYSTEM_NCCL "Build using system's NCCL library" OFF) dgl_option(USE_SYSTEM_NCCL "Build using system's NCCL library" OFF)
dgl_option(USE_OPENMP "Build with OpenMP" ON) dgl_option(USE_OPENMP "Build with OpenMP" ON)
dgl_option(USE_AVX "Build with AVX optimization" ON) dgl_option(USE_AVX "Build with AVX optimization" ON)
...@@ -159,21 +160,23 @@ list(APPEND DGL_SRC ${DGL_SRC_1}) ...@@ -159,21 +160,23 @@ list(APPEND DGL_SRC ${DGL_SRC_1})
if(USE_CUDA) if(USE_CUDA)
dgl_config_cuda(DGL_CUDA_SRC) dgl_config_cuda(DGL_CUDA_SRC)
list(APPEND DGL_SRC ${DGL_CUDA_SRC}) list(APPEND DGL_SRC ${DGL_CUDA_SRC})
if(USE_NCCL)
if (USE_SYSTEM_NCCL) add_definitions(-DDGL_USE_NCCL)
include(cmake/util/FindNccl.cmake) if (USE_SYSTEM_NCCL)
include_directories(${NCCL_INCLUDE_DIR}) include(cmake/util/FindNccl.cmake)
else() include_directories(${NCCL_INCLUDE_DIR})
include(cmake/modules/NCCL.cmake) else()
cuda_include_directories(BEFORE ${NCCL_INCLUDE_DIR}) include(cmake/modules/NCCL.cmake)
endif() cuda_include_directories(BEFORE ${NCCL_INCLUDE_DIR})
endif()
endif(USE_NCCL)
list(APPEND DGL_LINKER_LIBS ${NCCL_LIBRARY}) list(APPEND DGL_LINKER_LIBS ${NCCL_LIBRARY})
endif(USE_CUDA) endif(USE_CUDA)
if(USE_CUDA) if(USE_CUDA)
cuda_add_library(dgl SHARED ${DGL_SRC}) cuda_add_library(dgl SHARED ${DGL_SRC})
if (NOT USE_SYSTEM_NCCL) if (USE_NCCL AND NOT USE_SYSTEM_NCCL)
add_dependencies(dgl nccl_external) add_dependencies(dgl nccl_external)
endif() endif()
else(USE_CUDA) else(USE_CUDA)
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* \brief Implementation of wrapper around NCCL routines. * \brief Implementation of wrapper around NCCL routines.
*/ */
#ifdef DGL_USE_NCCL
#include "nccl_api.h" #include "nccl_api.h"
...@@ -782,5 +783,5 @@ DGL_REGISTER_GLOBAL("cuda.nccl._CAPI_DGLNCCLSparseAllToAllPull") ...@@ -782,5 +783,5 @@ DGL_REGISTER_GLOBAL("cuda.nccl._CAPI_DGLNCCLSparseAllToAllPull")
} // namespace runtime } // namespace runtime
} // namespace dgl } // namespace dgl
#endif
...@@ -14,7 +14,7 @@ CMAKE_VARS="-DBUILD_CPP_TEST=ON -DUSE_OPENMP=ON -DBUILD_TORCH=ON" ...@@ -14,7 +14,7 @@ CMAKE_VARS="-DBUILD_CPP_TEST=ON -DUSE_OPENMP=ON -DBUILD_TORCH=ON"
CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python" CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
if [ "$1" == "gpu" ]; then if [ "$1" == "gpu" ]; then
CMAKE_VARS="-DUSE_CUDA=ON $CMAKE_VARS" CMAKE_VARS="-DUSE_CUDA=ON -DUSE_NCCL=ON $CMAKE_VARS"
fi fi
if [ -d build ]; then if [ -d build ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment