-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
115 lines (91 loc) · 3.69 KB
/
CMakeLists.txt
File metadata and controls
115 lines (91 loc) · 3.69 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
cmake_minimum_required(VERSION 3.16)
project(_slime C CXX)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake)
# Slime options for transfer engine
slime_option(BUILD_RDMA "Build RDMA" ON)
slime_option(USE_CUDA "USE in CUDA Platform" OFF)
slime_option(USE_MACA "USE in MACA Platform" OFF)
slime_option(BUILD_NVLINK "Build NVLINK" OFF)
slime_option(BUILD_NVSHMEM "Build NVSHMEM" OFF)
slime_option(BUILD_ASCEND_DIRECT "Build Ascend direct transport" OFF)
# Slime options for ops
slime_option(BUILD_INTRA_OPS "Build intra LL collective ops" OFF)
slime_option(BUILD_INTER_OPS "Build inter LL collective ops" OFF)
# Slime options for custom python wrapper
slime_option(BUILD_PYTHON "Build python wrapper" OFF)
# Slime options for torch plugin
slime_option(USE_GLOO_BACKEND "Build gloo backend" OFF)
slime_option(BUILD_TORCH_PLUGIN "Build torch plugin" OFF)
# Slime options for test
slime_option(BUILD_BENCH "Build transfer engine benchmark" OFF)
slime_option(BUILD_TEST "Build test" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(DLSLIME_INSTALL_PATH "lib" CACHE STRING "Library installation directory")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (BUILD_NVSHMEM OR BUILD_NVLINK OR BUILD_INTRA_OPS OR BUILD_INTER_OPS)
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_ARCHITECTURES "90")
find_package(CUDAToolkit REQUIRED)
include_directories(${CUDAToolkit_INCLUDE_DIRS})
endif()
if (BUILD_PYTHON)
set(DLSLIME_INSTALL_PATH "${SKBUILD_PROJECT_NAME}")
set(DLSLIME_CONFIG_DEST "${DLSLIME_INSTALL_PATH}/share/cmake/dlslime")
else()
set(DLSLIME_INSTALL_PATH "lib")
set(DLSLIME_CONFIG_DEST "share/cmake/dlslime")
endif()
if (BUILD_TORCH_PLUGIN OR BUILD_INTRA_OPS OR BUILD_INTER_OPS)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/torch.cmake)
endif()
include_directories(csrc)
add_subdirectory(csrc)
# Define global imported target for external consumers (e.g. NanoDeploy, Spoke)
if(TARGET _slime_rdma AND NOT TARGET dlslime::dlslime)
add_library(dlslime::dlslime INTERFACE IMPORTED GLOBAL)
target_link_libraries(dlslime::dlslime INTERFACE _slime_rdma)
endif()
if (BUILD_BENCH)
add_subdirectory(bench/cpp)
endif (BUILD_BENCH)
if (BUILD_TEST)
add_subdirectory(tests/cpp)
endif (BUILD_TEST)
# --- Installation & Export ---
# 1. Install Headers
install(
DIRECTORY csrc/
DESTINATION include/dlslime
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
PATTERN "python" EXCLUDE # Exclude python bindings source if present
)
# 2. Install Targets Export
install(EXPORT dlslimeTargets
NAMESPACE dlslime::
DESTINATION ${DLSLIME_CONFIG_DEST}
)
# 3. Generate Config File
include(CMakePackageConfigHelpers)
set(INSTALL_INCLUDE_DIR "include/dlslime")
configure_package_config_file(
cmake/dlslimeConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/dlslimeConfig.cmake"
INSTALL_DESTINATION ${DLSLIME_CONFIG_DEST}
PATH_VARS INSTALL_INCLUDE_DIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/dlslimeConfigVersion.cmake"
VERSION 0.0.2
COMPATIBILITY AnyNewerVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/dlslimeConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dlslimeConfigVersion.cmake"
DESTINATION ${DLSLIME_CONFIG_DEST}
)