nccl.cmake 923 字节
Newer Older
Y
Yu Yang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
if (NOT WITH_GPU)
  return ()
endif()

set(NCCL_ROOT "/usr" CACHE PATH "CUDNN ROOT")
find_path(NCCL_INCLUDE_DIR nccl.h PATHS
        ${NCCL_ROOT} ${NCCL_ROOT}/include
        $ENV{NCCL_ROOT} $ENV{NCCL_ROOT}/include ${CUDA_TOOLKIT_INCLUDE}
        NO_DEFAULT_PATH)

get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)

set(TARGET_ARCH "x86_64")
if(NOT ${CMAKE_SYSTEM_PROCESSOR})
  set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()

list(APPEND NCCL_CHECK_LIBRARY_DIRS
        ${NCCL_ROOT}
        ${NCCL_ROOT}/lib64
        ${NCCL_ROOT}/lib
        ${NCCL_ROOT}/lib/${TARGET_ARCH}-linux-gnu
        $ENV{NCCL_ROOT}
        $ENV{NCCL_ROOT}/lib64
        $ENV{NCCL_ROOT}/lib
        /usr/lib)
find_library(NCCL_LIBRARY NAMES libnccl.so libnccl.dylib # libcudnn_static.a
        PATHS ${NCCL_CHECK_LIBRARY_DIRS} ${NCCL_INCLUDE_DIR} ${__libpath_hist}
        NO_DEFAULT_PATH
        DOC "Path to nccl library.")