forked from hpcg-benchmark/hpcg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (61 loc) · 2.63 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
#
# HPCG Benchmark CMake configuration
#
cmake_minimum_required( VERSION 3.0 FATAL_ERROR )
project( hpcg
VERSION 3.1
LANGUAGES CXX
DESCRIPTION "High Performance Conjugate Gradient Benchmark (HPCG) " )
#
# Options
#
option(HPCG_ENABLE_CONTIGUOUS_ARRAYS "Enable contiguous arrays for better cache pre-fetch" OFF)
option(HPCG_ENABLE_CUBIC_RADICAL_SEARCH "Enable faster search for optimal 3D process grid" OFF)
option(HPCG_ENABLE_DEBUG "Enable debug build" OFF)
option(HPCG_ENABLE_DETAILED_DEBUG "Enable detailed debug build" OFF)
option(HPCG_ENABLE_MPI "Enable MPI support" OFF)
option(HPCG_ENABLE_LONG_LONG "Enable use of 'long long' type for global indices" ON)
option(HPCG_ENABLE_OPENMP "Enable OpenMP support" OFF)
add_executable( xhpcg src/main.cpp src/CG.cpp src/CG_ref.cpp src/TestCG.cpp
src/ComputeResidual.cpp src/ExchangeHalo.cpp src/GenerateGeometry.cpp
src/GenerateProblem.cpp src/GenerateProblem_ref.cpp src/CheckProblem.cpp
src/OptimizeProblem.cpp src/ReadHpcgDat.cpp src/ReportResults.cpp
src/SetupHalo.cpp src/SetupHalo_ref.cpp src/TestSymmetry.cpp
src/TestNorms.cpp src/WriteProblem.cpp src/YAML_Doc.cpp
src/YAML_Element.cpp src/ComputeDotProduct.cpp
src/ComputeDotProduct_ref.cpp src/finalize.cpp src/init.cpp src/mytimer.cpp
src/ComputeSPMV.cpp src/ComputeSPMV_ref.cpp src/ComputeSYMGS.cpp
src/ComputeSYMGS_ref.cpp src/ComputeWAXPBY.cpp src/ComputeWAXPBY_ref.cpp
src/ComputeMG_ref.cpp src/ComputeMG.cpp src/ComputeProlongation_ref.cpp
src/ComputeRestriction_ref.cpp src/GenerateCoarseProblem.cpp
src/ComputeOptimalShapeXYZ.cpp src/MixedBaseCounter.cpp
src/CheckAspectRatio.cpp src/OutputFile.cpp)
if (HPCG_ENABLE_CONTIGUOUS_ARRAYS)
target_compile_definitions(xhpcg PRIVATE HPCG_CONTIGUOUS_ARRAYS)
endif ()
if (HPCG_ENABLE_CUBIC_RADICAL_SEARCH)
target_compile_definitions(xhpcg PRIVATE HPCG_CUBIC_RADICAL_SEARCH)
endif ()
if (HPCG_ENABLE_DEBUG)
target_compile_definitions(xhpcg PRIVATE HPCG_DEBUG)
endif ()
if (HPCG_ENABLE_DETAILED_DEBUG)
target_compile_definitions(xhpcg PRIVATE HPCG_DETAILED_DEBUG)
endif ()
if (HPCG_ENABLE_MPI)
set(MPI_CXX_SKIP_MPICXX ON)
find_package(MPI REQUIRED)
target_link_libraries(xhpcg ${MPI_CXX_LIBRARIES})
else ()
target_compile_definitions(xhpcg PRIVATE HPCG_NO_MPI)
endif ()
if (NOT HPCG_ENABLE_LONG_LONG)
target_compile_definitions(xhpcg PRIVATE HPCG_NO_LONG_LONG)
endif ()
if (HPCG_ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
target_link_libraries(xhpcg ${OpenMP_CXX_LIBRARIES})
else ()
target_compile_definitions(xhpcg PRIVATE HPCG_NO_OPENMP)
endif ()