mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 01:10:22 +00:00
CMake build system transition WIP
This commit is contained in:
23
CMakeLists.txt
Normal file
23
CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(mscclpp LANGUAGES CUDA CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CUDA_STANDARD 17)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
|
||||
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
find_package(IBVerbs REQUIRED)
|
||||
find_package(NUMA REQUIRED)
|
||||
find_package(GDRCopy)
|
||||
|
||||
option(USE_MPI_FOR_TESTS "Use MPI for tests" ON)
|
||||
if(USE_MPI_FOR_TESTS)
|
||||
find_package(MPI REQUIRED)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
41
cmake/modules/FindGDRCopy.cmake
Normal file
41
cmake/modules/FindGDRCopy.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
# Find the GDRCopy libraries
|
||||
#
|
||||
# The following variables are optionally searched for defaults
|
||||
# GDRCOPY_ROOT_DIR: Base directory where all GDRCopy components are found
|
||||
# GDRCOPY_INCLUDE_DIR: Directory where GDRCopy headers are found
|
||||
# GDRCOPY_LIB_DIR: Directory where GDRCopy libraries are found
|
||||
|
||||
# The following are set after configuration is done:
|
||||
# GDRCOPY_FOUND
|
||||
# GDRCOPY_INCLUDE_DIRS
|
||||
# GDRCOPY_LIBRARIES
|
||||
|
||||
# An imported target MSCCLPP::gdrcopy is created if the library is found.
|
||||
|
||||
find_path(GDRCOPY_INCLUDE_DIRS
|
||||
NAMES gdrapi.h
|
||||
HINTS
|
||||
${GDRCOPY_INCLUDE_DIR}
|
||||
${GDRCOPY_ROOT_DIR}
|
||||
${GDRCOPY_ROOT_DIR}/include)
|
||||
|
||||
find_library(GDRCOPY_LIBRARIES
|
||||
NAMES gdrapi
|
||||
HINTS
|
||||
${GDRCOPY_LIB_DIR}
|
||||
${GDRCOPY_ROOT_DIR}
|
||||
${GDRCOPY_ROOT_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GDRCopy DEFAULT_MSG GDRCOPY_INCLUDE_DIRS GDRCOPY_LIBRARIES)
|
||||
mark_as_advanced(GDRCOPY_INCLUDE_DIR GDRCOPY_LIBRARIES)
|
||||
|
||||
if(GDRCOPY_FOUND)
|
||||
if(NOT TARGET MSCCLPP::gdrcopy)
|
||||
add_library(MSCCLPP::gdrcopy UNKNOWN IMPORTED)
|
||||
endif()
|
||||
set_target_properties(MSCCLPP::gdrcopy PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GDRCOPY_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GDRCOPY_LIBRARIES}")
|
||||
endif()
|
||||
41
cmake/modules/FindIBVerbs.cmake
Normal file
41
cmake/modules/FindIBVerbs.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
# Find the IB Verbs libraries
|
||||
#
|
||||
# The following variables are optionally searched for defaults
|
||||
# IBVERBS_ROOT_DIR: Base directory where all ibverbs components are found
|
||||
# IBVERBS_INCLUDE_DIR: Directory where ibverbs headers are found
|
||||
# IBVERBS_LIB_DIR: Directory where ibverbs libraries are found
|
||||
|
||||
# The following are set after configuration is done:
|
||||
# IBVERBS_FOUND
|
||||
# IBVERBS_INCLUDE_DIRS
|
||||
# IBVERBS_LIBRARIES
|
||||
|
||||
# An imported target MSCCLPP::ibverbs is created if the library is found.
|
||||
|
||||
find_path(IBVERBS_INCLUDE_DIRS
|
||||
NAMES infiniband/verbs.h
|
||||
HINTS
|
||||
${IBVERBS_INCLUDE_DIR}
|
||||
${IBVERBS_ROOT_DIR}
|
||||
${IBVERBS_ROOT_DIR}/include)
|
||||
|
||||
find_library(IBVERBS_LIBRARIES
|
||||
NAMES ibverbs
|
||||
HINTS
|
||||
${IBVERBS_LIB_DIR}
|
||||
${IBVERBS_ROOT_DIR}
|
||||
${IBVERBS_ROOT_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(IBVerbs DEFAULT_MSG IBVERBS_INCLUDE_DIRS IBVERBS_LIBRARIES)
|
||||
mark_as_advanced(IBVERBS_INCLUDE_DIR IBVERBS_LIBRARIES)
|
||||
|
||||
if(IBVERBS_FOUND)
|
||||
if(NOT TARGET MSCCLPP::ibverbs)
|
||||
add_library(MSCCLPP::ibverbs UNKNOWN IMPORTED)
|
||||
endif()
|
||||
set_target_properties(MSCCLPP::ibverbs PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IBVERBS_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${IBVERBS_LIBRARIES}")
|
||||
endif()
|
||||
41
cmake/modules/FindNUMA.cmake
Normal file
41
cmake/modules/FindNUMA.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
# Find the numa libraries
|
||||
#
|
||||
# The following variables are optionally searched for defaults
|
||||
# NUMA_ROOT_DIR: Base directory where all numa components are found
|
||||
# NUMA_INCLUDE_DIR: Directory where numa headers are found
|
||||
# NUMA_LIB_DIR: Directory where numa libraries are found
|
||||
|
||||
# The following are set after configuration is done:
|
||||
# NUMA_FOUND
|
||||
# NUMA_INCLUDE_DIRS
|
||||
# NUMA_LIBRARIES
|
||||
|
||||
# An imported target MSCCLPP::numa is created if the library is found.
|
||||
|
||||
find_path(NUMA_INCLUDE_DIRS
|
||||
NAMES numa.h
|
||||
HINTS
|
||||
${NUMA_INCLUDE_DIR}
|
||||
${NUMA_ROOT_DIR}
|
||||
${NUMA_ROOT_DIR}/include)
|
||||
|
||||
find_library(NUMA_LIBRARIES
|
||||
NAMES numa
|
||||
HINTS
|
||||
${NUMA_LIB_DIR}
|
||||
${NUMA_ROOT_DIR}
|
||||
${NUMA_ROOT_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_INCLUDE_DIRS NUMA_LIBRARIES)
|
||||
mark_as_advanced(NUMA_INCLUDE_DIR NUMA_LIBRARIES)
|
||||
|
||||
if(NUMA_FOUND)
|
||||
if(NOT TARGET MSCCLPP::numa)
|
||||
add_library(MSCCLPP::numa UNKNOWN IMPORTED)
|
||||
endif()
|
||||
set_target_properties(MSCCLPP::numa PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NUMA_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${NUMA_LIBRARIES}")
|
||||
endif()
|
||||
12
src/CMakeLists.txt
Normal file
12
src/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS *.cc *.h)
|
||||
file(GLOB to_remove gdr.cc)
|
||||
list(REMOVE_ITEM SOURCES ${to_remove})
|
||||
|
||||
add_library(mscclpp SHARED ${SOURCES})
|
||||
set_target_properties(mscclpp PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_link_libraries(mscclpp PRIVATE MSCCLPP::ibverbs MSCCLPP::numa CUDA::cudart)
|
||||
if(GDRCOPY_FOUND)
|
||||
target_link_libraries(mscclpp PRIVATE MSCCLPP::gdrcopy)
|
||||
endif()
|
||||
|
||||
target_include_directories(mscclpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
5
tests/CMakeLists.txt
Normal file
5
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
add_executable(bootstrap_test bootstrap_test.cc)
|
||||
target_link_libraries(bootstrap_test mscclpp)
|
||||
|
||||
add_executable(allgather_test_standalone allgather_test_standalone.cu)
|
||||
target_link_libraries(allgather_test_standalone mscclpp)
|
||||
Reference in New Issue
Block a user