Enable building with shared NCCL. (#4447)
* Add `BUILD_WITH_SHARED_NCCL` to CMake.
This commit is contained in:
@@ -32,8 +32,18 @@
|
||||
#
|
||||
# This module assumes that the user has already called find_package(CUDA)
|
||||
|
||||
if (NCCL_LIBRARY)
|
||||
# Don't cache NCCL_LIBRARY to enable switching between static and shared.
|
||||
unset(NCCL_LIBRARY CACHE)
|
||||
endif()
|
||||
|
||||
set(NCCL_LIB_NAME nccl_static)
|
||||
if (BUILD_WITH_SHARED_NCCL)
|
||||
# libnccl.so
|
||||
set(NCCL_LIB_NAME nccl)
|
||||
else ()
|
||||
# libnccl_static.a
|
||||
set(NCCL_LIB_NAME nccl_static)
|
||||
endif (BUILD_WITH_SHARED_NCCL)
|
||||
|
||||
find_path(NCCL_INCLUDE_DIR
|
||||
NAMES nccl.h
|
||||
@@ -43,6 +53,8 @@ find_library(NCCL_LIBRARY
|
||||
NAMES ${NCCL_LIB_NAME}
|
||||
PATHS $ENV{NCCL_ROOT}/lib/ ${NCCL_ROOT}/lib)
|
||||
|
||||
message(STATUS "Using nccl library: ${NCCL_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Nccl DEFAULT_MSG
|
||||
NCCL_INCLUDE_DIR NCCL_LIBRARY)
|
||||
|
||||
Reference in New Issue
Block a user