Skip to content

Commit e10079e

Browse files
committed
Apply cmake format and lint.
1 parent d8a75a6 commit e10079e

25 files changed

+665
-692
lines changed

CMakeLists.txt

Lines changed: 110 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1212
include(preventBuildInSource)
1313

1414
#
15-
# Create project version (using git info ?)
16-
# TODO
15+
# Create project version (using git info ?) TODO
1716
#
1817

1918
#
@@ -22,30 +21,41 @@ include(preventBuildInSource)
2221
include(initBuildType)
2322

2423
# 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)
3440

3541
# disable base languages
3642
unset(PROJECT_LANGUAGES)
3743

3844
set(PROJECT_LANGUAGES ${PROJECT_LANGUAGES} C CXX)
3945

40-
project(euler_kokkos
41-
LANGUAGES ${PROJECT_LANGUAGES})
46+
project(euler_kokkos LANGUAGES ${PROJECT_LANGUAGES})
4247

4348
# Documentation type
4449
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+
)
4756
# 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")
4959
add_subdirectory(doc)
5060
return()
5161
endif()
@@ -62,101 +72,107 @@ set(CMAKE_CXX_EXTENSIONS OFF)
6272
#
6373
include(write_version)
6474

65-
#####################################################################
75+
# ##############################################################################
6676
# External packages: MPI, ...
67-
#####################################################################
77+
# ##############################################################################
6878

69-
#####################################################################
70-
#find_package(MPI REQUIRED)
79+
# ##############################################################################
80+
# find_package(MPI REQUIRED)
7181
find_package(MPI)
72-
if (EULER_KOKKOS_USE_MPI)
82+
if(EULER_KOKKOS_USE_MPI)
7383
if(MPI_CXX_FOUND)
7484
message(STATUS "MPI support found")
7585
message(STATUS "MPI compile flags: " ${MPI_CXX_COMPILE_FLAGS})
7686
message(STATUS "MPI include path: " ${MPI_CXX_INCLUDE_PATH})
7787
message(STATUS "MPI LINK flags path: " ${MPI_CXX_LINK_FLAGS})
7888
message(STATUS "MPI libraries: " ${MPI_CXX_LIBRARIES})
7989

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
8293
NAMES ompi_info
8394
HINTS ${MPI_CXX_LIBRARIES}/../bin)
8495

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+
))
91103
set(MPI_CUDA_AWARE_ENABLED True)
92104
message(STATUS "Found OpenMPI with CUDA support built.")
93105
else()
94106
set(MPI_CUDA_AWARE_ENABLED False)
95107
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)
97109
endif()
98110
endif()
99111
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+
)
101116
set(EULER_KOKKOS_USE_MPI OFF)
102117
endif()
103118
endif()
104119

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)
127143
message("VTK version: ${VTK_VERSION}")
128144
else()
129-
message ("VTK NOT FOUND")
145+
message("VTK NOT FOUND")
130146
endif()
131147
endif(EULER_KOKKOS_USE_VTK)
132148

133-
#####################################################################
149+
# ##############################################################################
134150
# HDF5
135-
#####################################################################
151+
# ##############################################################################
136152
# prefer using parallel HDF5 when build with mpi
137-
if (EULER_KOKKOS_USE_MPI)
153+
if(EULER_KOKKOS_USE_MPI)
138154
set(HDF5_PREFER_PARALLEL TRUE)
139155
endif(EULER_KOKKOS_USE_MPI)
140156

141-
if (EULER_KOKKOS_USE_HDF5)
157+
if(EULER_KOKKOS_USE_HDF5)
142158
find_package(HDF5)
143159
if(HDF5_FOUND)
144160
include_directories(${HDF5_INCLUDE_DIRS})
145-
set(my_hdf5_libs hdf5 hdf5_cpp)
161+
set(MY_HDF5_LIBS hdf5 hdf5_cpp)
146162
add_compile_options(-DUSE_HDF5)
147-
if (HDF5_IS_PARALLEL)
163+
if(HDF5_IS_PARALLEL)
148164
add_compile_options(-DUSE_HDF5_PARALLEL)
149165
endif()
150166
endif(HDF5_FOUND)
151167
endif(EULER_KOKKOS_USE_HDF5)
152168

153-
#####################################################################
169+
# ##############################################################################
154170
# 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)
158174
find_package(PNETCDF)
159-
if (PNETCDF_FOUND)
175+
if(PNETCDF_FOUND)
160176
add_compile_options(-DUSE_PNETCDF)
161177
include_directories(${PNETCDF_INCLUDE_DIRS})
162178
endif(PNETCDF_FOUND)
@@ -169,11 +185,14 @@ endif(EULER_KOKKOS_USE_MPI)
169185
include(build_or_find_kokkos)
170186

171187
#
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
173190
#
174-
if (EULER_KOKKOS_USE_MPI)
191+
if(EULER_KOKKOS_USE_MPI)
175192

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))
177196

178197
message(FATAL_ERROR "You must use a cuda-aware MPI implementation.")
179198

@@ -185,39 +204,40 @@ endif()
185204
# common flags
186205
#
187206

188-
if (EULER_KOKKOS_USE_DOUBLE)
207+
if(EULER_KOKKOS_USE_DOUBLE)
189208
add_compile_options(-DUSE_DOUBLE)
190209
endif()
191210

192-
if (EULER_KOKKOS_USE_MPI)
211+
if(EULER_KOKKOS_USE_MPI)
193212
add_compile_options(-DUSE_MPI)
194213
endif()
195214

196-
if (EULER_KOKKOS_USE_FPE_DEBUG)
215+
if(EULER_KOKKOS_USE_FPE_DEBUG)
197216
add_compile_options(-DUSE_FPE_DEBUG)
198217
endif()
199218

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)
207227

208228
#
209229
# sources
210230
#
211231
add_subdirectory(test)
212232
add_subdirectory(src)
213233

214-
##################### PRINT CONFIGURE STATUS ######################
234+
# #################### PRINT CONFIGURE STATUS ######################
215235
message("//===================================================")
216236
message("// ${PROJECT_NAME} build configuration:")
217237
message("//===================================================")
218238
message("")
219239
message(" CMake version : ${CMAKE_VERSION}")
220-
if (NOT CMAKE_BUILD_TYPE)
240+
if(NOT CMAKE_BUILD_TYPE)
221241
message(" CMake build type : NOT SET !")
222242
else()
223243
message(" CMake build type : ${CMAKE_BUILD_TYPE}")
@@ -227,8 +247,7 @@ message(" CMake system processor : ${CMAKE_SYSTEM_PROCESSOR}")
227247
message(" CMake system name (OS) : ${CMAKE_SYSTEM_NAME}")
228248
message("")
229249
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}")
232251
message(" ${CMAKE_CXX_COMPILER}")
233252

234253
message(" MPI enabled = ${EULER_KOKKOS_USE_MPI}")
@@ -248,51 +267,51 @@ endif()
248267
if(Kokkos_ENABLE_CUDA)
249268
message(" Kokkos_ENABLE_CUDA = ${Kokkos_ENABLE_CUDA}")
250269

251-
if( (${Kokkos_CUDA_LAMBDA_ENABLED}) OR (${Kokkos_ENABLE_CUDA_LAMBDA}))
270+
if((${Kokkos_CUDA_LAMBDA_ENABLED}) OR (${Kokkos_ENABLE_CUDA_LAMBDA}))
252271
message(" Kokkos_ENABLE_CUDA_LAMBDA = ON")
253272
else()
254273
message(" Kokkos_ENABLE_CUDA_LAMBDA = OFF")
255274
endif()
256275

257-
if( (${Kokkos_CUDA_CONSTEXPR_ENABLED}) OR (${Kokkos_ENABLE_CUDA_CONSTEXPR}))
276+
if((${Kokkos_CUDA_CONSTEXPR_ENABLED}) OR (${Kokkos_ENABLE_CUDA_CONSTEXPR}))
258277
message(" Kokkos_ENABLE_CUDA_CONSTEXPR = ON")
259278
else()
260279
message(" Kokkos_ENABLE_CUDA_CONSTEXPR = OFF")
261280
endif()
262281

263-
if( (${Kokkos_CUDA_UVM_ENABLED}) OR (${Kokkos_ENABLE_CUDA_UVM}))
282+
if((${Kokkos_CUDA_UVM_ENABLED}) OR (${Kokkos_ENABLE_CUDA_UVM}))
264283
message(" Kokkos_ENABLE_CUDA_UVM = ON")
265284
else()
266285
message(" Kokkos_ENABLE_CUDA_UVM = OFF")
267286
endif()
268287

269288
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}")
273292
endif(Kokkos_ENABLE_CUDA)
274293

275294
if(Kokkos_ENABLE_HIP)
276295
message(" Kokkos_ENABLE_HIP = ${Kokkos_ENABLE_HIP}")
277296
endif(Kokkos_ENABLE_HIP)
278297

279-
if ( (${Kokkos_TPLS_HWLOC_ENABLED}) OR (${Kokkos_ENABLE_HWLOC}) )
298+
if((${Kokkos_TPLS_HWLOC_ENABLED}) OR (${Kokkos_ENABLE_HWLOC}))
280299
message(" Kokkos_ENABLE_HWLOC = ON")
281300
else()
282301
message(" Kokkos_ENABLE_HWLOC = OFF")
283302
endif()
284303

285304
message(" Kokkos architecture = ${Kokkos_ARCH}")
286305

287-
if (HDF5_FOUND)
306+
if(HDF5_FOUND)
288307
message(" HDF5_VERSION = ${HDF5_VERSION}")
289308
message(" HDF5_DEFINITIONS = ${HDF5_DEFINITIONS}")
290309
message(" HDF5_IS_PARALLEL = ${HDF5_IS_PARALLEL}")
291310
message(" HDF5_INCLUDE_DIRS = ${HDF5_INCLUDE_DIRS}")
292311
message(" HDF5_LIBRARIES = ${HDF5_LIBRARIES}")
293312
endif(HDF5_FOUND)
294313

295-
if (PNETCDF_FOUND)
314+
if(PNETCDF_FOUND)
296315
message(" PNETCDF_VERSION_STRING = ${PNETCDF_VERSION_STRING}")
297316
message(" PNETCDF_INCLUDE_DIRS = ${PNETCDF_INCLUDE_DIRS}")
298317
message(" PNETCDF_LIBRARIES = ${PNETCDF_LIBRARIES}")

0 commit comments

Comments
 (0)