-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
146 lines (115 loc) · 4.53 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright (C) 2019 Jimmy Aguilar Mena
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 3.9 required to use FindOpenMP
# 3.12.4 required to use FindPython
# 3.22 May introduce some issues with cmake_dependent_option (See:
# https://cmake.org/cmake/help/latest/policy/CMP0127.html)
cmake_minimum_required(VERSION 3.10)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CCOMPILER gnu CACHE STRING "C compiler to use gnu or intel")
set(CCOMPILERVALUES gnu intel)
set_property(CACHE CCOMPILER PROPERTY STRINGS ${CCOMPILERVALUES})
list(FIND CCOMPILERVALUES ${CCOMPILER} INDEX)
if(INDEX EQUAL -1)
message(FATAL_ERROR "Invalid CCOMPILER value: ${CCOMPILER}")
endif()
if ("${CCOMPILER}" STREQUAL "intel")
find_package(INTEL REQUIRED)
add_compile_options(--Wn,-diag-disable=858)
endif ()
find_package(MERCURIUM REQUIRED COMPONENTS ${CCOMPILER})
project(nanos6_benchmarks)
include(CMakeDependentOption)
option(WITH_NAMESPACE "Build tests for namespace code" true)
option(WITH_ASAN "Build tests with address sanitizer" false)
option(WITH_EXTRAE "Build with Extrae traces support" false)
cmake_dependent_option(WITH_PRVANIM "Build with PRVANIM" true "WITH_EXTRAE" false)
option(WITH_KEEP "Keep mcc intermediate files" false)
option(WITH_SERIAL "Build serial version of the code when available." false)
option(WITH_NONODE "Build the code version without the node hint." false)
option(WITH_MKL "Use MKL as BLAS library." true)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CTEST_OUTPUT_ON_FAILURE ON)
cmake_policy(SET CMP0074 NEW)
if (CMAKE_BUILD_TYPE MATCHES ".*Debug.*")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
add_definitions(-D_GNU_SOURCE)
add_compile_options(--ompss-2 --parallel $<$<BOOL:${WITH_KEEP}>:--keep-files>)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --ompss-2")
# Enable address sanitizer
if (WITH_ASAN)
message("Using ASAN")
add_definitions(-D__WITH_ASAN=1)
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
endif ()
find_package(MPI REQUIRED COMPONENTS C)
link_libraries(MPI::MPI_C)
# Enable Extrae
set(USE_INSTRUMENT "none")
if (WITH_EXTRAE)
set(USE_INSTRUMENT "extrae")
find_package(Extrae REQUIRED COMPONENTS nanosmpitrace)
if (Extrae_FOUND)
add_definitions(-D__WITH_EXTRAE=1)
if (WITH_PRVANIM)
add_definitions(-D__WITH_PRVANIM)
endif ()
include_directories(${EXTRAE_INCLUDES})
link_libraries(${EXTRAE_LIBRARIES})
endif ()
endif()
find_package(Numa REQUIRED)
include_directories(${NUMA_INCLUDES})
link_libraries(${NUMA_LIBRARIES})
find_package(Python MODULE COMPONENTS Interpreter NumPy)
# BLAS
if (WITH_MKL)
set(BLA_VENDOR Intel10_64lp_seq)
endif ()
find_package(LAPACK REQUIRED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}")
link_libraries(${LAPACK_LIBRARIES})
# add the subdirectories here
add_subdirectory(utils/ArgParserC)
link_libraries(argparser)
include_directories(utils)
enable_testing()
configure_file(${PROJECT_SOURCE_DIR}/utils/ArgParserBash/argparse.sh
${PROJECT_BINARY_DIR}/argparse.sh COPYONLY)
# Lists of include files
file(GLOB children RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*_ompss2)
# Include all subdirectories with _ompss2 suffix.
foreach (child ${children})
if ((IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/${child})
AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${child}/CMakeLists.txt))
message ("-- Adding subdirectory: ${child}")
add_subdirectory(${child})
endif ()
endforeach ()
# For the toml file ==============
set(DISABLE_REMOTE_TOML true)
if (WITH_NAMESPACE)
message("-- Using remote propagation (namespace)")
set(DISABLE_REMOTE_TOML false)
endif ()
set(VERSION_DEBUG_TOML true)
set(USE_TURBO_TOML false)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(VERSION_DEBUG_TOML false)
set(USE_TURBO_TOML true)
endif ()
configure_file(nanos6.toml nanos6.toml @ONLY)