-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
119 lines (90 loc) · 3.58 KB
/
Copy pathCMakeLists.txt
File metadata and controls
119 lines (90 loc) · 3.58 KB
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
#[[
@brief Build Re::Solve examples
@author Slaven Peles <peless@ornl.gov>
]]
# Build portable randomized GMRES example
add_executable(randGmres.exe randGmres.cpp)
target_link_libraries(randGmres.exe PRIVATE ReSolve)
# Build an example with a system GMRES solver
add_executable(sysGmres.exe sysGmres.cpp)
target_link_libraries(sysGmres.exe PRIVATE ReSolve)
if(RESOLVE_USE_KLU)
# Build example with KLU factorization on CPU
add_executable(kluFactor.exe kluFactor.cpp)
target_link_libraries(kluFactor.exe PRIVATE ReSolve)
# Build example with KLU factorization and KLU refactorization
add_executable(kluRefactor.exe kluRefactor.cpp)
target_link_libraries(kluRefactor.exe PRIVATE ReSolve)
# Build an example with a configurable and portable system solver
add_executable(sysRefactor.exe sysRefactor.cpp)
target_link_libraries(sysRefactor.exe PRIVATE ReSolve)
if(RESOLVE_USE_GPU)
# Build an example with refactorization on GPU
add_executable(gpuRefactor.exe gpuRefactor.cpp)
target_link_libraries(gpuRefactor.exe PRIVATE ReSolve)
endif(RESOLVE_USE_GPU)
# Create KLU+CUDA examples
if(RESOLVE_USE_CUDA)
# Build example with KLU factorization and GLU refactorization
add_executable(gluRefactor.exe gluRefactor.cpp)
target_link_libraries(gluRefactor.exe PRIVATE ReSolve)
endif(RESOLVE_USE_CUDA)
endif(RESOLVE_USE_KLU)
set(installable_executables "")
# Install all examples in bin directory
list(APPEND installable_executables randGmres.exe sysGmres.exe)
if(RESOLVE_USE_KLU)
list(APPEND installable_executables kluFactor.exe kluRefactor.exe
sysRefactor.exe
)
if(RESOLVE_USE_GPU)
list(APPEND installable_executables gpuRefactor.exe)
endif(RESOLVE_USE_GPU)
if(RESOLVE_USE_CUDA)
list(APPEND installable_executables gluRefactor.exe)
endif(RESOLVE_USE_CUDA)
endif(RESOLVE_USE_KLU)
install(TARGETS ${installable_executables} RUNTIME DESTINATION bin)
add_subdirectory(experimental)
#
# Consumer example for test_install target
#
# 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_KLU)
if(RESOLVE_USE_CUDA)
set(RESOLVE_CONSUMER_APP "testSysRefactor.cpp")
elseif(RESOLVE_USE_HIP)
set(RESOLVE_CONSUMER_APP "testSysRefactor.cpp")
else()
set(RESOLVE_CONSUMER_APP "testKlu.cpp")
endif()
else(RESOLVE_USE_KLU)
set(RESOLVE_CONSUMER_APP "testSysGmres.cpp")
endif(RESOLVE_USE_KLU)
set(test_data_dir ${CMAKE_SOURCE_DIR}/tests/functionality)
set(sym_matrix_path /data/matrix_ACTIVSg200_AC_renumbered_add9_)
set(sym_rhs_path /data/rhs_ACTIVSg200_AC_renumbered_add9_ones_)
set(asym_matrix_path /data/A_asymmetric)
set(asym_rhs_path /data/b_asymmetric)
# 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
)
install(FILES ${PROJECT_SOURCE_DIR}/tests/functionality/TestHelper.hpp
DESTINATION share/examples/resolve_consumer
)
# Shell script argumets: 1. Path to where resolve is installed. 2. Path to data
# directory. 3. CXX compiler (propagated so consumer uses same API as ReSolve).
add_custom_target(
test_install
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install
COMMAND ${CONSUMER_PATH}/test.sh ${CMAKE_INSTALL_PREFIX} ${test_data_dir}
${sym_matrix_path} ${sym_rhs_path} ${CMAKE_CXX_COMPILER}
)