| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + # Find the NCCL libraries | ||
| 2 | + # | ||
| 3 | + # The following variables are optionally searched for defaults | ||
| 4 | + # NCCL_ROOT_DIR: Base directory where all NCCL components are found | ||
| 5 | + # | ||
| 6 | + # The following are set after configuration is done: | ||
| 7 | + # NCCL_FOUND | ||
| 8 | + # NCCL_INCLUDE_DIR | ||
| 9 | + # NCCL_LIBRARY | ||
| 10 | + | ||
| 11 | + find_path(NCCL_INCLUDE_DIR NAMES nccl.h | ||
| 12 | + PATHS ${NCCL_ROOT_DIR}/include | ||
| 13 | + ) | ||
| 14 | + | ||
| 15 | + find_library(NCCL_LIBRARY NAMES nccl | ||
| 16 | + PATHS ${NCCL_ROOT_DIR}/lib ${NCCL_ROOT_DIR}/lib64) | ||
| 17 | + | ||
| 18 | + include(FindPackageHandleStandardArgs) | ||
| 19 | + find_package_handle_standard_args(NCCL DEFAULT_MSG NCCL_INCLUDE_DIR NCCL_LIBRARY) | ||
| 20 | + | ||
| 21 | + if(NCCL_FOUND) | ||
| 22 | + message(STATUS "Found NCCL (include: ${NCCL_INCLUDE_DIR}, library: ${NCCL_LIBRARY})") | ||
| 23 | + mark_as_advanced(NCCL_INCLUDE_DIR NCCL_LIBRARY) | ||
| 24 | + endif() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ | |||
| 4 | 4 | # CLBLAS_FOUND - system has clBLAS | |
| 5 | 5 | # CLBLAS_INCLUDE_DIRS - location of clBLAS.h | |
| 6 | 6 | # CLBLAS_LIBRARIES - location of libclBLAS | |
| 7 | - # | ||
| 8 | 7 | ||
| 9 | 8 | IF(CLBLAS_INCLUDE_DIRS) | |
| 10 | 9 | # Already in cache, be silent | |
@@ -13,7 +12,7 @@ ENDIF (CLBLAS_INCLUDE_DIRS) | |||
| 13 | 12 | ||
| 14 | 13 | FIND_PATH(CLBLAS_ROOT_DIR | |
| 15 | 14 | NAMES include/clBLAS.h | |
| 16 | - HINTS /usr/local/ $ENV{CLBLAS_ROOT} | ||
| 15 | + HINTS /usr/local/ $ENV{CLBLAS_ROOT} | ||
| 17 | 16 | DOC "clBLAS root directory.") | |
| 18 | 17 | ||
| 19 | 18 | FIND_PATH(_CLBLAS_INCLUDE_DIRS | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") | |||
| 4 | 4 | ||
| 5 | 5 | find_package(CUDA) | |
| 6 | 6 | find_package(OpenCL) | |
| 7 | + find_package(NCCL) | ||
| 7 | 8 | ||
| 8 | 9 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}") | |
| 9 | 10 | ||
@@ -40,8 +41,10 @@ gpuarray_error.c | |||
| 40 | 41 | gpuarray_util.c | |
| 41 | 42 | gpuarray_buffer.c | |
| 42 | 43 | gpuarray_buffer_blas.c | |
| 44 | + gpuarray_buffer_collectives.c | ||
| 43 | 45 | gpuarray_array.c | |
| 44 | 46 | gpuarray_array_blas.c | |
| 47 | + gpuarray_array_collectives.c | ||
| 45 | 48 | gpuarray_kernel.c | |
| 46 | 49 | gpuarray_extension.c | |
| 47 | 50 | gpuarray_elemwise.c | |
@@ -102,6 +105,14 @@ if (CUDA_FOUND) | |||
| 102 | 105 | if (CUBLAS_SGEMMEX) | |
| 103 | 106 | add_definitions(-DHAVE_CUBLAS_SGEMMEX) | |
| 104 | 107 | endif() | |
| 108 | + | ||
| 109 | + if (NCCL_FOUND) | ||
| 110 | + message("Building with NCCL") | ||
| 111 | + add_definitions(-DWITH_CUDA_NCCL) | ||
| 112 | + set(GPUARRAY_SRC ${GPUARRAY_SRC} gpuarray_collectives_cuda_nccl.c) | ||
| 113 | + include_directories("${NCCL_INCLUDE_DIR}") | ||
| 114 | + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${NCCL_LIBRARY}) | ||
| 115 | + endif() | ||
| 105 | 116 | endif() | |
| 106 | 117 | ||
| 107 | 118 | if(OPENCL_FOUND) | |
@@ -136,7 +147,11 @@ add_library(gpuarray-static STATIC ${GPUARRAY_SRC}) | |||
| 136 | 147 | ||
| 137 | 148 | if(CUDA_FOUND) | |
| 138 | 149 | target_link_libraries(gpuarray ${CUDADRV_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) | |
| 139 | - target_link_libraries(gpuarray-static ${CUDADRV_LIBRARY} ${CUDA_CUBLAS_LIBRARY}) | ||
| 150 | + target_link_libraries(gpuarray-static ${CUDADRV_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) | ||
| 151 | + if (NCCL_FOUND) | ||
| 152 | + target_link_libraries(gpuarray ${NCCL_LIBRARY}) | ||
| 153 | + target_link_libraries(gpuarray-static ${NCCL_LIBRARY}) | ||
| 154 | + endif() | ||
| 140 | 155 | endif() | |
| 141 | 156 | ||
| 142 | 157 | if(OPENCL_FOUND) | |
@@ -151,8 +166,10 @@ endif() | |||
| 151 | 166 | SET(headers | |
| 152 | 167 | gpuarray/array.h | |
| 153 | 168 | gpuarray/blas.h | |
| 169 | + gpuarray/collectives.h | ||
| 154 | 170 | gpuarray/buffer.h | |
| 155 | 171 | gpuarray/buffer_blas.h | |
| 172 | + gpuarray_buffer_collectives.c | ||
| 156 | 173 | gpuarray/config.h | |
| 157 | 174 | gpuarray/elemwise.h | |
| 158 | 175 | gpuarray/error.h | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1161,7 +1161,8 @@ static int cl_property(gpucontext *c, gpudata *buf, gpukernel *k, int prop_id, | |||
| 1161 | 1161 | #endif | |
| 1162 | 1162 | ||
| 1163 | 1163 | case GA_CTX_PROP_COMM_OPS: | |
| 1164 | - // Complete in the future if a multi-gpu collectives API for opencl appears | ||
| 1164 | + // TODO Complete in the future whenif a multi-gpu collectives API for | ||
| 1165 | + // opencl appears | ||
| 1165 | 1166 | *((void **)res) = NULL; | |
| 1166 | 1167 | return GA_DEVSUP_ERROR; | |
| 1167 | 1168 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments