-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathCMakeLists.txt
226 lines (197 loc) · 6.72 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Set headers to be installed as part of the hiop interface
set(hiopLinAlg_INTERFACE_HEADERS
hiop_blasdefs.hpp
LinAlgFactory.hpp
hiopLinSolver.hpp
hiopLinSolverSymDenseLapack.hpp
hiopLinSolverSymDenseMagma.hpp
hiopLinSolverSymSparseMA57.hpp
hiopLinSolverMA86Z.hpp
hiopLinSolverSparseGinkgo.hpp
hiopLinSolverSparseSTRUMPACK.hpp
hiopLinSolverSparsePARDISO.hpp
hiopLinSolverSparseReSolve.hpp
hiopLinSolverUMFPACKZ.hpp
hiopLinSolverCholCuSparse.hpp
hiopMatrix.hpp
hiopMatrixComplexDense.hpp
hiopMatrixComplexSparseTriplet.hpp
hiopMatrixDense.hpp
hiopMatrixDenseRowMajor.hpp
hiopMatrixMDS.hpp
hiopMatrixDenseRaja.hpp
hiopMatrixRajaSparseTriplet.hpp
hiopMatrixSparse.hpp
hiopMatrixSparseTriplet.hpp
hiopMatrixSparseTripletStorage.hpp
hiopMatrixSparseCSR.hpp
hiopMatrixSparseCSRSeq.hpp
hiopMatrixSparseCsrCuda.hpp
hiopVector.hpp
hiopVectorInt.hpp
hiopVectorIntCuda.hpp
hiopVectorIntHip.hpp
hiopVectorIntRaja.hpp
hiopVectorIntSeq.hpp
hiopVectorCuda.hpp
hiopVectorHip.hpp
hiopVectorPar.hpp
hiopLinearOperator.hpp
hiopKrylovSolver.hpp
hiopVectorCompoundPD.hpp
hiopVectorIntCompoundPD.hpp
)
# Set linear algebra common source files
set(hiopLinAlg_SRC
hiopVectorPar.cpp
hiopVectorIntSeq.cpp
hiopMatrixDenseRowMajor.cpp
hiopLinSolver.cpp
LinAlgFactory.cpp
hiopMatrixMDS.cpp
hiopMatrixComplexDense.cpp
hiopMatrixSparseTripletStorage.cpp
hiopMatrixSparseTriplet.cpp
hiopMatrixComplexSparseTriplet.cpp
hiopMatrixSparseCSRSeq.cpp
hiopLinearOperator.cpp
hiopKrylovSolver.cpp
hiopVectorCompoundPD.cpp
hiopVectorIntCompoundPD.cpp
)
if(HIOP_USE_CUDA)
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorRajaCuda.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorIntRajaCuda.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixDenseRajaCuda.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixRajaSparseTripletCuda.cpp)
elseif(HIOP_USE_HIP)
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorRajaHip.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorIntRajaHip.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixDenseRajaHip.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixRajaSparseTripletHip.cpp)
else()
#raja - omp
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorRajaOmp.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopVectorIntRajaOmp.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixDenseRajaOmp.cpp)
list(APPEND hiopLinAlg_RAJA_SRC hiopMatrixRajaSparseTripletOmp.cpp)
endif()
set(hiopLinAlg_MAGMA_SRC
hiopLinSolverSymDenseMagma.cpp
)
set(hiopLinAlg_MA57_SRC
hiopLinSolverSymSparseMA57.cpp
)
set(hiopLinAlg_STRUMPACK_SRC
hiopLinSolverSparseSTRUMPACK.cpp
)
set(hiopLinAlg_PARDISO_SRC
hiopLinSolverSparsePARDISO.cpp
)
set(hiopLinAlg_CUSOLVER_LU_SRC
hiopLinSolverSparseReSolve.cpp
)
set(hiopLinAlg_CUSOLVER_CHOL_SRC
hiopLinSolverCholCuSparse.cpp
)
set(hiopLinAlg_CUDASPARSEKERNELS_SRC
MatrixSparseCsrCudaKernels.cu
)
set(hiopLinAlg_CUDASPARSE_SRC
hiopMatrixSparseCsrCuda.cpp
)
set(hiopLinAlg_CUDAVECTOR_SRC
hiopVectorCuda.cpp
hiopVectorIntCuda.cpp
)
set(hiopLinAlg_CUDAVECTORKERNELS_SRC
VectorCudaKernels.cu
)
set(hiopLinAlg_HIPVECTOR_SRC
hiopVectorHip.cpp
hiopVectorIntHip.cpp
)
set(hiopLinAlg_HIPVECTORKERNELS_SRC
VectorHipKernels.cpp
)
set(hiopLinAlg_KRON_REDUCTION_SRC
hiopLinSolverUMFPACKZ.cpp
)
set(hiopLinAlg_Ginkgo_SRC
hiopLinSolverSparseGinkgo.cpp
)
# Add interfaces for sparse linear solvers when enabled
if(HIOP_SPARSE)
if(HIOP_USE_COINHSL)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_MA57_SRC})
endif(HIOP_USE_COINHSL)
if(HIOP_USE_STRUMPACK)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_STRUMPACK_SRC})
endif(HIOP_USE_STRUMPACK)
if(HIOP_USE_PARDISO)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_PARDISO_SRC})
endif(HIOP_USE_PARDISO)
if(HIOP_USE_RESOLVE)
add_subdirectory(ReSolve)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_CUSOLVER_LU_SRC})
set_source_files_properties(${hiopLinAlg_CUSOLVER_LU_SRC} PROPERTIES LANGUAGE CUDA)
endif(HIOP_USE_RESOLVE)
if(HIOP_USE_CUDA)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_CUSOLVER_CHOL_SRC})
set_source_files_properties(${hiopLinAlg_CUSOLVER_CHOL_SRC} PROPERTIES LANGUAGE CUDA)
endif(HIOP_USE_CUDA)
if(HIOP_USE_GINKGO)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_Ginkgo_SRC})
endif(HIOP_USE_GINKGO)
endif()
# Add sparse CUDA matrix code (even when HIOP_SPARSE is not defined since it can be used in MDS)
if(HIOP_USE_CUDA)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_CUDASPARSE_SRC} ${hiopLinAlg_CUDAVECTOR_SRC})
set_source_files_properties(${hiopLinAlg_CUDASPARSEKERNELS_SRC} PROPERTIES LANGUAGE CUDA)
set_source_files_properties(${hiopLinAlg_CUDAVECTORKERNELS_SRC} PROPERTIES LANGUAGE CUDA)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_CUDASPARSEKERNELS_SRC} ${hiopLinAlg_CUDAVECTORKERNELS_SRC})
endif(HIOP_USE_CUDA)
# Add Hip vector code (even when HIOP_SPARSE is not defined since it can be used in MDS)
if(HIOP_USE_HIP)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_HIPVECTOR_SRC})
# Mark appropriate source files as HIP. I guess in the future just a
# LANGUAGE HIP property will suffice. For now do it via compile flags
# Reference: https://www.olcf.ornl.gov/wp-content/uploads/2021/01/2021UM-Day-3-Joo-Developing-for-Frontier-using-HIP-on-Spock.pdf
# set_source_files_properties(${hiopLinAlg_HIPVECTORKERNELS_SRC} PROPERTIES LANGUAGE HIP)
set_source_files_properties( ${hiopLinAlg_HIPVECTORKERNELS_SRC} PROPERTIES LANGUAGE CXX)
set_source_files_properties( ${hiopLinAlg_HIPVECTORKERNELS_SRC} PROPERTIES COMPILE_FLAGS "-x hip")
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_HIPVECTORKERNELS_SRC})
endif(HIOP_USE_HIP)
# Add RAJA/Umpire sources when enabled
if(HIOP_USE_RAJA)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_RAJA_SRC})
endif()
# If GPU support is enabled add Magma interface (CUDA version)
# Treat RAJA sources as CUDA (temporary, need more flexible solutions)
if(HIOP_USE_GPU)
if(HIOP_USE_MAGMA)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_MAGMA_SRC})
endif()
if(HIOP_USE_CUDA)
set_source_files_properties(${hiopLinAlg_RAJA_SRC} ${hiopLinAlg_CUSOLVER_SRC} PROPERTIES LANGUAGE CUDA)
endif()
endif()
# Add interface to UMFPACK when Kron reduction is enabled
if(HIOP_WITH_KRON_REDUCTION)
list(APPEND hiopLinAlg_SRC ${hiopLinAlg_KRON_REDUCTION_SRC})
endif()
# Build Kron reduction app
if(HIOP_WITH_KRON_REDUCTION)
add_executable(test_hiopLinAlgComplex.exe test_hiopLinalgComplex.cpp)
target_link_libraries(test_hiopLinAlgComplex.exe PRIVATE HiOp::HiOp)
endif(HIOP_WITH_KRON_REDUCTION)
install(
FILES ${hiopLinAlg_INTERFACE_HEADERS}
DESTINATION include
)
add_library(hiopLinAlg OBJECT ${hiopLinAlg_SRC})
if(HIOP_USE_RESOLVE)
target_link_libraries(hiop_tpl INTERFACE ReSolve)
install(TARGETS ReSolve EXPORT hiop-targets)
endif()
target_link_libraries(hiopLinAlg PRIVATE hiop_tpl)