2020-01-15 17:54:27 -07:00
|
|
|
# Copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
|
2022-12-13 07:51:04 +08:00
|
|
|
# Modifications Copyright (c) Microsoft Corporation. Licensed under the MIT License.
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2020-08-06 11:19:43 -06:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2022-05-20 09:56:38 -06:00
|
|
|
INCLUDE(CheckIncludeFiles)
|
|
|
|
|
INCLUDE(CheckSymbolExists)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2019-11-15 10:39:48 -08:00
|
|
|
# We use C++14 features, this will add compile option: -std=c++14
|
|
|
|
|
set( CMAKE_CXX_STANDARD 14 )
|
|
|
|
|
# Without this line, it will add -std=gnu++14 instead, which has some issues.
|
|
|
|
|
set( CMAKE_CXX_EXTENSIONS OFF )
|
|
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
project(rccl CXX)
|
|
|
|
|
|
2021-04-14 08:29:00 -07:00
|
|
|
include(cmake/Dependencies.cmake)
|
|
|
|
|
|
2020-12-04 13:55:56 -08:00
|
|
|
# Detect compiler support for target ID
|
2021-04-14 08:29:00 -07:00
|
|
|
# This section is deprecated. Please use rocm_check_target_ids for future use.
|
2020-12-04 13:55:56 -08:00
|
|
|
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
|
2021-04-14 08:29:00 -07:00
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "--help"
|
|
|
|
|
OUTPUT_VARIABLE CXX_OUTPUT
|
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
|
ERROR_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
string(REGEX MATCH ".mcode\-object\-version" TARGET_ID_SUPPORT ${CXX_OUTPUT})
|
2020-12-04 13:55:56 -08:00
|
|
|
endif()
|
|
|
|
|
|
2021-06-22 13:29:08 -07:00
|
|
|
if(NOT DEFINED ROCM_PATH)
|
|
|
|
|
get_filename_component(_real_path ${CMAKE_CXX_COMPILER} REALPATH)
|
|
|
|
|
get_filename_component(_new_path "${_real_path}" DIRECTORY)
|
|
|
|
|
get_filename_component(ROCM_PATH "${_new_path}/../.." REALPATH)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(CMAKE_INSTALL_PREFIX "${ROCM_PATH}" CACHE PATH "")
|
|
|
|
|
|
2021-04-14 08:29:00 -07:00
|
|
|
#Set the AMDGPU_TARGETS with backward compatiblity
|
|
|
|
|
if(COMMAND rocm_check_target_ids)
|
|
|
|
|
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
|
2022-09-29 14:53:55 -06:00
|
|
|
TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx1030;gfx1100;gfx1101;gfx1102"
|
2021-04-14 08:29:00 -07:00
|
|
|
)
|
2020-12-04 13:55:56 -08:00
|
|
|
else()
|
2021-04-14 08:29:00 -07:00
|
|
|
# Use target ID syntax if supported for AMDGPU_TARGETS
|
|
|
|
|
if(TARGET_ID_SUPPORT)
|
2022-09-29 14:53:55 -06:00
|
|
|
set(DEFAULT_AMDGPU_TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx1030;gfx1100;gfx1101;gfx1102")
|
2021-04-14 08:29:00 -07:00
|
|
|
else()
|
|
|
|
|
set(DEFAULT_AMDGPU_TARGETS "gfx803;gfx900;gfx906;gfx908")
|
|
|
|
|
endif()
|
2020-12-04 13:55:56 -08:00
|
|
|
endif()
|
2021-04-14 08:29:00 -07:00
|
|
|
set(AMDGPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "List of specific machine types for library to target")
|
2019-10-22 17:10:07 -04:00
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
option(BUILD_TESTS "Build test programs" OFF)
|
2020-09-10 17:27:22 -06:00
|
|
|
option(INSTALL_DEPENDENCIES "Force install dependencies" OFF)
|
2021-06-10 09:14:54 -06:00
|
|
|
option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF)
|
2021-10-26 16:36:46 -07:00
|
|
|
option(BUILD_ALLREDUCE_ONLY "Build AllReduce + sum + float kernel only" OFF)
|
2022-03-18 13:55:11 -04:00
|
|
|
#Set the header wrapper ON by default.
|
2022-03-08 17:32:02 +00:00
|
|
|
option(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY "Build with file/folder reorg with backward compatibility enabled" ON)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
# parse version from Makefile NCCL_MAJOR, NCCL_MINOR, NCCL_PATCH must exist
|
|
|
|
|
# NCCL_SUFFIX is optional NCCL_VERSION formatting is ((X) * 1000 + (Y) * 100 +
|
|
|
|
|
# (Z)) so we must first detect one or two digits first
|
|
|
|
|
file(READ makefiles/version.mk version_mk_text)
|
|
|
|
|
if("${version_mk_text}" MATCHES "NCCL_MAJOR *:= *([0-9]*)")
|
|
|
|
|
set(NCCL_MAJOR ${CMAKE_MATCH_1})
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Failed to parse NCCL_MAJOR")
|
|
|
|
|
endif()
|
|
|
|
|
if("${version_mk_text}" MATCHES "NCCL_MINOR *:= *([0-9]*)")
|
|
|
|
|
set(NCCL_MINOR ${CMAKE_MATCH_1})
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Failed to parse NCCL_MINOR")
|
|
|
|
|
endif()
|
|
|
|
|
if("${version_mk_text}" MATCHES "NCCL_PATCH *:= *([0-9]*)")
|
|
|
|
|
set(NCCL_PATCH ${CMAKE_MATCH_1})
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Failed to parse NCCL_PATCH")
|
|
|
|
|
endif()
|
|
|
|
|
if("${version_mk_text}" MATCHES "NCCL_SUFFIX *:= *([0-9]*)")
|
|
|
|
|
set(NCCL_SUFFIX ${CMAKE_MATCH_1})
|
|
|
|
|
else()
|
|
|
|
|
set(NCCL_SUFFIX)
|
|
|
|
|
endif()
|
|
|
|
|
if("${version_mk_text}" MATCHES "PKG_REVISION *:= *([0-9]*)")
|
|
|
|
|
set(PKG_REVISION ${CMAKE_MATCH_1})
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Failed to parse PKG_REVISION")
|
|
|
|
|
endif()
|
|
|
|
|
if("${NCCL_PATCH}" MATCHES "[0-9][0-9]")
|
|
|
|
|
set(NCCL_VERSION "${NCCL_MAJOR}${NCCL_MINOR}${NCCL_PATCH}")
|
|
|
|
|
else()
|
|
|
|
|
set(NCCL_VERSION "${NCCL_MAJOR}${NCCL_MINOR}0${NCCL_PATCH}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Setup VERSION
|
2020-07-20 14:43:00 -07:00
|
|
|
set(VERSION_STRING "${NCCL_MAJOR}.${NCCL_MINOR}.${NCCL_PATCH}")
|
|
|
|
|
rocm_setup_version(VERSION ${VERSION_STRING})
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH
|
2021-06-21 08:29:23 -07:00
|
|
|
${ROCM_PATH}
|
|
|
|
|
${ROCM_PATH}/hip
|
|
|
|
|
${ROCM_PATH}/llvm
|
|
|
|
|
${ROCM_PATH}/hcc)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
find_package(hip REQUIRED)
|
|
|
|
|
message(STATUS "HIP compiler: ${HIP_COMPILER}")
|
|
|
|
|
message(STATUS "HIP runtime: ${HIP_RUNTIME}")
|
|
|
|
|
|
2022-11-30 08:53:03 -08:00
|
|
|
find_package(hsa-runtime64 REQUIRED)
|
|
|
|
|
get_target_property(HSA_INCLUDE_PATH hsa-runtime64::hsa-runtime64 INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
|
|
message(STATUS "HSA runtime: ${HSA_INCLUDE_PATH}")
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${HSA_INCLUDE_PATH})
|
|
|
|
|
check_symbol_exists("HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED" "hsa.h" HAS_HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED)
|
|
|
|
|
if(${HAS_HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED})
|
|
|
|
|
add_definitions(-DQUERY_HSA_DMABUF)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-08-06 11:19:43 -06:00
|
|
|
if(BUILD_STATIC)
|
|
|
|
|
option(BUILD_SHARED_LIBS "Build as a shared library" OFF)
|
|
|
|
|
else()
|
|
|
|
|
option(BUILD_SHARED_LIBS "Build as a shared library" ON)
|
|
|
|
|
endif()
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2021-06-11 14:43:54 -06:00
|
|
|
if(BUILD_ADDRESS_SANITIZER)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -shared-libasan")
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -shared-libasan")
|
|
|
|
|
add_link_options(-fuse-ld=lld)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-03-10 01:28:41 +00:00
|
|
|
configure_file(src/nccl.h.in ${PROJECT_BINARY_DIR}/include/rccl/rccl.h)
|
|
|
|
|
configure_file(src/nccl.h.in ${PROJECT_BINARY_DIR}/include/rccl/nccl.h)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2022-03-10 01:28:41 +00:00
|
|
|
include_directories(${PROJECT_BINARY_DIR}/include) # for generated rccl.h header
|
|
|
|
|
include_directories(${PROJECT_BINARY_DIR}/include/rccl) # for generated rccl.h header
|
2022-11-07 14:09:26 -08:00
|
|
|
include_directories(${PROJECT_BINARY_DIR}/src/include) # for hipified header files
|
2019-07-05 15:43:00 -07:00
|
|
|
include_directories(src)
|
|
|
|
|
include_directories(src/collectives)
|
|
|
|
|
include_directories(src/collectives/device)
|
|
|
|
|
|
2021-11-02 08:39:08 -07:00
|
|
|
if (BUILD_ALLREDUCE_ONLY)
|
|
|
|
|
add_definitions(-DBUILD_ALLREDUCE_ONLY)
|
|
|
|
|
set(CU_SOURCES
|
|
|
|
|
src/collectives/device/all_reduce.cu
|
|
|
|
|
src/collectives/device/sendrecv.cu
|
2022-12-13 07:51:04 +08:00
|
|
|
src/collectives/device/functions.cu
|
|
|
|
|
src/collectives/device/msccl_kernel.cu)
|
2021-11-02 08:39:08 -07:00
|
|
|
else()
|
|
|
|
|
set(CU_SOURCES
|
|
|
|
|
src/collectives/device/all_reduce.cu
|
|
|
|
|
src/collectives/device/all_gather.cu
|
2022-02-21 13:09:47 +08:00
|
|
|
src/collectives/device/alltoall_pivot.cu
|
2021-11-02 08:39:08 -07:00
|
|
|
src/collectives/device/reduce.cu
|
|
|
|
|
src/collectives/device/broadcast.cu
|
|
|
|
|
src/collectives/device/reduce_scatter.cu
|
|
|
|
|
src/collectives/device/sendrecv.cu
|
2021-11-11 14:21:51 -08:00
|
|
|
src/collectives/device/onerank_reduce.cu
|
2022-12-13 07:51:04 +08:00
|
|
|
src/collectives/device/functions.cu
|
|
|
|
|
src/collectives/device/msccl_kernel.cu)
|
2021-11-02 08:39:08 -07:00
|
|
|
endif()
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
set(CPP_SOURCES)
|
|
|
|
|
foreach(filename ${CU_SOURCES})
|
|
|
|
|
string(REPLACE ".cu"
|
|
|
|
|
".cpp"
|
|
|
|
|
cpp_filename
|
|
|
|
|
${filename})
|
|
|
|
|
configure_file(${filename} ${cpp_filename} COPYONLY)
|
|
|
|
|
list(APPEND CPP_SOURCES ${cpp_filename})
|
|
|
|
|
endforeach(filename)
|
|
|
|
|
|
2022-11-07 14:09:26 -08:00
|
|
|
set(HEADER_SOURCES
|
|
|
|
|
src/include/collectives.h
|
|
|
|
|
src/include/align.h
|
|
|
|
|
src/include/profiler.h
|
|
|
|
|
src/include/alloc.h
|
|
|
|
|
src/include/ibvwrap.h
|
|
|
|
|
src/include/gdrwrap.h
|
|
|
|
|
src/include/utils.h
|
|
|
|
|
src/include/strongstream.h
|
|
|
|
|
src/include/comm.h
|
|
|
|
|
src/include/trees.h
|
|
|
|
|
src/include/rccl_vars.h
|
|
|
|
|
src/include/checks.h
|
|
|
|
|
src/include/p2p.h
|
|
|
|
|
src/include/timer.h
|
|
|
|
|
src/include/coll_net.h
|
|
|
|
|
src/include/signals.h
|
|
|
|
|
src/include/proxy.h
|
|
|
|
|
src/include/net.h
|
|
|
|
|
src/include/devcomm.h
|
|
|
|
|
src/include/enqueue.h
|
|
|
|
|
src/include/debug.h
|
|
|
|
|
src/include/argcheck.h
|
|
|
|
|
src/include/rocm_smi_wrap.h
|
|
|
|
|
src/include/bootstrap.h
|
|
|
|
|
src/include/BfdBacktrace.hpp
|
|
|
|
|
src/include/nccl_net.h
|
|
|
|
|
src/include/cudawrap.h
|
|
|
|
|
src/include/rccl_bfloat16.h
|
|
|
|
|
src/include/shm.h
|
|
|
|
|
src/include/transport.h
|
|
|
|
|
src/include/group.h
|
|
|
|
|
src/include/socket.h
|
|
|
|
|
src/include/cpuset.h
|
|
|
|
|
src/include/rocmwrap.h
|
|
|
|
|
src/include/graph.h
|
|
|
|
|
src/include/nvmlwrap.h
|
|
|
|
|
src/include/param.h
|
|
|
|
|
src/include/channel.h
|
|
|
|
|
src/include/nvtx_stub.h
|
|
|
|
|
src/include/core.h
|
|
|
|
|
src/include/info.h
|
|
|
|
|
src/include/git_version.h
|
|
|
|
|
src/include/npkit/npkit_event.h
|
|
|
|
|
src/include/npkit/npkit.h
|
|
|
|
|
src/include/npkit/npkit_struct.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImplCudaRt_v3.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxTypes.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImpl.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImplSync_v3.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxInitDecls.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxLinkOnce.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImplCore.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxInitDefs.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImplCuda_v3.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxInit.h
|
|
|
|
|
src/include/nvtx3/nvtxDetail/nvtxImplOpenCL_v3.h
|
|
|
|
|
src/include/nvtx3/nvToolsExtSync.h
|
|
|
|
|
src/include/nvtx3/nvToolsExtCudaRt.h
|
|
|
|
|
src/include/nvtx3/nvToolsExtCuda.h
|
|
|
|
|
src/include/nvtx3/nvToolsExtOpenCL.h
|
2022-12-13 07:51:04 +08:00
|
|
|
src/include/msccl/msccl_kernel.h
|
|
|
|
|
src/include/msccl/msccl_lifecycle.h
|
|
|
|
|
src/include/msccl/msccl_parser.h
|
|
|
|
|
src/include/msccl/msccl_setup.h
|
|
|
|
|
src/include/msccl/msccl_status.h
|
|
|
|
|
src/include/msccl/msccl_struct.h
|
2022-11-07 14:09:26 -08:00
|
|
|
src/graph/rings.h
|
|
|
|
|
src/graph/rome_models.h
|
|
|
|
|
src/graph/topo.h
|
|
|
|
|
src/graph/xml.h)
|
|
|
|
|
foreach(filename ${HEADER_SOURCES})
|
|
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/${filename} ${filename} COPYONLY)
|
|
|
|
|
endforeach(filename)
|
|
|
|
|
|
|
|
|
|
set(API_SOURCES
|
|
|
|
|
src/collectives/all_reduce.cc
|
|
|
|
|
src/collectives/all_gather.cc
|
|
|
|
|
src/collectives/all_to_all.cc
|
|
|
|
|
src/collectives/all_to_allv.cc
|
|
|
|
|
src/collectives/reduce.cc
|
|
|
|
|
src/collectives/broadcast.cc
|
|
|
|
|
src/collectives/reduce_scatter.cc
|
|
|
|
|
src/collectives/scatter.cc
|
|
|
|
|
src/collectives/gather.cc
|
|
|
|
|
src/collectives/sendrecv.cc
|
2022-12-13 07:51:04 +08:00
|
|
|
src/collectives/msccl.cc
|
2022-11-07 14:09:26 -08:00
|
|
|
src/net.cc)
|
|
|
|
|
foreach(filename ${API_SOURCES})
|
|
|
|
|
string(REPLACE ".cc"
|
|
|
|
|
"_api.cpp"
|
|
|
|
|
cpp_filename
|
|
|
|
|
${filename})
|
|
|
|
|
configure_file(${filename} ${cpp_filename} COPYONLY)
|
|
|
|
|
list(APPEND CPP_SOURCES ${cpp_filename})
|
|
|
|
|
endforeach(filename)
|
|
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
set(CC_SOURCES
|
|
|
|
|
src/init.cc
|
2019-11-21 13:41:10 -08:00
|
|
|
src/graph/trees.cc
|
|
|
|
|
src/graph/rings.cc
|
|
|
|
|
src/graph/paths.cc
|
|
|
|
|
src/graph/search.cc
|
|
|
|
|
src/graph/connect.cc
|
|
|
|
|
src/graph/tuning.cc
|
|
|
|
|
src/graph/topo.cc
|
2020-04-01 13:21:38 -07:00
|
|
|
src/graph/xml.cc
|
2021-03-31 10:25:59 -07:00
|
|
|
src/graph/rome_models.cc
|
2019-07-05 15:43:00 -07:00
|
|
|
src/channel.cc
|
|
|
|
|
src/misc/argcheck.cc
|
2019-11-21 13:41:10 -08:00
|
|
|
src/misc/nvmlwrap_stub.cc
|
2019-07-05 15:43:00 -07:00
|
|
|
src/misc/utils.cc
|
|
|
|
|
src/misc/ibvwrap.cc
|
|
|
|
|
src/misc/nvmlwrap_stub.cc
|
2021-07-08 13:23:11 -07:00
|
|
|
src/misc/rocm_smi_wrap.cc
|
2022-04-18 11:14:51 -07:00
|
|
|
src/misc/profiler.cc
|
2022-06-21 05:30:19 +08:00
|
|
|
src/misc/npkit.cc
|
2022-04-18 11:14:51 -07:00
|
|
|
src/misc/shmutils.cc
|
2022-05-20 09:56:38 -06:00
|
|
|
src/misc/signals.cc # RCCL
|
2022-04-18 11:14:51 -07:00
|
|
|
src/misc/socket.cc
|
|
|
|
|
src/misc/param.cc
|
2022-09-09 01:20:52 +00:00
|
|
|
src/misc/rocmwrap.cc
|
|
|
|
|
src/misc/strongstream.cc
|
2022-12-13 07:51:04 +08:00
|
|
|
src/misc/msccl/msccl_lifecycle.cc
|
|
|
|
|
src/misc/msccl/msccl_parser.cc
|
|
|
|
|
src/misc/msccl/msccl_setup.cc
|
|
|
|
|
src/misc/msccl/msccl_status.cc
|
2020-04-01 13:21:38 -07:00
|
|
|
src/transport/coll_net.cc
|
2019-07-05 15:43:00 -07:00
|
|
|
src/transport/net.cc
|
|
|
|
|
src/transport/net_ib.cc
|
|
|
|
|
src/transport/net_socket.cc
|
|
|
|
|
src/transport/p2p.cc
|
|
|
|
|
src/transport/shm.cc
|
|
|
|
|
src/transport.cc
|
2019-11-21 13:41:10 -08:00
|
|
|
src/debug.cc
|
|
|
|
|
src/group.cc
|
2019-07-05 15:43:00 -07:00
|
|
|
src/bootstrap.cc
|
2020-06-08 20:45:19 -07:00
|
|
|
src/proxy.cc
|
2022-11-07 14:09:26 -08:00
|
|
|
src/enqueue.cc)
|
2019-07-05 15:43:00 -07:00
|
|
|
foreach(filename ${CC_SOURCES})
|
2022-11-07 14:09:26 -08:00
|
|
|
string(REPLACE ".cc"
|
|
|
|
|
".cpp"
|
|
|
|
|
cpp_filename
|
|
|
|
|
${filename})
|
|
|
|
|
configure_file(${filename} ${cpp_filename} COPYONLY)
|
|
|
|
|
list(APPEND CPP_SOURCES ${cpp_filename})
|
2019-07-05 15:43:00 -07:00
|
|
|
endforeach(filename)
|
|
|
|
|
|
2022-11-07 14:09:26 -08:00
|
|
|
list(APPEND CPP_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/git_version.cpp)
|
2019-07-05 15:43:00 -07:00
|
|
|
add_library(rccl ${CPP_SOURCES})
|
|
|
|
|
|
2022-11-07 14:09:26 -08:00
|
|
|
message ("-- Hipifying source")
|
|
|
|
|
set(HIPIFY_SOURCES
|
|
|
|
|
src/collectives/all_gather_api.cpp
|
|
|
|
|
src/collectives/all_reduce_api.cpp
|
|
|
|
|
src/collectives/all_to_all_api.cpp
|
|
|
|
|
src/collectives/all_to_allv_api.cpp
|
|
|
|
|
src/collectives/broadcast_api.cpp
|
|
|
|
|
src/collectives/gather_api.cpp
|
|
|
|
|
src/collectives/reduce_api.cpp
|
|
|
|
|
src/collectives/reduce_scatter_api.cpp
|
|
|
|
|
src/collectives/scatter_api.cpp
|
|
|
|
|
src/collectives/sendrecv_api.cpp
|
2022-12-13 07:51:04 +08:00
|
|
|
src/collectives/msccl_api.cpp
|
2022-11-07 14:09:26 -08:00
|
|
|
src/debug.cpp
|
|
|
|
|
src/enqueue.cpp
|
|
|
|
|
src/graph/xml.cpp
|
|
|
|
|
src/group.cpp
|
|
|
|
|
src/include/alloc.h
|
|
|
|
|
src/include/checks.h
|
|
|
|
|
src/include/info.h
|
|
|
|
|
src/include/proxy.h
|
|
|
|
|
src/include/strongstream.h
|
|
|
|
|
src/init.cpp
|
|
|
|
|
src/misc/argcheck.cpp
|
|
|
|
|
src/misc/shmutils.cpp
|
|
|
|
|
src/misc/strongstream.cpp
|
|
|
|
|
src/misc/utils.cpp
|
|
|
|
|
src/net_api.cpp
|
|
|
|
|
src/proxy.cpp
|
|
|
|
|
src/transport.cpp
|
|
|
|
|
src/transport/coll_net.cpp
|
|
|
|
|
src/transport/net.cpp
|
|
|
|
|
src/transport/net_socket.cpp
|
|
|
|
|
src/transport/p2p.cpp
|
|
|
|
|
src/transport/shm.cpp)
|
|
|
|
|
find_program( hipify-perl_executable hipify-perl )
|
|
|
|
|
foreach(filename ${HIPIFY_SOURCES})
|
|
|
|
|
message (" ${filename}")
|
|
|
|
|
execute_process(COMMAND bash "-c" "${hipify-perl_executable} -inplace -quiet-warnings ${PROJECT_BINARY_DIR}/${filename}" OUTPUT_VARIABLE HIPIFY_OUTPUT ERROR_VARIABLE HIPIFY_OUTPUT)
|
|
|
|
|
endforeach(filename)
|
|
|
|
|
message ("-- Hipifying source - done")
|
|
|
|
|
|
2022-08-04 18:03:59 -06:00
|
|
|
# Create a custom target that creates/updates git_version.cpp
|
|
|
|
|
# that executes whenever rccl is built
|
|
|
|
|
add_custom_target(git_version_check
|
|
|
|
|
COMMENT "Updating git_version.cpp if necessary"
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/git_version.cmake
|
|
|
|
|
VERBATIM
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Create a dummy git_version.cpp file in case it doesn't exist
|
|
|
|
|
configure_file(src/nccl.h.in ${CMAKE_CURRENT_BINARY_DIR}/git_version.cpp)
|
|
|
|
|
|
|
|
|
|
# Execute git_version_check whenever rccl library is built
|
|
|
|
|
add_dependencies(rccl git_version_check)
|
|
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
if(TRACE)
|
|
|
|
|
add_definitions(-DENABLE_TRACE)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(PROFILE)
|
|
|
|
|
add_definitions(-DENABLE_PROFILING)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-06-21 05:30:19 +08:00
|
|
|
if(NPKIT_FLAGS)
|
|
|
|
|
add_definitions(${NPKIT_FLAGS})
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-11-26 16:33:13 -08:00
|
|
|
set(COLLTRACE 1 CACHE BOOL "Collective Trace Option")
|
|
|
|
|
if(COLLTRACE)
|
|
|
|
|
add_definitions(-DENABLE_COLLTRACE)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-05-20 09:56:38 -06:00
|
|
|
enable_language(C)
|
|
|
|
|
CHECK_INCLUDE_FILES(bfd.h HAVE_BFD)
|
|
|
|
|
if (HAVE_BFD)
|
|
|
|
|
add_definitions(-DHAVE_BFD)
|
|
|
|
|
message ("-- Found BFD")
|
|
|
|
|
CHECK_SYMBOL_EXISTS(bfd_get_section_flags "bfd.h" HAVE_DECL_BFD_GET_SECTION_FLAGS)
|
|
|
|
|
if (HAVE_DECL_BFD_GET_SECTION_FLAGS)
|
|
|
|
|
add_definitions(-DHAVE_DECL_BFD_GET_SECTION_FLAGS)
|
|
|
|
|
endif()
|
|
|
|
|
CHECK_SYMBOL_EXISTS(bfd_get_section_vma "bfd.h" HAVE_DECL_BFD_GET_SECTION_VMA)
|
|
|
|
|
if (HAVE_DECL_BFD_GET_SECTION_VMA)
|
|
|
|
|
add_definitions(-DHAVE_DECL_BFD_GET_SECTION_VMA)
|
|
|
|
|
endif()
|
|
|
|
|
CHECK_CXX_SOURCE_COMPILES(
|
|
|
|
|
"#include <bfd.h>
|
|
|
|
|
|
|
|
|
|
int main (int argc, char **argv) {
|
|
|
|
|
bfd_size_type size;
|
|
|
|
|
bfd abfd;
|
|
|
|
|
asection sec;
|
|
|
|
|
size = bfd_section_size(&abfd, &sec);
|
|
|
|
|
return (int)(size);
|
|
|
|
|
}"
|
|
|
|
|
HAVE_TWO_ARG_BFD_SECTION_SIZE)
|
|
|
|
|
if (HAVE_TWO_ARG_BFD_SECTION_SIZE)
|
|
|
|
|
add_definitions(-DHAVE_TWO_ARG_BFD_SECTION_SIZE)
|
|
|
|
|
endif()
|
|
|
|
|
find_path(DEMANGLE_HEADER demangle.h PATHS /usr/include PATH_SUFFIXES libiberty)
|
|
|
|
|
if(NOT DEMANGLE_HEADER)
|
|
|
|
|
message("Could not find demangle.h ${DEMANGLE_HEADER}")
|
|
|
|
|
else()
|
|
|
|
|
add_definitions(-DHAVE_CPLUS_DEMANGLE)
|
|
|
|
|
message("Found demangle.h in ${DEMANGLE_HEADER}")
|
|
|
|
|
set (HAVE_CPLUS_DEMANGLE 1)
|
|
|
|
|
set (HAVE_DECL_BASENAME "1")
|
|
|
|
|
INCLUDE_DIRECTORIES(${DEMANGLE_HEADER})
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2022-04-27 12:18:29 -04:00
|
|
|
|
|
|
|
|
find_package(rocm_smi PATHS ${ROCM_PATH}/lib/cmake/rocm_smi)
|
|
|
|
|
if (rocm_smi_FOUND)
|
|
|
|
|
message ("-- Found rocm_smi at ${ROCM_SMI_INCLUDE_DIR}")
|
|
|
|
|
CHECK_INCLUDE_FILE_CXX("${ROCM_SMI_INCLUDE_DIR}/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
|
|
|
|
|
else()
|
|
|
|
|
message ("-- Checking old include directory structure for rocm_smi")
|
|
|
|
|
set(ROCM_SMI_INCLUDE_DIR "${ROCM_PATH}/rocm_smi/include")
|
|
|
|
|
set(ROCM_SMI_LIB_DIR "${ROCM_PATH}/rocm_smi/lib")
|
|
|
|
|
set(ROCM_SMI_LIBRARIES rocm_smi64)
|
|
|
|
|
CHECK_INCLUDE_FILE_CXX("${ROCM_SMI_INCLUDE_DIR}/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
|
|
|
|
|
endif()
|
2021-10-28 07:26:28 -07:00
|
|
|
IF(HAVE_ROCM_SMI64CONFIG)
|
|
|
|
|
add_definitions(-DUSE_ROCM_SMI64CONFIG)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
2019-10-22 17:10:07 -04:00
|
|
|
foreach(target ${AMDGPU_TARGETS})
|
2021-06-23 09:19:48 -06:00
|
|
|
target_link_libraries(rccl PRIVATE --amdgpu-target=${target})
|
2019-10-22 17:10:07 -04:00
|
|
|
endforeach()
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
if("${HIP_COMPILER}" MATCHES "clang")
|
2022-09-20 09:00:20 -07:00
|
|
|
target_compile_options(rccl PRIVATE -fvisibility=hidden --hipcc-func-supp)
|
2019-10-22 17:10:07 -04:00
|
|
|
foreach(target ${AMDGPU_TARGETS})
|
2021-06-23 09:19:48 -06:00
|
|
|
target_compile_options(rccl PRIVATE -fgpu-rdc)
|
2019-10-22 17:10:07 -04:00
|
|
|
endforeach()
|
2019-07-05 15:43:00 -07:00
|
|
|
target_link_libraries(rccl PRIVATE -fgpu-rdc)
|
2022-10-14 01:32:04 -07:00
|
|
|
target_include_directories(rccl PRIVATE ${ROCM_PATH}/include)
|
2020-04-29 17:58:16 +00:00
|
|
|
find_program( hipcc_executable hipcc )
|
|
|
|
|
execute_process(COMMAND bash "-c" "${hipcc_executable} -help | grep 'parallel-jobs'" OUTPUT_VARIABLE hipcc_parallel_jobs)
|
|
|
|
|
if("${hipcc_parallel_jobs}" MATCHES "parallel-jobs")
|
2022-11-30 16:06:03 -08:00
|
|
|
target_compile_options(rccl PRIVATE -parallel-jobs=12 PRIVATE -Wno-format-nonliteral)
|
|
|
|
|
target_link_libraries(rccl PRIVATE -parallel-jobs=12)
|
2020-04-29 17:58:16 +00:00
|
|
|
endif()
|
2020-08-31 16:10:09 +00:00
|
|
|
|
|
|
|
|
# RCCL static lib uses -fgpu-rdc which requires hipcc as the linker and archiver
|
|
|
|
|
if(BUILD_STATIC)
|
|
|
|
|
target_link_libraries(rccl PRIVATE --emit-static-lib)
|
|
|
|
|
set(CMAKE_AR "${hipcc_executable}")
|
|
|
|
|
get_property(link_libraries TARGET rccl PROPERTY LINK_LIBRARIES)
|
|
|
|
|
string (REPLACE ";" " " LINK_PROPS "${link_libraries}")
|
|
|
|
|
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -o <TARGET> ${LINK_PROPS} <LINK_FLAGS> <OBJECTS>")
|
|
|
|
|
endif()
|
2019-07-05 15:43:00 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if("${HIP_COMPILER}" MATCHES "hcc")
|
2019-10-03 13:25:25 -04:00
|
|
|
find_program( hcc_executable hcc )
|
|
|
|
|
execute_process(COMMAND bash "-c" "${hcc_executable} --version | sed -e '1!d' -e 's/.*based on HCC\\s*//'" OUTPUT_VARIABLE hcc_version_string)
|
|
|
|
|
execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $1}'" OUTPUT_VARIABLE hcc_major_version)
|
|
|
|
|
execute_process(COMMAND bash "-c" "echo \"${hcc_version_string}\" | awk -F\".\" '{ printf $2}'" OUTPUT_VARIABLE hcc_minor_version)
|
2020-02-11 19:37:13 +00:00
|
|
|
if ("${hcc_major_version}.${hcc_minor_version}" VERSION_LESS "4.0")
|
2019-10-03 13:25:25 -04:00
|
|
|
target_link_libraries(rccl PRIVATE -hc-function-calls)
|
|
|
|
|
endif()
|
2019-07-05 15:43:00 -07:00
|
|
|
endif()
|
|
|
|
|
|
2022-04-27 12:18:29 -04:00
|
|
|
target_include_directories(rccl PRIVATE ${ROCM_SMI_INCLUDE_DIR})
|
|
|
|
|
target_link_libraries(rccl PRIVATE hip::device dl -l${ROCM_SMI_LIBRARIES} -L${ROCM_SMI_LIB_DIR})
|
2020-03-05 13:36:55 -07:00
|
|
|
target_link_libraries(rccl INTERFACE hip::host)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2022-05-20 09:56:38 -06:00
|
|
|
if(HAVE_BFD)
|
|
|
|
|
target_link_libraries(rccl PRIVATE bfd dl z)
|
|
|
|
|
find_library(HAVE_IBERTY iberty PATHS /usr/lib64 /usr/lib/
|
|
|
|
|
PATH_SUFFIXES x86_64-linux-gnu)
|
|
|
|
|
if(HAVE_IBERTY)
|
|
|
|
|
message("iberty found @ ${HAVE_IBERTY} ")
|
|
|
|
|
target_link_libraries(rccl PRIVATE iberty dl z)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-01-08 21:28:16 -08:00
|
|
|
#Setup librccl.so version
|
|
|
|
|
rocm_set_soversion(rccl "1.0")
|
|
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
rocm_install_targets(TARGETS
|
|
|
|
|
rccl
|
2022-03-08 17:32:02 +00:00
|
|
|
)
|
2022-07-29 13:39:49 -07:00
|
|
|
rocm_install(FILES ${PROJECT_BINARY_DIR}/include/rccl/rccl.h src/include/nccl_net.h
|
2022-03-08 17:32:02 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rccl)
|
2019-07-05 15:43:00 -07:00
|
|
|
|
|
|
|
|
rocm_export_targets(NAMESPACE
|
|
|
|
|
roc::
|
|
|
|
|
TARGETS
|
2022-07-06 10:07:35 -07:00
|
|
|
rccl
|
2019-07-05 15:43:00 -07:00
|
|
|
DEPENDS
|
|
|
|
|
hip)
|
2022-03-08 17:32:02 +00:00
|
|
|
if(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY)
|
|
|
|
|
#Create wrapper files
|
2022-03-10 01:28:41 +00:00
|
|
|
rocm_wrap_header_dir( "${PROJECT_BINARY_DIR}/include/rccl"
|
2022-04-09 07:55:39 -07:00
|
|
|
PATTERNS "rccl.h"
|
2022-03-08 17:32:02 +00:00
|
|
|
GUARDS SYMLINK WRAPPER
|
2022-06-10 18:51:51 -04:00
|
|
|
WRAPPER_LOCATIONS ${CMAKE_INSTALL_INCLUDEDIR} rccl/${CMAKE_INSTALL_INCLUDEDIR})
|
2022-03-08 17:32:02 +00:00
|
|
|
#install the wrapper header file to package
|
2022-07-29 13:39:49 -07:00
|
|
|
rocm_install( FILES ${PROJECT_BINARY_DIR}/rccl/include/rccl.h src/include/nccl_net.h
|
2022-06-10 18:51:51 -04:00
|
|
|
DESTINATION "./rccl/${CMAKE_INSTALL_INCLUDEDIR}/" )
|
2022-07-29 13:39:49 -07:00
|
|
|
rocm_install( FILES ${PROJECT_BINARY_DIR}/include/rccl.h src/include/nccl_net.h
|
2022-04-09 07:55:39 -07:00
|
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/" )
|
2022-03-08 17:32:02 +00:00
|
|
|
endif()
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2022-03-21 15:04:14 -06:00
|
|
|
rocm_package_add_dependencies(DEPENDS "hip-rocclr >= 3.5.0" "rocm-smi-lib >= 4.0.0")
|
2020-10-21 16:20:53 -07:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
2021-06-21 08:29:23 -07:00
|
|
|
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt" "${ROCM_PATH}")
|
2019-07-05 15:43:00 -07:00
|
|
|
|
2020-10-21 16:20:53 -07:00
|
|
|
find_file (DEBIAN debian_version debconf.conf PATHS /etc)
|
|
|
|
|
if(DEBIAN)
|
|
|
|
|
# Write copyright file
|
|
|
|
|
file(WRITE "${CMAKE_BINARY_DIR}/copyright"
|
|
|
|
|
"Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
|
|
|
Upstream-Name: rccl
|
|
|
|
|
Source: https://github.com/ROCmSoftwarePlatform/rccl
|
|
|
|
|
|
|
|
|
|
Files: *
|
|
|
|
|
Copyright: (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
|
Modifications Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
|
License: See LICENSE.txt for license information\n")
|
2021-04-09 14:08:40 -07:00
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/copyright" DESTINATION ${CMAKE_INSTALL_DATADIR}/rccl)
|
2020-10-21 16:20:53 -07:00
|
|
|
# Write changelog file
|
|
|
|
|
find_program( date_executable date )
|
|
|
|
|
execute_process(COMMAND ${date_executable} -R OUTPUT_VARIABLE TIMESTAMP)
|
|
|
|
|
file(WRITE "${CMAKE_BINARY_DIR}/changelog"
|
|
|
|
|
"rccl (${VERSION_STRING}-1) unstable; urgency=medium
|
|
|
|
|
|
|
|
|
|
* Initial release.
|
|
|
|
|
|
|
|
|
|
-- RCCL Maintainer <rccl-maintainer@amd.com> ${TIMESTAMP}\n")
|
|
|
|
|
find_program( gzip_executable gzip )
|
|
|
|
|
execute_process(COMMAND bash "-c" "${gzip_executable} -9 -c ${CMAKE_BINARY_DIR}/changelog"
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/changelog.Debian.gz")
|
2021-04-09 14:08:40 -07:00
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/changelog.Debian.gz" DESTINATION ${CMAKE_INSTALL_DATADIR}/rccl)
|
2020-10-21 16:20:53 -07:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "ROCm Communication Collectives Library
|
|
|
|
|
Optimized primitives for collective multi-GPU communication")
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-03-21 15:04:14 -06:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
|
rocm_package_setup_component(clients)
|
|
|
|
|
rocm_package_setup_client_component(tests)
|
|
|
|
|
add_subdirectory(test)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-07-05 15:43:00 -07:00
|
|
|
rocm_create_package(
|
|
|
|
|
NAME
|
|
|
|
|
rccl
|
|
|
|
|
DESCRIPTION
|
2020-10-21 16:20:53 -07:00
|
|
|
"ROCm Communication Collectives Library"
|
2019-07-05 15:43:00 -07:00
|
|
|
MAINTAINER
|
2020-10-21 16:20:53 -07:00
|
|
|
"RCCL Maintainer <rccl-maintainer@amd.com>"
|
2019-07-05 15:43:00 -07:00
|
|
|
LDCONFIG)
|