|
1 | 1 | option(GINKGO_BUILD_EXTLIB_EXAMPLE "Build the external-lib-interfacing with deal.II, you need to link the deal.II library." OFF) |
2 | | -option(GINKGO_RUN_EXAMPLES "Run the examples." OFF) |
3 | 2 |
|
4 | | -set(EXAMPLES_EXEC_LIST "adaptiveprecision-blockjacobi;custom-logger;ginkgo-overhead;ginkgo-ranges;ilu-preconditioned-solver;ir-ilu-preconditioned-solver;inverse-iteration;iterative-refinement;mixed-precision-ir;nine-pt-stencil-solver;poisson-solver;preconditioned-solver;simple-solver;three-pt-stencil-solver;") |
| 3 | +set(EXAMPLES_EXEC_LIST |
| 4 | + adaptiveprecision-blockjacobi |
| 5 | + custom-logger |
| 6 | + ginkgo-overhead |
| 7 | + ginkgo-ranges |
| 8 | + ilu-preconditioned-solver |
| 9 | + ir-ilu-preconditioned-solver |
| 10 | + inverse-iteration |
| 11 | + iterative-refinement |
| 12 | + mixed-precision-ir |
| 13 | + nine-pt-stencil-solver |
| 14 | + poisson-solver |
| 15 | + preconditioned-solver |
| 16 | + simple-solver |
| 17 | + three-pt-stencil-solver) |
5 | 18 |
|
6 | | -set(EXAMPLES_LIST "${EXAMPLES_EXEC_LIST};custom-matrix-format;custom-stopping-criterion;minimal-cuda-solver;papi-logging;performance-debugging;preconditioner-export;simple-solver-logging") |
| 19 | +set(EXAMPLES_LIST |
| 20 | + ${EXAMPLES_EXEC_LIST} |
| 21 | + custom-matrix-format |
| 22 | + custom-stopping-criterion |
| 23 | + minimal-cuda-solver |
| 24 | + papi-logging |
| 25 | + performance-debugging |
| 26 | + preconditioner-export |
| 27 | + simple-solver-logging) |
7 | 28 |
|
8 | 29 | if(GINKGO_BUILD_EXTLIB_EXAMPLE) |
9 | | - set(EXAMPLES_LIST "${EXAMPLES_LIST};external-lib-interfacing") |
| 30 | + list(APPEND EXAMPLES_LIST external-lib-interfacing) |
10 | 31 | endif() |
11 | 32 |
|
12 | 33 | foreach(example ${EXAMPLES_LIST}) |
13 | 34 | add_subdirectory(${example}) |
| 35 | + add_custom_target("run-${example}" |
| 36 | + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example} > ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out |
| 37 | + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example}) |
| 38 | + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command "#!/bin/bash |
| 39 | +diff <(sed -n '7,$p' ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out | sed -E 's/([0-9]+.)//g') <(sed -n '6,$p' ${CMAKE_SOURCE_DIR}/examples/${example}/doc/results.dox | head -n -4 | sed -E 's/([0-9]+.)//g')") |
| 40 | + add_custom_target("validate-${example}" |
| 41 | + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command && ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command |
| 42 | + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example}) |
14 | 43 | endforeach() |
15 | 44 |
|
16 | | -if(GINKGO_RUN_EXAMPLES) |
17 | | - foreach(example ${EXAMPLES_LIST}) |
18 | | - add_custom_target("run-${example}" |
19 | | - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example} > ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out |
20 | | - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example}) |
21 | | - endforeach() |
22 | | - foreach(example ${EXAMPLES_LIST}) |
23 | | - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command "#!/bin/bash |
24 | | -diff <(sed -n '7,$p' ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out | sed -E 's/([0-9]+.)//g') <(sed -n '6,$p' ${CMAKE_SOURCE_DIR}/examples/${example}/doc/results.dox | head -n -4 | sed -E 's/([0-9]+.)//g')") |
25 | | - add_custom_target("validate-${example}" |
26 | | - COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command && ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command |
27 | | - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example}) |
28 | | - endforeach() |
29 | | - add_custom_target(run_all_examples) |
30 | | - add_custom_target(validate_all_examples) |
31 | | - foreach(run_ex ${EXAMPLES_EXEC_LIST}) |
32 | | - add_dependencies(run_all_examples "run-${run_ex}") |
33 | | - add_dependencies(validate_all_examples "validate-${run_ex}") |
34 | | - endforeach() |
35 | | -endif() |
| 45 | +add_custom_target(run_all_examples) |
| 46 | +add_custom_target(validate_all_examples) |
| 47 | +foreach(run_ex ${EXAMPLES_EXEC_LIST}) |
| 48 | + add_dependencies(run_all_examples "run-${run_ex}") |
| 49 | + add_dependencies(validate_all_examples "validate-${run_ex}") |
| 50 | +endforeach() |
0 commit comments