forked from Robyroc/Legio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (97 loc) · 5.03 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
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
cmake_minimum_required(VERSION 3.10)
project(Legio)
set(LEGIO_VERSION_MAJOR 0)
set(LEGIO_VERSION_MINOR 1)
#set(CMAKE_BUILD_TYPE "Debug")
option(WITH_TESTS "Build example programs from legiotest directory" On)
option(WITH_SESSION_TESTS "Build sessions unit tests" Off)
option(WITH_EXAMPLES "Build example programs using ULFM from testsrc directory" Off)
option(BROADCAST_RESILIENCY "Broadcast root failure resiliency" Off)
option(SEND_RESILIENCY "Send target failure resiliency" On)
if(NOT DEFINED NUM_RETRY)
set(NUM_RETRY 3)
endif()
option(RECV_RESILIENCY "Recv source failure resiliency" Off)
option(REDUCE_RESILIENCY "Reduce root failure resiliency" On)
option(GET_RESILIENCY "Get source failure resiliency" Off)
option(PUT_RESILIENCY "Put root failure resiliency" On)
option(GATHER_RESILIENCY "Gather root failure resiliency" On)
option(GATHER_SHIFT "Gather rank movement upon failure" Off)
option(SCATTER_RESILIENCY "Scatter root failure resiliency" Off)
option(SCATTER_SHIFT "Scatter rank movement upon failure" Off)
#"Library log level: 1->None, 2->Errors, 3->Errors&Info, 4->Full"
if(NOT DEFINED LOG_LEVEL)
set(LOG_LEVEL 2)
endif()
option(SESSION_THREAD "Use background session thread" Off)
option(WITH_RESTART "Include restart functionalities" Off)
option(WITH_SESSION "Include Session support" On)
option(CUBE_ALGORITHM "Cube algorithm for group-collective operations" Off)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(MPICC $ENV{MPICC})
if("a${MPICC}" STREQUAL "a")
execute_process(
COMMAND bash -c "cd .. && make ulfm"
OUTPUT_VARIABLE outVar
)
set(MPICC ${outVar})
endif()
#set(CMAKE_BUILD_TYPE Release)
if(NOT "a${MPICC}" STREQUAL "a")
string(REPLACE "\n" "" MPI_C_COMPILER ${MPICC})
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
string(REPLACE "mpicc" "mpicxx" MPI_CXX_COMPILER ${MPI_C_COMPILER})
set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
message("[legio] MPICC has been passed: ${MPICC}")
message("[legio] MPICXX found: ${MPI_CXX_COMPILER}")
else()
message("[legio] MPICC was not passed, searching for MPI")
find_package(MPI REQUIRED)
if(${MPI_C_FOUND})
message("[legio] Found MPICC: ${MPI_C_COMPILER}")
else()
message(FATAL_ERROR "[legio] MPI not found! Try ../make ulfm")
endif()
endif()
function(linkMPI TOLINK)
if("a${MPICC}" STREQUAL "a")
target_link_libraries(${TOLINK} PUBLIC MPI::MPI_C)
endif()
endfunction(linkMPI)
add_subdirectory(lib)
if(WITH_TESTS)
add_subdirectory(legiotest)
endif()
if(WITH_EXAMPLES)
add_subdirectory(testsrc)
endif()
message ( STATUS "" )
message ( STATUS "//===-----------------------------===//" )
message ( STATUS "// LEGIO CONFIG STATUS //" )
message ( STATUS "//===-----------------------------===//" )
message ( STATUS "Build tests........................: ${WITH_TESTS} (CMake option WITH_TESTS)" )
message ( STATUS "Build session tests................: ${WITH_SESSION_TESTS} (CMake option WITH_SESSION_TESTS)")
message ( STATUS "Build examples.....................: ${WITH_EXAMPLES} (CMake option WITH_EXAMPLES)" )
message ( STATUS "Enable restart functionalities.....: ${WITH_RESTART} (CMake option WITH_RESTART)" )
message ( STATUS "Enable session support.............: ${WITH_SESSION} (CMake option WITH_SESSION)" )
message ( STATUS "Broadcast resilient to root fail...: ${BROADCAST_RESILIENCY} (CMake option BROADCAST_RESILIENCY)" )
message ( STATUS "Send resilient to target fail......: ${SEND_RESILIENCY} (CMake option SEND_RESILIENCY)" )
message ( STATUS "Recv resilient to source fail......: ${RECV_RESILIENCY} (CMake option RECV_RESILIENCY)")
message ( STATUS "Reduce resilient to root fail......: ${REDUCE_RESILIENCY} (CMake option REDUCE_RESILIENCY)")
message ( STATUS "Get resilient to source fail.......: ${GET_RESILIENCY} (CMake option GET_RESILIENCY)")
message ( STATUS "Put resilient to target fail.......: ${PUT_RESILIENCY} (CMake option PUT_RESILIENCY)")
message ( STATUS "Gather resilient to root fail......: ${GATHER_RESILIENCY} (CMake option GATHER_RESILIENCY)")
message ( STATUS "Scatter resilient to root fail.....: ${SCATTER_RESILIENCY} (CMake option SCATTER_RESILIENCY)")
message ( STATUS "Gather rank shift on fail..........: ${GATHER_SHIFT} (CMake option GATHER_SHIFT)")
message ( STATUS "Scatter rank shift on fail.........: ${SCATTER_SHIFT} (CMake option SCATTER_SHIFT)")
message ( STATUS "Usage of hypercube algorithm.......: ${CUBE_ALGORITHM} (CMake option CUBE_ALGORITHM)")
message ( STATUS "Number of tries for send...........: ${NUM_RETRY} (CMake set NUM_RETRY)")
message ( STATUS "Session thread.....................: ${SESSION_THREAD} (CMake set SESSION_THREAD)")
message ( STATUS "Log level (4 max, 1 none)..........: ${LOG_LEVEL} (CMake set LOG_LEVEL)")
message ( STATUS "//===-----------------------------===//" )
message ( STATUS "" )
if(${WITH_SESSION} AND ${WITH_RESTART})
message(FATAL_ERROR "WITH_SESSION incompatible with WITH_RESTART funtionalities, change configuration")
endif()