forked from TheCoreTeam/core_scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (69 loc) · 2.45 KB
/
CMakeLists.txt
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
# Copyright (c) 2024 The Core Team
#
# Licensed under the Apache License, Version 2.0
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.25)
cmake_policy(SET CMP0146 OLD)
project(CoreScheduler LANGUAGES C CXX CUDA)
option(CORE_SCHEDULER_ENABLE_TESTS "" ON)
option(CORE_SCHEDULER_ENABLE_EXAMPLES "" ON)
option(CORE_SCHEDULER_ENABLE_BUILTIN_TOOLCHAIN "" ON)
if (CORE_SCHEDULER_ENABLE_BUILTIN_TOOLCHAIN)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain.cmake)
endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
# Enable sanitizer compilation
# Env variable: ASAN_OPTIONS=detect_odr_violation=0:protect_shadow_gap=0
# add_compile_options(-fsanitize=address,undefined)
# link_libraries(-fsanitize=address,undefined)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPOResult)
if (IPOResult)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(STATUS "IPO / LTO not supported: <${IPOResult}>")
endif ()
set(BUILD_TESTING OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES "80;86;89;90")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
find_package(CUDAToolkit REQUIRED)
find_package(CUDA REQUIRED)
find_package(OpenMP REQUIRED)
find_package(Torch REQUIRED)
find_package(CUDNN REQUIRED)
find_package(Arrow REQUIRED)
find_package(Parquet REQUIRED)
find_package(NCCL REQUIRED)
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(cxxopts REQUIRED)
if (DEFINED ENV{CONDA_PREFIX})
list(APPEND MPI_HOME ENV{CONDA_PREFIX}/bin/)
endif ()
find_package(MPI COMPONENTS C REQUIRED)
add_subdirectory(src)
if (CORE_SCHEDULER_ENABLE_TESTS)
find_package(GTest REQUIRED)
add_subdirectory(test)
endif ()
if (CORE_SCHEDULER_ENABLE_EXAMPLES)
add_subdirectory(example)
endif ()
if (EXISTS "${CMAKE_BINARY_DIR}/compile_commands.json")
file(COPY "${CMAKE_BINARY_DIR}/compile_commands.json"
DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
endif ()