-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
153 lines (111 loc) · 5.57 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
146
147
148
149
150
151
152
153
#[[
@brief Build ReSolve examples
@author Slaven Peles <peless@ornl.gov>
]]
if(RESOLVE_USE_KLU)
# Build example with KLU factorization and KLU refactorization
add_executable(klu_klu.exe r_KLU_KLU.cpp)
target_link_libraries(klu_klu.exe PRIVATE ReSolve)
# Read ONE matrix,solve with KLU
add_executable(klu_klu_standalone.exe r_KLU_KLU_standalone.cpp)
target_link_libraries(klu_klu_standalone.exe PRIVATE ReSolve)
# Build example with a configurable system solver
add_executable(system.exe r_SysSolver.cpp)
target_link_libraries(system.exe PRIVATE ReSolve)
endif(RESOLVE_USE_KLU)
# Build rand example, CPU ONLY r_randGMRES_cpu
add_executable(gmres_cpu_rand.exe r_randGMRES_cpu.cpp)
target_link_libraries(gmres_cpu_rand.exe PRIVATE ReSolve)
# Create CUDA examples
if(RESOLVE_USE_CUDA)
if(RESOLVE_USE_KLU)
# Build example with KLU factorization and GLU refactorization
add_executable(klu_glu.exe r_KLU_GLU.cpp)
target_link_libraries(klu_glu.exe PRIVATE ReSolve)
# Build example with KLU factorization and Rf refactorization
add_executable(klu_rf.exe r_KLU_rf.cpp)
target_link_libraries(klu_rf.exe PRIVATE ReSolve)
# Build example with KLU factorization, Rf refactorization, and FGMRES iterative refinement
add_executable(klu_rf_fgmres.exe r_KLU_rf_FGMRES.cpp)
target_link_libraries(klu_rf_fgmres.exe PRIVATE ReSolve)
# Build example where matrix is factorized once, refactorized once and then the preconditioner is REUSED
add_executable(klu_rf_fgmres_reuse_refactorization.exe r_KLU_rf_FGMRES_reuse_factorization.cpp)
target_link_libraries(klu_rf_fgmres_reuse_refactorization.exe PRIVATE ReSolve)
# Build example where matrix data is updated
add_executable(klu_glu_values_update.exe r_KLU_GLU_matrix_values_update.cpp)
target_link_libraries(klu_glu_values_update.exe PRIVATE ReSolve)
# Build example with a configurable system solver
add_executable(system_cuda.exe r_SysSolverCuda.cpp)
target_link_libraries(system_cuda.exe PRIVATE ReSolve)
# Example in which factorization is redone if solution is bad
add_executable(klu_cusolverrf_check_redo.exe r_KLU_cusolverrf_redo_factorization.cpp)
target_link_libraries(klu_cusolverrf_check_redo.exe PRIVATE ReSolve)
endif(RESOLVE_USE_KLU)
#rand solver
add_executable(gmres_cusparse_rand.exe r_randGMRES_CUDA.cpp)
target_link_libraries(gmres_cusparse_rand.exe PRIVATE ReSolve)
endif(RESOLVE_USE_CUDA)
# Create HIP examples
if(RESOLVE_USE_HIP)
if(RESOLVE_USE_KLU)
# Build example with KLU factorization and rocsolver Rf refactorization
add_executable(klu_rocsolverrf.exe r_KLU_rocsolverrf.cpp)
target_link_libraries(klu_rocsolverrf.exe PRIVATE ReSolve)
# Build example with KLU factorization, rocsolver Rf refactorization, and FGMRES iterative refinement
add_executable(klu_rocsolverrf_fgmres.exe r_KLU_rocSolverRf_FGMRES.cpp)
target_link_libraries(klu_rocsolverrf_fgmres.exe PRIVATE ReSolve)
# Example in which factorization is redone if solution is bad
add_executable(klu_rocsolverrf_check_redo.exe r_KLU_rocsolverrf_redo_factorization.cpp)
target_link_libraries(klu_rocsolverrf_check_redo.exe PRIVATE ReSolve)
# Build example with a configurable system solver
add_executable(system_hip.exe r_SysSolverHip.cpp)
target_link_libraries(system_hip.exe PRIVATE ReSolve)
# Build example with a configurable system solver
add_executable(system_hip_fgmres.exe r_SysSolverHipRefine.cpp)
target_link_libraries(system_hip_fgmres.exe PRIVATE ReSolve)
endif(RESOLVE_USE_KLU)
# Rand GMRES test with rocsparse
add_executable(gmres_rocsparse_rand.exe r_randGMRES.cpp)
target_link_libraries(gmres_rocsparse_rand.exe PRIVATE ReSolve)
endif(RESOLVE_USE_HIP)
set(installable_executables "")
# Install all examples in bin directory
if(RESOLVE_USE_KLU)
list(APPEND installable_executables klu_klu.exe klu_klu_standalone.exe system.exe)
endif()
if(RESOLVE_USE_CUDA)
if(RESOLVE_USE_KLU)
list(APPEND installable_executables klu_glu.exe klu_rf.exe klu_rf_fgmres.exe klu_glu_values_update.exe klu_cusolverrf_check_redo.exe)
endif()
list(APPEND installable_executables gmres_cusparse_rand.exe)
endif(RESOLVE_USE_CUDA)
if(RESOLVE_USE_HIP)
if(RESOLVE_USE_KLU)
list(APPEND installable_executables klu_rocsolverrf.exe klu_rocsolverrf_fgmres.exe klu_rocsolverrf_check_redo.exe)
endif()
list(APPEND installable_executables gmres_rocsparse_rand.exe)
endif(RESOLVE_USE_HIP)
list(APPEND installable_executables gmres_cpu_rand.exe)
install(TARGETS ${installable_executables}
RUNTIME DESTINATION bin)
# Path where the consumer test code will be installed
set(CONSUMER_PATH ${CMAKE_INSTALL_PREFIX}/share/examples)
# Make the resolve consumer test script exectuable
install(PROGRAMS test.sh DESTINATION ${CONSUMER_PATH})
# Select consumer app
if(RESOLVE_USE_CUDA)
set(RESOLVE_CONSUMER_APP "testKLU_Rf_FGMRES.cpp")
elseif(RESOLVE_USE_HIP)
set(RESOLVE_CONSUMER_APP "testKLU_RocSolver.cpp")
elseif(RESOLVE_USE_KLU)
set(RESOLVE_CONSUMER_APP "testKLU.cpp")
else()
set(RESOLVE_CONSUMER_APP "testVersion.cpp")
endif()
# Install directory with example on how to consume ReSolve
install(DIRECTORY resolve_consumer DESTINATION share/examples)
install(FILES ${PROJECT_SOURCE_DIR}/tests/functionality/${RESOLVE_CONSUMER_APP} DESTINATION share/examples/resolve_consumer RENAME consumer.cpp)
# Shell script argumets:
# 1. Path to where resolve is installed.
# 2. Path to data directory
add_custom_target(test_install COMMAND ${CONSUMER_PATH}/test.sh ${CMAKE_INSTALL_PREFIX} ${PROJECT_SOURCE_DIR}/tests/functionality/)