@@ -12,8 +12,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
12
12
include (preventBuildInSource )
13
13
14
14
#
15
- # Create project version (using git info ?)
16
- # TODO
15
+ # Create project version (using git info ?) TODO
17
16
#
18
17
19
18
#
@@ -22,30 +21,41 @@ include(preventBuildInSource)
22
21
include (initBuildType )
23
22
24
23
# options
25
- option (EULER_KOKKOS_BUILD_DOC "Enable / disable documentation build (sphinx/html)" OFF )
26
- option (EULER_KOKKOS_USE_SPHINX_EXHALE "Enable / disable building API documentation (very long)" OFF )
27
- option (EULER_KOKKOS_USE_MPI "Activate / want MPI build" OFF )
28
- option (EULER_KOKKOS_USE_VTK "Activate / want VTK build" OFF )
29
- option (EULER_KOKKOS_USE_DOUBLE "build with double precision" ON )
30
- option (EULER_KOKKOS_USE_HDF5 "build HDF5 input/output support" OFF )
31
- option (EULER_KOKKOS_USE_PNETCDF "build PNETCDF input/output support (MPI required)" OFF )
32
- option (EULER_KOKKOS_USE_FPE_DEBUG "build with floating point Nan tracing (signal handler)" OFF )
33
- option (EULER_KOKKOS_USE_MPI_CUDA_AWARE_ENFORCED "Some MPI cuda-aware implementation are not well detected; use this to enforce" OFF )
24
+ option (EULER_KOKKOS_BUILD_DOC
25
+ "Enable / disable documentation build (sphinx/html)" OFF )
26
+ option (EULER_KOKKOS_USE_SPHINX_EXHALE
27
+ "Enable / disable building API documentation (very long)" OFF )
28
+ option (EULER_KOKKOS_USE_MPI "Activate / want MPI build" OFF )
29
+ option (EULER_KOKKOS_USE_VTK "Activate / want VTK build" OFF )
30
+ option (EULER_KOKKOS_USE_DOUBLE "build with double precision" ON )
31
+ option (EULER_KOKKOS_USE_HDF5 "build HDF5 input/output support" OFF )
32
+ option (EULER_KOKKOS_USE_PNETCDF
33
+ "build PNETCDF input/output support (MPI required)" OFF )
34
+ option (EULER_KOKKOS_USE_FPE_DEBUG
35
+ "build with floating point Nan tracing (signal handler)" OFF )
36
+ option (
37
+ EULER_KOKKOS_USE_MPI_CUDA_AWARE_ENFORCED
38
+ "Some MPI cuda-aware implementation are not well detected; use this to enforce"
39
+ OFF )
34
40
35
41
# disable base languages
36
42
unset (PROJECT_LANGUAGES )
37
43
38
44
set (PROJECT_LANGUAGES ${PROJECT_LANGUAGES} C CXX )
39
45
40
- project (euler_kokkos
41
- LANGUAGES ${PROJECT_LANGUAGES} )
46
+ project (euler_kokkos LANGUAGES ${PROJECT_LANGUAGES} )
42
47
43
48
# Documentation type
44
49
if (EULER_KOKKOS_BUILD_DOC )
45
- set (EULER_KOKKOS_DOC_TYPE "Undefined" CACHE STRING
46
- "The documentation type to generate. Available values are html and doxygen" )
50
+ set (EULER_KOKKOS_DOC_TYPE
51
+ "Undefined"
52
+ CACHE
53
+ STRING
54
+ "The documentation type to generate. Available values are html and doxygen"
55
+ )
47
56
# Set the possible values for documentation type
48
- set_property (CACHE EULER_KOKKOS_DOC_TYPE PROPERTY STRINGS "html" "doxygen" "Undefined" )
57
+ set_property (CACHE EULER_KOKKOS_DOC_TYPE PROPERTY STRINGS "html" "doxygen"
58
+ "Undefined" )
49
59
add_subdirectory (doc )
50
60
return ()
51
61
endif ()
@@ -62,101 +72,107 @@ set(CMAKE_CXX_EXTENSIONS OFF)
62
72
#
63
73
include (write_version )
64
74
65
- #####################################################################
75
+ # ########## ####################################################################
66
76
# External packages: MPI, ...
67
- #####################################################################
77
+ # ########## ####################################################################
68
78
69
- #####################################################################
70
- #find_package(MPI REQUIRED)
79
+ # ########## ####################################################################
80
+ # find_package(MPI REQUIRED)
71
81
find_package (MPI )
72
- if (EULER_KOKKOS_USE_MPI )
82
+ if (EULER_KOKKOS_USE_MPI )
73
83
if (MPI_CXX_FOUND )
74
84
message (STATUS "MPI support found" )
75
85
message (STATUS "MPI compile flags: " ${MPI_CXX_COMPILE_FLAGS} )
76
86
message (STATUS "MPI include path: " ${MPI_CXX_INCLUDE_PATH} )
77
87
message (STATUS "MPI LINK flags path: " ${MPI_CXX_LINK_FLAGS} )
78
88
message (STATUS "MPI libraries: " ${MPI_CXX_LIBRARIES} )
79
89
80
- #set(CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS})
81
- find_program (OMPI_INFO
90
+ # set(CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS})
91
+ find_program (
92
+ OMPI_INFO
82
93
NAMES ompi_info
83
94
HINTS ${MPI_CXX_LIBRARIES} /../bin )
84
95
85
- # Full command line to probe if cuda support in MPI implementation is enabled
86
- # ompi_info --parsable --all | grep mpi_built_with_cuda_support:value
87
- if (OMPI_INFO )
88
- execute_process (COMMAND ${OMPI_INFO}
89
- OUTPUT_VARIABLE _output )
90
- if ( (_output MATCHES "smcuda" ) OR (EULER_KOKKOS_USE_MPI_CUDA_AWARE_ENFORCED ) )
96
+ # Full command line to probe if cuda support in MPI implementation is
97
+ # enabled ompi_info --parsable --all | grep
98
+ # mpi_built_with_cuda_support:value
99
+ if (OMPI_INFO )
100
+ execute_process (COMMAND ${OMPI_INFO} OUTPUT_VARIABLE _output )
101
+ if ((_output MATCHES "smcuda" ) OR (EULER_KOKKOS_USE_MPI_CUDA_AWARE_ENFORCED
102
+ ))
91
103
set (MPI_CUDA_AWARE_ENABLED True )
92
104
message (STATUS "Found OpenMPI with CUDA support built." )
93
105
else ()
94
106
set (MPI_CUDA_AWARE_ENABLED False )
95
107
message (WARNING "OpenMPI found, but it is not built with CUDA support." )
96
- add_compile_options (-DMPI_CUDA_AWARE_OFF )
108
+ add_compile_options (-DMPI_CUDA_AWARE_OFF )
97
109
endif ()
98
110
endif ()
99
111
else ()
100
- message (WARNING "Not compiling with MPI. Suppress this warning with -DEULER_KOKKOS_USE_MPI=OFF" )
112
+ message (
113
+ WARNING
114
+ "Not compiling with MPI. Suppress this warning with -DEULER_KOKKOS_USE_MPI=OFF"
115
+ )
101
116
set (EULER_KOKKOS_USE_MPI OFF )
102
117
endif ()
103
118
endif ()
104
119
105
- if (EULER_KOKKOS_USE_VTK )
106
- # look for VTK only if requested; VTK macro might even be not present
107
- # on the target platform
108
- find_package (VTK COMPONENTS
109
- CommonCore
110
- CommonDataModel
111
- CommonExecutionModel
112
- CommonMath
113
- CommonMisc
114
- CommonSystem
115
- CommonTransforms
116
- IOCore
117
- IOGeometry
118
- IOImage
119
- IOLegacy
120
- IOXML
121
- IOXMLParser
122
- ParallelCore
123
- ParallelMPI
124
- IOParallelXML )
125
-
126
- if (VTK_FOUND )
120
+ if (EULER_KOKKOS_USE_VTK )
121
+ # look for VTK only if requested; VTK macro might even be not present on the
122
+ # target platform
123
+ find_package (
124
+ VTK
125
+ COMPONENTS CommonCore
126
+ CommonDataModel
127
+ CommonExecutionModel
128
+ CommonMath
129
+ CommonMisc
130
+ CommonSystem
131
+ CommonTransforms
132
+ IOCore
133
+ IOGeometry
134
+ IOImage
135
+ IOLegacy
136
+ IOXML
137
+ IOXMLParser
138
+ ParallelCore
139
+ ParallelMPI
140
+ IOParallelXML )
141
+
142
+ if (VTK_FOUND )
127
143
message ("VTK version: ${VTK_VERSION} " )
128
144
else ()
129
- message ("VTK NOT FOUND" )
145
+ message ("VTK NOT FOUND" )
130
146
endif ()
131
147
endif (EULER_KOKKOS_USE_VTK )
132
148
133
- #####################################################################
149
+ # ########## ####################################################################
134
150
# HDF5
135
- #####################################################################
151
+ # ########## ####################################################################
136
152
# prefer using parallel HDF5 when build with mpi
137
- if (EULER_KOKKOS_USE_MPI )
153
+ if (EULER_KOKKOS_USE_MPI )
138
154
set (HDF5_PREFER_PARALLEL TRUE )
139
155
endif (EULER_KOKKOS_USE_MPI )
140
156
141
- if (EULER_KOKKOS_USE_HDF5 )
157
+ if (EULER_KOKKOS_USE_HDF5 )
142
158
find_package (HDF5 )
143
159
if (HDF5_FOUND )
144
160
include_directories (${HDF5_INCLUDE_DIRS} )
145
- set (my_hdf5_libs hdf5 hdf5_cpp )
161
+ set (MY_HDF5_LIBS hdf5 hdf5_cpp )
146
162
add_compile_options (-DUSE_HDF5 )
147
- if (HDF5_IS_PARALLEL )
163
+ if (HDF5_IS_PARALLEL )
148
164
add_compile_options (-DUSE_HDF5_PARALLEL )
149
165
endif ()
150
166
endif (HDF5_FOUND )
151
167
endif (EULER_KOKKOS_USE_HDF5 )
152
168
153
- #####################################################################
169
+ # ########## ####################################################################
154
170
# PNETCDF
155
- #####################################################################
156
- if (EULER_KOKKOS_USE_MPI )
157
- if (EULER_KOKKOS_USE_PNETCDF )
171
+ # ########## ####################################################################
172
+ if (EULER_KOKKOS_USE_MPI )
173
+ if (EULER_KOKKOS_USE_PNETCDF )
158
174
find_package (PNETCDF )
159
- if (PNETCDF_FOUND )
175
+ if (PNETCDF_FOUND )
160
176
add_compile_options (-DUSE_PNETCDF )
161
177
include_directories (${PNETCDF_INCLUDE_DIRS} )
162
178
endif (PNETCDF_FOUND )
@@ -169,11 +185,14 @@ endif(EULER_KOKKOS_USE_MPI)
169
185
include (build_or_find_kokkos )
170
186
171
187
#
172
- # if MPI is enabled and kokkos backend is cuda, we need a cuda aware implementation
188
+ # if MPI is enabled and kokkos backend is cuda, we need a cuda aware
189
+ # implementation
173
190
#
174
- if (EULER_KOKKOS_USE_MPI )
191
+ if (EULER_KOKKOS_USE_MPI )
175
192
176
- if ( MPI_FOUND AND (EULER_KOKKOS_BACKEND MATCHES "Cuda" ) AND (NOT MPI_CUDA_AWARE_ENABLED ) )
193
+ if (MPI_FOUND
194
+ AND (EULER_KOKKOS_BACKEND MATCHES "Cuda" )
195
+ AND (NOT MPI_CUDA_AWARE_ENABLED ))
177
196
178
197
message (FATAL_ERROR "You must use a cuda-aware MPI implementation." )
179
198
@@ -185,39 +204,40 @@ endif()
185
204
# common flags
186
205
#
187
206
188
- if (EULER_KOKKOS_USE_DOUBLE )
207
+ if (EULER_KOKKOS_USE_DOUBLE )
189
208
add_compile_options (-DUSE_DOUBLE )
190
209
endif ()
191
210
192
- if (EULER_KOKKOS_USE_MPI )
211
+ if (EULER_KOKKOS_USE_MPI )
193
212
add_compile_options (-DUSE_MPI )
194
213
endif ()
195
214
196
- if (EULER_KOKKOS_USE_FPE_DEBUG )
215
+ if (EULER_KOKKOS_USE_FPE_DEBUG )
197
216
add_compile_options (-DUSE_FPE_DEBUG )
198
217
endif ()
199
218
200
- ##
201
- ## Using flags -Wextra, it's to strong for Kokkos, too many warnings
202
- ## But -Wall is really a minimum
203
- ##
204
- #add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -pedantic )
205
- #add_definitions( -Wall -Wextra )
206
- add_definitions ( -Wall )
219
+ #
220
+ # Using flags -Wextra, it's to strong for Kokkos, too many warnings But -Wall is
221
+ # really a minimum
222
+ #
223
+ # add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor
224
+ # -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual
225
+ # -pedantic ) add_definitions( -Wall -Wextra )
226
+ add_definitions (-Wall )
207
227
208
228
#
209
229
# sources
210
230
#
211
231
add_subdirectory (test )
212
232
add_subdirectory (src )
213
233
214
- ##################### PRINT CONFIGURE STATUS ######################
234
+ # #################### PRINT CONFIGURE STATUS ######################
215
235
message ("//===================================================" )
216
236
message ("// ${PROJECT_NAME} build configuration:" )
217
237
message ("//===================================================" )
218
238
message ("" )
219
239
message (" CMake version : ${CMAKE_VERSION} " )
220
- if (NOT CMAKE_BUILD_TYPE )
240
+ if (NOT CMAKE_BUILD_TYPE )
221
241
message (" CMake build type : NOT SET !" )
222
242
else ()
223
243
message (" CMake build type : ${CMAKE_BUILD_TYPE} " )
@@ -227,8 +247,7 @@ message(" CMake system processor : ${CMAKE_SYSTEM_PROCESSOR}")
227
247
message (" CMake system name (OS) : ${CMAKE_SYSTEM_NAME} " )
228
248
message ("" )
229
249
message (" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} "
230
- "${CMAKE_CXX_COMPILER_VERSION} "
231
- "${CMAKE_CXX_COMPILER_WRAPPER} " )
250
+ "${CMAKE_CXX_COMPILER_VERSION} " "${CMAKE_CXX_COMPILER_WRAPPER} " )
232
251
message (" ${CMAKE_CXX_COMPILER} " )
233
252
234
253
message (" MPI enabled = ${EULER_KOKKOS_USE_MPI} " )
@@ -248,51 +267,51 @@ endif()
248
267
if (Kokkos_ENABLE_CUDA )
249
268
message (" Kokkos_ENABLE_CUDA = ${Kokkos_ENABLE_CUDA} " )
250
269
251
- if ( (${Kokkos_CUDA_LAMBDA_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_LAMBDA} ))
270
+ if ((${Kokkos_CUDA_LAMBDA_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_LAMBDA} ))
252
271
message (" Kokkos_ENABLE_CUDA_LAMBDA = ON" )
253
272
else ()
254
273
message (" Kokkos_ENABLE_CUDA_LAMBDA = OFF" )
255
274
endif ()
256
275
257
- if ( (${Kokkos_CUDA_CONSTEXPR_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_CONSTEXPR} ))
276
+ if ((${Kokkos_CUDA_CONSTEXPR_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_CONSTEXPR} ))
258
277
message (" Kokkos_ENABLE_CUDA_CONSTEXPR = ON" )
259
278
else ()
260
279
message (" Kokkos_ENABLE_CUDA_CONSTEXPR = OFF" )
261
280
endif ()
262
281
263
- if ( (${Kokkos_CUDA_UVM_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_UVM} ))
282
+ if ((${Kokkos_CUDA_UVM_ENABLED} ) OR (${Kokkos_ENABLE_CUDA_UVM} ))
264
283
message (" Kokkos_ENABLE_CUDA_UVM = ON" )
265
284
else ()
266
285
message (" Kokkos_ENABLE_CUDA_UVM = OFF" )
267
286
endif ()
268
287
269
288
message (" Kokkos CUDA flags = ${KOKKOS_CUDA_OPTIONS} " )
270
- #message(" CUDA Compiler : ${CMAKE_CUDA_COMPILER}")
271
- #message(" CUDA Compiler exec : ${CUDA_NVCC_EXECUTABLE}")
272
- #message(" CUDA Compile flags : ${CUDA_NVCC_FLAGS}")
289
+ # message(" CUDA Compiler : ${CMAKE_CUDA_COMPILER}") message(" CUDA
290
+ # Compiler exec : ${CUDA_NVCC_EXECUTABLE}") message(" CUDA Compile flags :
291
+ # ${CUDA_NVCC_FLAGS}")
273
292
endif (Kokkos_ENABLE_CUDA )
274
293
275
294
if (Kokkos_ENABLE_HIP )
276
295
message (" Kokkos_ENABLE_HIP = ${Kokkos_ENABLE_HIP} " )
277
296
endif (Kokkos_ENABLE_HIP )
278
297
279
- if ( (${Kokkos_TPLS_HWLOC_ENABLED} ) OR (${Kokkos_ENABLE_HWLOC} ) )
298
+ if ( (${Kokkos_TPLS_HWLOC_ENABLED} ) OR (${Kokkos_ENABLE_HWLOC} ))
280
299
message (" Kokkos_ENABLE_HWLOC = ON" )
281
300
else ()
282
301
message (" Kokkos_ENABLE_HWLOC = OFF" )
283
302
endif ()
284
303
285
304
message (" Kokkos architecture = ${Kokkos_ARCH} " )
286
305
287
- if (HDF5_FOUND )
306
+ if (HDF5_FOUND )
288
307
message (" HDF5_VERSION = ${HDF5_VERSION} " )
289
308
message (" HDF5_DEFINITIONS = ${HDF5_DEFINITIONS} " )
290
309
message (" HDF5_IS_PARALLEL = ${HDF5_IS_PARALLEL} " )
291
310
message (" HDF5_INCLUDE_DIRS = ${HDF5_INCLUDE_DIRS} " )
292
311
message (" HDF5_LIBRARIES = ${HDF5_LIBRARIES} " )
293
312
endif (HDF5_FOUND )
294
313
295
- if (PNETCDF_FOUND )
314
+ if (PNETCDF_FOUND )
296
315
message (" PNETCDF_VERSION_STRING = ${PNETCDF_VERSION_STRING} " )
297
316
message (" PNETCDF_INCLUDE_DIRS = ${PNETCDF_INCLUDE_DIRS} " )
298
317
message (" PNETCDF_LIBRARIES = ${PNETCDF_LIBRARIES} " )
0 commit comments