From c6b9a02f24a27081c471d63dfc524684a9f5a9e3 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 8 Jul 2024 18:55:56 -0700 Subject: [PATCH] CMake: Formatting with cmake-format (#520) Add CMake formatter --- .cmake-format.py | 330 +++++++++++++++ ...heck-clang-format.yml => check-format.yml} | 27 +- CMakeLists.txt | 81 ++-- benchmarks/CMakeLists.txt | 14 +- .../advection_reaction_3D/CMakeLists.txt | 1 - .../kokkos/CMakeLists.txt | 55 +-- .../advection_reaction_3D/raja/CMakeLists.txt | 164 ++++---- benchmarks/diffusion_2D/CMakeLists.txt | 13 +- .../diffusion_2D/mpi_gpu/CMakeLists.txt | 45 +-- .../diffusion_2D/mpi_serial/CMakeLists.txt | 29 +- benchmarks/nvector/cuda/CMakeLists.txt | 6 +- benchmarks/nvector/hip/CMakeLists.txt | 6 +- benchmarks/nvector/kokkos/CMakeLists.txt | 11 +- benchmarks/nvector/mpiplusx/CMakeLists.txt | 6 +- benchmarks/nvector/openmp/CMakeLists.txt | 15 +- benchmarks/nvector/openmpdev/CMakeLists.txt | 11 +- benchmarks/nvector/parallel/CMakeLists.txt | 6 +- benchmarks/nvector/parhyp/CMakeLists.txt | 6 +- benchmarks/nvector/petsc/CMakeLists.txt | 6 +- benchmarks/nvector/pthreads/CMakeLists.txt | 6 +- benchmarks/nvector/raja/CMakeLists.txt | 11 +- benchmarks/nvector/serial/CMakeLists.txt | 6 +- benchmarks/nvector/sycl/CMakeLists.txt | 3 +- cmake/SundialsBuildOptionsPost.cmake | 259 +++++++----- cmake/SundialsBuildOptionsPre.cmake | 159 +++++--- cmake/SundialsDeprecated.cmake | 113 ++++-- cmake/SundialsExampleOptions.cmake | 63 ++- cmake/SundialsIndexSize.cmake | 24 +- cmake/SundialsSetupCXX.cmake | 15 +- cmake/SundialsSetupCompilers.cmake | 222 ++++++----- cmake/SundialsSetupConfig.cmake | 14 +- cmake/SundialsSetupCuda.cmake | 31 +- cmake/SundialsSetupFortran.cmake | 40 +- cmake/SundialsSetupHIP.cmake | 27 +- cmake/SundialsSetupTPLs.cmake | 5 +- cmake/SundialsSetupTesting.cmake | 117 ++++-- cmake/SundialsTPLOptions.cmake | 377 +++++++++++------- cmake/macros/SundialsAddBenchmark.cmake | 51 ++- cmake/macros/SundialsAddExamplesGinkgo.cmake | 27 +- cmake/macros/SundialsAddExecutable.cmake | 26 +- cmake/macros/SundialsAddLibrary.cmake | 318 ++++++++------- cmake/macros/SundialsAddTest.cmake | 163 +++++--- cmake/macros/SundialsAddTestInstall.cmake | 60 +-- cmake/macros/SundialsCMakeMacros.cmake | 27 +- cmake/macros/SundialsInstallExamples.cmake | 90 +++-- .../SundialsInstallExamplesGinkgo.cmake | 61 +-- cmake/macros/SundialsOption.cmake | 37 +- cmake/macros/SundialsTryCompileExecute.cmake | 49 ++- cmake/tpl/FindHYPRE.cmake | 78 ++-- cmake/tpl/FindKLU.cmake | 118 +++--- cmake/tpl/FindMAGMA.cmake | 68 ++-- cmake/tpl/FindPETSC.cmake | 52 ++- cmake/tpl/FindSUPERLUDIST.cmake | 100 +++-- cmake/tpl/FindSUPERLUMT.cmake | 64 +-- cmake/tpl/FindTrilinos.cmake | 28 +- cmake/tpl/FindXBRAID.cmake | 202 +++++----- cmake/tpl/SundialsAdiak.cmake | 30 +- cmake/tpl/SundialsCaliper.cmake | 36 +- cmake/tpl/SundialsGinkgo.cmake | 35 +- cmake/tpl/SundialsHypre.cmake | 78 ++-- cmake/tpl/SundialsKLU.cmake | 66 +-- cmake/tpl/SundialsKokkos.cmake | 19 +- cmake/tpl/SundialsKokkosKernels.cmake | 16 +- cmake/tpl/SundialsLapack.cmake | 163 ++++---- cmake/tpl/SundialsMAGMA.cmake | 18 +- cmake/tpl/SundialsMPI.cmake | 45 +-- cmake/tpl/SundialsONEMKL.cmake | 25 +- cmake/tpl/SundialsOpenMP.cmake | 35 +- cmake/tpl/SundialsPETSC.cmake | 43 +- cmake/tpl/SundialsPOSIXTimers.cmake | 36 +- cmake/tpl/SundialsRAJA.cmake | 71 ++-- cmake/tpl/SundialsSuperLUDIST.cmake | 48 ++- cmake/tpl/SundialsSuperLUMT.cmake | 30 +- cmake/tpl/SundialsTrilinos.cmake | 101 +++-- cmake/tpl/SundialsXBRAID.cmake | 31 +- .../developers/style_guide/SourceCode.rst | 20 +- examples/CMakeLists.txt | 15 +- examples/arkode/CMakeLists.txt | 9 +- examples/arkode/CXX_parallel/CMakeLists.txt | 121 +++--- examples/arkode/CXX_parhyp/CMakeLists.txt | 60 ++- examples/arkode/CXX_serial/CMakeLists.txt | 86 ++-- .../arkode/CXX_superludist/CMakeLists.txt | 34 +- examples/arkode/CXX_xbraid/CMakeLists.txt | 76 ++-- examples/arkode/C_manyvector/CMakeLists.txt | 42 +- examples/arkode/C_openmp/CMakeLists.txt | 55 +-- examples/arkode/C_openmpdev/CMakeLists.txt | 44 +- examples/arkode/C_parallel/CMakeLists.txt | 65 ++- examples/arkode/C_parhyp/CMakeLists.txt | 44 +- examples/arkode/C_petsc/CMakeLists.txt | 42 +- examples/arkode/C_serial/CMakeLists.txt | 236 +++++------ examples/arkode/F2003_custom/CMakeLists.txt | 70 ++-- examples/arkode/F2003_parallel/CMakeLists.txt | 94 +++-- examples/arkode/F2003_serial/CMakeLists.txt | 101 +++-- examples/cvode/CMakeLists.txt | 4 +- examples/cvode/CXX_onemkl/CMakeLists.txt | 43 +- examples/cvode/CXX_parallel/CMakeLists.txt | 50 +-- examples/cvode/CXX_parhyp/CMakeLists.txt | 56 ++- examples/cvode/CXX_serial/CMakeLists.txt | 58 +-- examples/cvode/CXX_sycl/CMakeLists.txt | 35 +- examples/cvode/C_mpimanyvector/CMakeLists.txt | 39 +- examples/cvode/C_openmp/CMakeLists.txt | 42 +- examples/cvode/C_openmpdev/CMakeLists.txt | 39 +- examples/cvode/F2003_parallel/CMakeLists.txt | 52 +-- examples/cvode/F2003_serial/CMakeLists.txt | 82 ++-- examples/cvode/cuda/CMakeLists.txt | 60 ++- examples/cvode/ginkgo/CMakeLists.txt | 39 +- examples/cvode/hip/CMakeLists.txt | 42 +- examples/cvode/kokkos/CMakeLists.txt | 63 ++- examples/cvode/magma/CMakeLists.txt | 39 +- examples/cvode/parallel/CMakeLists.txt | 44 +- examples/cvode/parhyp/CMakeLists.txt | 48 +-- examples/cvode/petsc/CMakeLists.txt | 41 +- examples/cvode/raja/CMakeLists.txt | 58 +-- examples/cvode/serial/CMakeLists.txt | 144 +++---- examples/cvode/superludist/CMakeLists.txt | 44 +- examples/cvodes/CMakeLists.txt | 2 +- examples/cvodes/C_openmp/CMakeLists.txt | 46 +-- examples/cvodes/F2003_serial/CMakeLists.txt | 46 +-- examples/cvodes/parallel/CMakeLists.txt | 59 ++- examples/cvodes/serial/CMakeLists.txt | 180 ++++----- examples/ida/CMakeLists.txt | 4 +- examples/ida/C_openmp/CMakeLists.txt | 43 +- examples/ida/F2003_openmp/CMakeLists.txt | 52 +-- examples/ida/F2003_parallel/CMakeLists.txt | 52 +-- examples/ida/F2003_serial/CMakeLists.txt | 47 +-- examples/ida/cuda/CMakeLists.txt | 42 +- examples/ida/mpicuda/CMakeLists.txt | 44 +- examples/ida/mpiraja/CMakeLists.txt | 60 ++- examples/ida/parallel/CMakeLists.txt | 44 +- examples/ida/petsc/CMakeLists.txt | 50 +-- examples/ida/raja/CMakeLists.txt | 56 +-- examples/ida/serial/CMakeLists.txt | 121 +++--- examples/ida/trilinos/CMakeLists.txt | 50 +-- examples/idas/CMakeLists.txt | 2 +- examples/idas/C_openmp/CMakeLists.txt | 55 +-- examples/idas/F2003_serial/CMakeLists.txt | 47 +-- examples/idas/parallel/CMakeLists.txt | 57 ++- examples/idas/serial/CMakeLists.txt | 138 +++---- examples/kinsol/CMakeLists.txt | 8 +- examples/kinsol/CUDA_mpi/CMakeLists.txt | 48 +-- examples/kinsol/CXX_parallel/CMakeLists.txt | 48 +-- examples/kinsol/CXX_parhyp/CMakeLists.txt | 58 ++- examples/kinsol/C_openmp/CMakeLists.txt | 42 +- examples/kinsol/F2003_parallel/CMakeLists.txt | 49 +-- examples/kinsol/F2003_serial/CMakeLists.txt | 47 +-- examples/kinsol/parallel/CMakeLists.txt | 41 +- examples/kinsol/serial/CMakeLists.txt | 116 +++--- examples/nvector/CMakeLists.txt | 10 +- examples/nvector/C_openmp/CMakeLists.txt | 77 ++-- examples/nvector/cuda/CMakeLists.txt | 57 ++- examples/nvector/hip/CMakeLists.txt | 42 +- examples/nvector/kokkos/CMakeLists.txt | 48 +-- examples/nvector/manyvector/CMakeLists.txt | 74 ++-- examples/nvector/mpicuda/CMakeLists.txt | 62 ++- examples/nvector/mpimanyvector/CMakeLists.txt | 93 +++-- examples/nvector/mpiplusx/CMakeLists.txt | 94 ++--- examples/nvector/mpiraja/CMakeLists.txt | 69 ++-- examples/nvector/openmpdev/CMakeLists.txt | 53 +-- examples/nvector/parallel/CMakeLists.txt | 97 ++--- examples/nvector/parhyp/CMakeLists.txt | 61 ++- examples/nvector/petsc/CMakeLists.txt | 64 ++- examples/nvector/pthreads/CMakeLists.txt | 80 ++-- examples/nvector/raja/CMakeLists.txt | 53 +-- examples/nvector/serial/CMakeLists.txt | 72 ++-- examples/nvector/sycl/CMakeLists.txt | 42 +- examples/nvector/trilinos/CMakeLists.txt | 78 ++-- examples/sunlinsol/CMakeLists.txt | 6 +- examples/sunlinsol/band/CMakeLists.txt | 92 ++--- examples/sunlinsol/cusolversp/CMakeLists.txt | 65 ++- examples/sunlinsol/dense/CMakeLists.txt | 90 ++--- examples/sunlinsol/ginkgo/CMakeLists.txt | 45 +-- examples/sunlinsol/klu/CMakeLists.txt | 87 ++-- examples/sunlinsol/kokkos/CMakeLists.txt | 63 ++- examples/sunlinsol/lapackband/CMakeLists.txt | 66 ++- examples/sunlinsol/lapackdense/CMakeLists.txt | 99 ++--- examples/sunlinsol/magmadense/CMakeLists.txt | 58 ++- examples/sunlinsol/onemkldense/CMakeLists.txt | 57 ++- .../sunlinsol/pcg/parallel/CMakeLists.txt | 56 +-- examples/sunlinsol/pcg/serial/CMakeLists.txt | 84 ++-- .../sunlinsol/spbcgs/parallel/CMakeLists.txt | 56 ++- .../sunlinsol/spbcgs/serial/CMakeLists.txt | 81 ++-- .../sunlinsol/spfgmr/parallel/CMakeLists.txt | 56 ++- .../sunlinsol/spfgmr/serial/CMakeLists.txt | 82 ++-- .../sunlinsol/spgmr/parallel/CMakeLists.txt | 59 ++- .../sunlinsol/spgmr/serial/CMakeLists.txt | 85 ++-- .../sunlinsol/sptfqmr/parallel/CMakeLists.txt | 59 ++- .../sunlinsol/sptfqmr/serial/CMakeLists.txt | 79 ++-- examples/sunlinsol/superludist/CMakeLists.txt | 70 ++-- examples/sunlinsol/superlumt/CMakeLists.txt | 70 ++-- examples/sunmatrix/CMakeLists.txt | 6 +- examples/sunmatrix/band/CMakeLists.txt | 87 ++-- examples/sunmatrix/cusparse/CMakeLists.txt | 60 ++- examples/sunmatrix/dense/CMakeLists.txt | 86 ++-- examples/sunmatrix/ginkgo/CMakeLists.txt | 42 +- examples/sunmatrix/kokkos/CMakeLists.txt | 66 ++- examples/sunmatrix/magmadense/CMakeLists.txt | 63 ++- examples/sunmatrix/onemkldense/CMakeLists.txt | 61 ++- examples/sunmatrix/slunrloc/CMakeLists.txt | 68 ++-- examples/sunmatrix/sparse/CMakeLists.txt | 94 ++--- examples/sunnonlinsol/CMakeLists.txt | 4 +- .../sunnonlinsol/fixedpoint/CMakeLists.txt | 67 ++-- examples/sunnonlinsol/newton/CMakeLists.txt | 67 ++-- examples/sunnonlinsol/petsc/CMakeLists.txt | 44 +- scripts/format.sh | 11 +- src/arkode/CMakeLists.txt | 101 +++-- src/arkode/fmod_int32/CMakeLists.txt | 19 +- src/arkode/fmod_int64/CMakeLists.txt | 19 +- src/arkode/xbraid/CMakeLists.txt | 29 +- src/cvode/CMakeLists.txt | 125 +++--- src/cvode/fmod_int32/CMakeLists.txt | 19 +- src/cvode/fmod_int64/CMakeLists.txt | 19 +- src/cvodes/CMakeLists.txt | 62 ++- src/cvodes/fmod_int32/CMakeLists.txt | 19 +- src/cvodes/fmod_int64/CMakeLists.txt | 19 +- src/ida/CMakeLists.txt | 40 +- src/ida/fmod_int32/CMakeLists.txt | 19 +- src/ida/fmod_int64/CMakeLists.txt | 19 +- src/idas/CMakeLists.txt | 52 +-- src/idas/fmod_int32/CMakeLists.txt | 19 +- src/idas/fmod_int64/CMakeLists.txt | 19 +- src/kinsol/CMakeLists.txt | 38 +- src/kinsol/fmod_int32/CMakeLists.txt | 19 +- src/kinsol/fmod_int64/CMakeLists.txt | 19 +- src/nvector/CMakeLists.txt | 24 +- src/nvector/cuda/CMakeLists.txt | 28 +- src/nvector/hip/CMakeLists.txt | 31 +- src/nvector/manyvector/CMakeLists.txt | 53 +-- .../manyvector/fmod_int32/CMakeLists.txt | 38 +- .../manyvector/fmod_int64/CMakeLists.txt | 38 +- src/nvector/mpiplusx/CMakeLists.txt | 28 +- .../mpiplusx/fmod_int32/CMakeLists.txt | 19 +- .../mpiplusx/fmod_int64/CMakeLists.txt | 19 +- src/nvector/openmp/CMakeLists.txt | 28 +- src/nvector/openmp/fmod_int32/CMakeLists.txt | 19 +- src/nvector/openmp/fmod_int64/CMakeLists.txt | 19 +- src/nvector/openmpdev/CMakeLists.txt | 28 +- src/nvector/parallel/CMakeLists.txt | 25 +- .../parallel/fmod_int32/CMakeLists.txt | 19 +- .../parallel/fmod_int64/CMakeLists.txt | 19 +- src/nvector/parhyp/CMakeLists.txt | 30 +- src/nvector/petsc/CMakeLists.txt | 28 +- src/nvector/pthreads/CMakeLists.txt | 28 +- .../pthreads/fmod_int32/CMakeLists.txt | 19 +- .../pthreads/fmod_int64/CMakeLists.txt | 19 +- src/nvector/raja/CMakeLists.txt | 47 +-- src/nvector/serial/CMakeLists.txt | 25 +- src/nvector/serial/fmod_int32/CMakeLists.txt | 19 +- src/nvector/serial/fmod_int64/CMakeLists.txt | 19 +- src/nvector/sycl/CMakeLists.txt | 31 +- src/nvector/trilinos/CMakeLists.txt | 42 +- src/sunadaptcontroller/imexgus/CMakeLists.txt | 15 +- .../imexgus/fmod_int32/CMakeLists.txt | 14 +- .../imexgus/fmod_int64/CMakeLists.txt | 14 +- .../soderlind/CMakeLists.txt | 15 +- .../soderlind/fmod_int32/CMakeLists.txt | 15 +- .../soderlind/fmod_int64/CMakeLists.txt | 15 +- src/sundials/CMakeLists.txt | 154 ++++--- src/sundials/fmod_int32/CMakeLists.txt | 10 +- src/sundials/fmod_int64/CMakeLists.txt | 10 +- src/sunlinsol/CMakeLists.txt | 40 +- src/sunlinsol/band/CMakeLists.txt | 28 +- src/sunlinsol/band/fmod_int32/CMakeLists.txt | 19 +- src/sunlinsol/band/fmod_int64/CMakeLists.txt | 22 +- src/sunlinsol/cusolversp/CMakeLists.txt | 27 +- src/sunlinsol/dense/CMakeLists.txt | 28 +- src/sunlinsol/dense/fmod_int32/CMakeLists.txt | 19 +- src/sunlinsol/dense/fmod_int64/CMakeLists.txt | 22 +- src/sunlinsol/klu/CMakeLists.txt | 28 +- src/sunlinsol/klu/fmod_int32/CMakeLists.txt | 22 +- src/sunlinsol/klu/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/lapackband/CMakeLists.txt | 28 +- src/sunlinsol/lapackdense/CMakeLists.txt | 28 +- .../lapackdense/fmod_int32/CMakeLists.txt | 19 +- .../lapackdense/fmod_int64/CMakeLists.txt | 22 +- src/sunlinsol/magmadense/CMakeLists.txt | 28 +- src/sunlinsol/onemkldense/CMakeLists.txt | 35 +- src/sunlinsol/pcg/CMakeLists.txt | 25 +- src/sunlinsol/pcg/fmod_int32/CMakeLists.txt | 19 +- src/sunlinsol/pcg/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/spbcgs/CMakeLists.txt | 25 +- .../spbcgs/fmod_int32/CMakeLists.txt | 19 +- .../spbcgs/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/spfgmr/CMakeLists.txt | 25 +- .../spfgmr/fmod_int32/CMakeLists.txt | 19 +- .../spfgmr/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/spgmr/CMakeLists.txt | 25 +- src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt | 19 +- src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/sptfqmr/CMakeLists.txt | 25 +- .../sptfqmr/fmod_int32/CMakeLists.txt | 19 +- .../sptfqmr/fmod_int64/CMakeLists.txt | 19 +- src/sunlinsol/superludist/CMakeLists.txt | 35 +- src/sunlinsol/superlumt/CMakeLists.txt | 33 +- src/sunmatrix/CMakeLists.txt | 40 +- src/sunmatrix/band/CMakeLists.txt | 25 +- src/sunmatrix/band/fmod_int32/CMakeLists.txt | 19 +- src/sunmatrix/band/fmod_int64/CMakeLists.txt | 19 +- src/sunmatrix/cusparse/CMakeLists.txt | 31 +- src/sunmatrix/dense/CMakeLists.txt | 25 +- src/sunmatrix/dense/fmod_int32/CMakeLists.txt | 19 +- src/sunmatrix/dense/fmod_int64/CMakeLists.txt | 19 +- src/sunmatrix/magmadense/CMakeLists.txt | 40 +- src/sunmatrix/onemkldense/CMakeLists.txt | 37 +- src/sunmatrix/slunrloc/CMakeLists.txt | 33 +- src/sunmatrix/sparse/CMakeLists.txt | 25 +- .../sparse/fmod_int32/CMakeLists.txt | 19 +- .../sparse/fmod_int64/CMakeLists.txt | 19 +- src/sunmemory/cuda/CMakeLists.txt | 18 +- src/sunmemory/hip/CMakeLists.txt | 19 +- src/sunmemory/sycl/CMakeLists.txt | 18 +- src/sunmemory/system/CMakeLists.txt | 18 +- src/sunnonlinsol/fixedpoint/CMakeLists.txt | 25 +- .../fixedpoint/fmod_int32/CMakeLists.txt | 19 +- .../fixedpoint/fmod_int64/CMakeLists.txt | 19 +- src/sunnonlinsol/newton/CMakeLists.txt | 25 +- .../newton/fmod_int32/CMakeLists.txt | 19 +- .../newton/fmod_int64/CMakeLists.txt | 19 +- src/sunnonlinsol/petscsnes/CMakeLists.txt | 28 +- test/unit_tests/arkode/CMakeLists.txt | 1 - .../arkode/CXX_parallel/CMakeLists.txt | 33 +- .../arkode/CXX_serial/CMakeLists.txt | 71 ++-- .../unit_tests/arkode/C_serial/CMakeLists.txt | 49 ++- .../arkode/F2003_serial/CMakeLists.txt | 14 +- test/unit_tests/arkode/gtest/CMakeLists.txt | 50 +-- test/unit_tests/cvode/CMakeLists.txt | 2 +- .../cvode/CXX_serial/CMakeLists.txt | 46 +-- test/unit_tests/cvode/C_serial/CMakeLists.txt | 22 +- test/unit_tests/cvode/gtest/CMakeLists.txt | 48 +-- .../cvodes/CXX_serial/CMakeLists.txt | 46 +-- .../unit_tests/cvodes/C_serial/CMakeLists.txt | 22 +- test/unit_tests/cvodes/gtest/CMakeLists.txt | 46 +-- test/unit_tests/ida/CXX_serial/CMakeLists.txt | 40 +- test/unit_tests/ida/C_serial/CMakeLists.txt | 22 +- test/unit_tests/ida/gtest/CMakeLists.txt | 46 +-- .../unit_tests/idas/CXX_serial/CMakeLists.txt | 38 +- test/unit_tests/idas/C_serial/CMakeLists.txt | 22 +- test/unit_tests/idas/gtest/CMakeLists.txt | 47 +-- .../kinsol/CXX_serial/CMakeLists.txt | 25 +- .../unit_tests/kinsol/C_serial/CMakeLists.txt | 21 +- test/unit_tests/kinsol/gtest/CMakeLists.txt | 46 +-- test/unit_tests/profiling/CMakeLists.txt | 15 +- test/unit_tests/sundials/CMakeLists.txt | 5 +- .../sundials/reductions/CMakeLists.txt | 11 +- test/unit_tests/sunmemory/CMakeLists.txt | 1 - test/unit_tests/sunmemory/cuda/CMakeLists.txt | 15 +- test/unit_tests/sunmemory/hip/CMakeLists.txt | 15 +- test/unit_tests/sunmemory/sycl/CMakeLists.txt | 15 +- test/unit_tests/sunmemory/sys/CMakeLists.txt | 15 +- 348 files changed, 7792 insertions(+), 8726 deletions(-) create mode 100644 .cmake-format.py rename .github/workflows/{check-clang-format.yml => check-format.yml} (71%) diff --git a/.cmake-format.py b/.cmake-format.py new file mode 100644 index 0000000000..c6d5938ef6 --- /dev/null +++ b/.cmake-format.py @@ -0,0 +1,330 @@ +# ---------------------------------- +# Options affecting listfile parsing +# ---------------------------------- +with section("parse"): + + # Specify structure for custom cmake functions + additional_commands = { + 'add_prefix': {'pargs': {'nargs': 2}}, + 'add_suffix': {'pargs': {'nargs': 2}}, + 'append_static_suffix': {'pargs': {'nargs': 2}}, + 'examples2string': {'pargs': {'nargs': 2}}, + 'force_variable': {'pargs': {'nargs': 4}}, + 'list2string': {'pargs': {'nargs': 2}}, + 'sundials_add_benchmark': { 'kwargs': { 'BENCHMARK_ARGS': 1, + 'IDENTIFIER': 1, + 'NUM_CORES': 1, + 'TEST_RUNNER_ARGS': '+'}, + 'pargs': { 'flags': ['ENABLE_GPU'], + 'nargs': '3+'}}, + 'sundials_add_examples_ginkgo': { 'kwargs': {'BACKENDS': '+', 'TARGETS': '+'}, + 'pargs': { 'flags': ['UNIT_TEST'], + 'nargs': '1+'}}, + 'sundials_add_f2003_library': { 'kwargs': { 'COMPILE_DEFINITIONS': '+', + 'COMPILE_OPTIONS': '+', + 'INCLUDE_DIRECTORIES': '+', + 'LINK_LIBRARIES': '+', + 'OBJECT_LIBRARIES': '+', + 'OUTPUT_NAME': 1, + 'PROPERTIES': '+', + 'SOURCES': '+', + 'SOVERSION': 1, + 'VERSION': 1}, + 'pargs': {'flags': [], 'nargs': '1+'}}, + 'sundials_add_library': { 'kwargs': { 'COMPILE_DEFINITIONS': '+', + 'COMPILE_FEATURES': '+', + 'COMPILE_OPTIONS': '+', + 'HEADERS': '+', + 'INCLUDE_DIRECTORIES': '+', + 'INCLUDE_SUBDIR': 1, + 'LINK_LIBRARIES': '+', + 'OBJECT_LIBRARIES': '+', + 'OUTPUT_NAME': 1, + 'PROPERTIES': '+', + 'SOURCES': '+', + 'SOVERSION': 1, + 'VERSION': 1}, + 'pargs': { 'flags': [ 'STATIC_ONLY', + 'SHARED_ONLY', + 'OBJECT_LIB_ONLY'], + 'nargs': '1+'}}, + 'sundials_add_nvector_benchmark': { 'kwargs': { 'INSTALL_SUBDIR': '+', + 'LINK_LIBRARIES': '+', + 'SOURCES': '+', + 'SUNDIALS_TARGETS': '+'}, + 'pargs': {'flags': [], 'nargs': '1+'}}, + 'sundials_add_test': { 'kwargs': { 'ANSWER_DIR': 1, + 'ANSWER_FILE': 1, + 'EXAMPLE_TYPE': 1, + 'EXTRA_ARGS': '+', + 'FLOAT_PRECISION': 1, + 'INTEGER_PRECISION': 1, + 'MPI_NPROCS': 1, + 'TEST_ARGS': '+'}, + 'pargs': {'flags': ['NODIFF'], 'nargs': '2+'}}, + 'sundials_add_test_install': { 'kwargs': {'EXECUTABLE': 1}, + 'pargs': {'flags': [], 'nargs': '2+'}}, + 'sundials_git_version': {'pargs': {'nargs': 0}}, + 'sundials_install_examples': { 'kwargs': { 'CMAKE_TEMPLATE': 1, + 'DESTINATION': 1, + 'EXAMPLES_DEPENDENCIES': '+', + 'EXTRA_FILES': '+', + 'EXTRA_INCLUDES': '+', + 'MAKE_TEMPLATE': 1, + 'OTHER_TARGETS': '+', + 'SOLVER_LIBRARY': 1, + 'SUNDIALS_COMPONENTS': '+', + 'SUNDIALS_TARGETS': '+', + 'TEST_INSTALL': 1}, + 'pargs': {'flags': [], 'nargs': '2+'}}, + 'sundials_install_examples_ginkgo': { 'kwargs': { 'CPU_EXAMPLES_VAR': '+', + 'CPU_GPU_EXAMPLES_VAR': '+', + 'DEPENDENCIES': '+', + 'DESTINATION': 1, + 'EXTRA_FILES': '+', + 'GPU_EXAMPLES_VAR': '+', + 'SUNDIALS_COMPONENTS': '+', + 'SUNDIALS_TARGETS': '+'}, + 'pargs': {'flags': [], 'nargs': '1+'}}, + 'sundials_option': { 'kwargs': {'DEPENDS_ON': '+', 'OPTIONS': '+'}, + 'pargs': { 'flags': [ 'DEPENDS_ON_THROW_ERROR', + 'ADVANCED'], + 'nargs': '4+'}}, + 'sundials_trycompile_execute': { 'kwargs': { 'COMPILE_OUTPUT': 1, + 'RUN_OUTPUT': 1}, + 'pargs': {'flags': [], 'nargs': '4+'}}, + 'add_local_ci_target': {'pargs': {'nargs': 3}} + } + + # Override configurations per-command where available + override_spec = {} + + # Specify variable tags. + vartags = [] + + # Specify property tags. + proptags = [] + +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + + # Disable formatting entirely, making cmake-format a no-op + disable = False + + # How wide to allow formatted cmake files + line_width = 80 + + # How many spaces to tab for indent + tab_size = 2 + + # If true, lines are indented using tab characters (utf-8 0x09) instead of + # space characters (utf-8 0x20). In cases where the layout would + # require a fractional tab character, the behavior of the fractional + # indentation is governed by + use_tabchars = False + + # If is True, then the value of this variable indicates how + # fractional indentions are handled during whitespace replacement. If set to + # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set + # to `round-up` fractional indentation is replaced with a single tab character + # (utf-8 0x09) effectively shifting the column to the next tabstop + fractional_tab_policy = 'use-space' + + # If an argument group contains more than this many sub-groups (parg or kwarg + # groups) then force it to a vertical layout. + max_subgroups_hwrap = 2 + + # If a positional argument group contains more than this many arguments, then + # force it to a vertical layout. + max_pargs_hwrap = 6 + + # If a cmdline positional group consumes more than this many lines without + # nesting, then invalidate the layout (and nest) + max_rows_cmdline = 2 + + # If true, separate flow control names from their parentheses with a space + separate_ctrl_name_with_space = False + + # If true, separate function names from parentheses with a space + separate_fn_name_with_space = False + + # If a statement is wrapped to more than one line, than dangle the closing + # parenthesis on its own line. + dangle_parens = False + + # If the trailing parenthesis must be 'dangled' on its on line, then align it + # to this reference: `prefix`: the start of the statement, `prefix-indent`: + # the start of the statement, plus one indentation level, `child`: align to + # the column of the arguments + dangle_align = 'prefix' + + # If the statement spelling length (including space and parenthesis) is + # smaller than this amount, then force reject nested layouts. + min_prefix_chars = 4 + + # If the statement spelling length (including space and parenthesis) is larger + # than the tab width by more than this amount, then force reject un-nested + # layouts. + max_prefix_chars = 10 + + # If a candidate layout is wrapped horizontally but it exceeds this many + # lines, then reject the layout. + max_lines_hwrap = 2 + + # What style line endings to use in the output. + line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case + command_case = 'canonical' + + # Format keywords consistently as 'lower' or 'upper' case + keyword_case = 'unchanged' + + # A list of command names which should always be wrapped + always_wrap = [] + + # If true, the argument lists which are known to be sortable will be sorted + # lexicographicall + enable_sort = True + + # If true, the parsers may infer whether or not an argument list is sortable + # (without annotation). + autosort = False + + # By default, if cmake-format cannot successfully fit everything into the + # desired linewidth it will apply the last, most agressive attempt that it + # made. If this flag is True, however, cmake-format will print error, exit + # with non-zero status code, and write-out nothing + require_valid_layout = False + + # A dictionary mapping layout nodes to a list of wrap decisions. See the + # documentation for more information. + layout_passes = {} + +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + + # What character to use for bulleted lists + bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list + enum_char = '.' + + # If comment markup is enabled, don't reflow the first comment block in each + # listfile. Use this to preserve formatting of your copyright/license + # statements. + first_comment_is_literal = True + + # If comment markup is enabled, don't reflow any comment block which matches + # this (regex) pattern. Default is `None` (disabled). + literal_comment_pattern = None + + # Regular expression to match preformat fences in comments default= + # ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' + + # Regular expression to match rulers in comments default= + # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` + ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' + + # If a comment line matches starts with this pattern then it is explicitly a + # trailing comment for the preceeding argument. Default is '#<' + explicit_trailing_pattern = '#<' + + # If a comment line starts with at least this many consecutive hash + # characters, then don't lstrip() them off. This allows for lazy hash rulers + # where the first hash char is not separated by space + hashruler_min_length = 10 + + # If true, then insert a space between the first hash char and remaining hash + # chars in a hash ruler, and normalize its length to fill the column + canonicalize_hashrulers = True + + # enable comment markup parsing and reflow + enable_markup = True + +# ---------------------------- +# Options affecting the linter +# ---------------------------- +with section("lint"): + + # a list of lint codes to disable + disabled_codes = [] + + # regular expression pattern describing valid function names + function_pattern = '[0-9a-z_]+' + + # regular expression pattern describing valid macro names + macro_pattern = '[0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # (cache) scope + global_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # scope (but internal semantic) + internal_var_pattern = '_[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with local + # scope + local_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for privatedirectory + # variables + private_var_pattern = '_[0-9a-z_]+' + + # regular expression pattern describing valid names for public directory + # variables + public_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for function/macro + # arguments and loop variables. + argument_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for keywords used in + # functions or macros + keyword_pattern = '[A-Z][0-9A-Z_]+' + + # In the heuristic for C0201, how many conditionals to match within a loop in + # before considering the loop a parser. + max_conditionals_custom_parser = 2 + + # Require at least this many newlines between statements + min_statement_spacing = 1 + + # Require no more than this many newlines between statements + max_statement_spacing = 2 + max_returns = 6 + max_branches = 12 + max_arguments = 5 + max_localvars = 15 + max_statements = 50 + +# ------------------------------- +# Options affecting file encoding +# ------------------------------- +with section("encode"): + + # If true, emit the unicode byte-order mark (BOM) at the start of the file + emit_byteorder_mark = False + + # Specify the encoding of the input file. Defaults to utf-8 + input_encoding = 'utf-8' + + # Specify the encoding of the output file. Defaults to utf-8. Note that cmake + # only claims to support utf-8 so be careful when using anything else + output_encoding = 'utf-8' + +# ------------------------------------- +# Miscellaneous configurations options. +# ------------------------------------- +with section("misc"): + + # A dictionary containing any per-command configuration overrides. Currently + # only `command_case` is supported. + per_command = {} + diff --git a/.github/workflows/check-clang-format.yml b/.github/workflows/check-format.yml similarity index 71% rename from .github/workflows/check-clang-format.yml rename to .github/workflows/check-format.yml index 24f44b45ee..b3d0850ca9 100644 --- a/.github/workflows/check-clang-format.yml +++ b/.github/workflows/check-format.yml @@ -1,11 +1,11 @@ -name: Checks - clang-format +name: Checks - formatting on: pull_request: workflow_dispatch: jobs: - clang_format_check: + format_check: runs-on: ubuntu-latest container: image: ghcr.io/llnl/sundials_spack_cache:llvm-17.0.4-h4lflucc3v2vage45opbo2didtcuigsn.spack @@ -21,9 +21,21 @@ jobs: - name: Print black version run: black --version + - name: Install cmake-format + run: pip install cmakelang + + - name: Print cmake-format version + run: cmake-format --version + - name: Install fprettify run: pip install fprettify + - name: Print fprettify version + run: fprettify --version + + - name: Print clang-format version + run: clang-format --version + - name: Check out repository code uses: actions/checkout@v4 with: @@ -32,24 +44,21 @@ jobs: - name: Add safe directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - name: Print clang-format version - run: clang-format --version - - name: Run checker on code run: | - ./scripts/format.sh benchmarks examples include src test + ./scripts/format.sh CMakeLists.txt benchmarks cmake examples include src test - name: Run git diff to see if anything changed run: /usr/bin/git diff --name-only --exit-code - name: Run git diff if we failed if: failure() - run: /usr/bin/git diff > clang_format.patch + run: /usr/bin/git diff > format.patch - name: Archive diff as a patch if we failed uses: actions/upload-artifact@v3 if: failure() with: - name: clang_format.patch + name: format.patch path: | - ${{ github.workspace }}/clang_format.patch + ${{ github.workspace }}/format.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index b5cca95afd..989c1d7f7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,17 +26,14 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24") cmake_policy(SET CMP0135 NEW) endif() -# Project SUNDIALS (initially only C supported) -# sets PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR variables. +# Project SUNDIALS (initially only C supported) sets PROJECT_SOURCE_DIR and +# PROJECT_BINARY_DIR variables. project(SUNDIALS C) # Specify the location of additional CMAKE modules set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - ${PROJECT_SOURCE_DIR}/cmake - ${PROJECT_SOURCE_DIR}/cmake/macros - ${PROJECT_SOURCE_DIR}/cmake/tpl - ) + ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake + ${PROJECT_SOURCE_DIR}/cmake/macros ${PROJECT_SOURCE_DIR}/cmake/tpl) # MACRO definitions include(SundialsCMakeMacros) @@ -44,7 +41,6 @@ include(CMakePrintHelpers) include(CheckCSourceCompiles) include(FindPackageHandleStandardArgs) - # Set some variables with info on the SUNDIALS project set(PACKAGE_BUGREPORT "sundials-users@llnl.gov") set(PACKAGE_NAME "SUNDIALS") @@ -123,9 +119,9 @@ endif() # Organize targets into folders when using an IDE set_property(GLOBAL PROPERTY USE_FOLDERS ON) -# Get correct build paths automatically, but expose LIBDIR and -# INCLUDEDIR as a regular cache variable so that a user can more -# easily see what they were set to by GNUInstallDirs. +# Get correct build paths automatically, but expose LIBDIR and INCLUDEDIR as a +# regular cache variable so that a user can more easily see what they were set +# to by GNUInstallDirs. include(GNUInstallDirs) mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR) mark_as_advanced(CLEAR CMAKE_INSTALL_INCLUDEDIR) @@ -133,23 +129,28 @@ mark_as_advanced(CLEAR CMAKE_INSTALL_INCLUDEDIR) # Suffixes to use for static and shared targets. set(_STATIC_LIB_SUFFIX "_static" - CACHE INTERNAL "" FORCE -) + CACHE INTERNAL "" FORCE) set(_SHARED_LIB_SUFFIX "_shared" - CACHE INTERNAL "" FORCE -) + CACHE INTERNAL "" FORCE) # A list of all the alias targets created. -set(_SUNDIALS_ALIAS_TARGETS "" +set(_SUNDIALS_ALIAS_TARGETS + "" CACHE INTERNAL "" FORCE) # We default to release builds set(_DEFAULT_CMAKE_BUILD_TYPE RelWithDebInfo) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Building SUNDIALS in '${_DEFAULT_CMAKE_BUILD_TYPE}' mode as CMAKE_BUILD_TYPE was not specified.") - set(CMAKE_BUILD_TYPE "${_DEFAULT_CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + message( + STATUS + "Building SUNDIALS in '${_DEFAULT_CMAKE_BUILD_TYPE}' mode as CMAKE_BUILD_TYPE was not specified." + ) + set(CMAKE_BUILD_TYPE + "${_DEFAULT_CMAKE_BUILD_TYPE}" + CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") else() message(STATUS "Building SUNDIALS in '${CMAKE_BUILD_TYPE}' mode.") endif() @@ -192,8 +193,8 @@ include(SundialsSetupTPLs) include(SundialsBuildOptionsPost) # =============================================================== -# At this point all the configuration options are set. -# Setup the sundials_config.h. +# At this point all the configuration options are set. Setup the +# sundials_config.h. # =============================================================== include(SundialsSetupConfig) @@ -231,68 +232,56 @@ endif() # install sundials_export header file install(FILES "${PROJECT_BINARY_DIR}/include/sundials/sundials_export.h" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials" -) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials") # install configured header file install(FILES "${PROJECT_BINARY_DIR}/include/sundials/sundials_config.h" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials" -) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials") # install shared Fortran 2003 modules if(BUILD_FORTRAN_MODULE_INTERFACE) - # While the .mod files get generated for static and shared - # libraries, they are identical. So only install one set - # of the .mod files. + # While the .mod files get generated for static and shared libraries, they are + # identical. So only install one set of the .mod files. if(BUILD_STATIC_LIBS) install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}_STATIC/ - DESTINATION ${Fortran_INSTALL_MODDIR} - ) + DESTINATION ${Fortran_INSTALL_MODDIR}) else() install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}_SHARED/ - DESTINATION ${Fortran_INSTALL_MODDIR} - ) + DESTINATION ${Fortran_INSTALL_MODDIR}) endif() endif() # install license and notice files install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials" -) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials") install(FILES "${PROJECT_SOURCE_DIR}/NOTICE" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials" -) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials") # create package version file include(CMakePackageConfigHelpers) write_basic_package_version_file( SUNDIALSConfigVersion.cmake VERSION ${PACKAGE_VERSION} - COMPATIBILITY AnyNewerVersion -) + COMPATIBILITY AnyNewerVersion) # install targets install( EXPORT sundials-targets FILE SUNDIALSTargets.cmake NAMESPACE SUNDIALS:: - DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}" -) + DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}") # install SUNDIALSConfig.cmake configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/SUNDIALSConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfig.cmake" - INSTALL_DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}" -) + INSTALL_DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSConfigVersion.cmake" - DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}" -) + DESTINATION "${SUNDIALS_INSTALL_CMAKEDIR}") # Export targets so build directory can be used directly export( EXPORT sundials-targets FILE "${CMAKE_CURRENT_BINARY_DIR}/SUNDIALSTargets.cmake" - NAMESPACE SUNDIALS:: -) + NAMESPACE SUNDIALS::) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 980e1e230d..090c1f5b26 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -14,10 +14,10 @@ # benchmarks level CMakeLists.txt for SUNDIALS # --------------------------------------------------------------- -if(NOT (CMAKE_BUILD_TYPE STREQUAL "Release" OR - CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) +if(NOT (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL + "RelWithDebInfo")) message(WARNING "SUNDIALS is not being built in a \"Release\" mode, " - "benchmark performance will be affected") + "benchmark performance will be affected") endif() sundials_option(BENCHMARK_NVECTOR BOOL "NVector benchmarks are on" ON) @@ -28,13 +28,13 @@ if(ENABLE_ALL_WARNINGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") endif() -#---------------------------------------- +# ---------------------------------------- # Add specific benchmarks -#---------------------------------------- +# ---------------------------------------- if(ENABLE_MPI) -add_subdirectory(diffusion_2D) -add_subdirectory(advection_reaction_3D) + add_subdirectory(diffusion_2D) + add_subdirectory(advection_reaction_3D) endif() # Add the nvector benchmarks diff --git a/benchmarks/advection_reaction_3D/CMakeLists.txt b/benchmarks/advection_reaction_3D/CMakeLists.txt index 79c616818a..b4b953a437 100644 --- a/benchmarks/advection_reaction_3D/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/CMakeLists.txt @@ -19,4 +19,3 @@ endif() if(ENABLE_KOKKOS AND BUILD_NVECTOR_KOKKOS) add_subdirectory(kokkos) endif() - diff --git a/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt b/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt index 8a12ba022b..1bb7ac2c5e 100644 --- a/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt @@ -13,14 +13,17 @@ # --------------------------------------------------------------- # Add the build targets for each backend -if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) +if(BUILD_ARKODE + AND BUILD_CVODE + AND BUILD_IDA) foreach(backend ${KOKKOS_EXAMPLES_BACKENDS}) # set benchmark target name set(benchmark_target "advection_reaction_3D_kokkos.${backend}") # benchmark source files - add_executable(${benchmark_target} + add_executable( + ${benchmark_target} advection_reaction_3D.cpp arkode_driver.cpp cvode_driver.cpp @@ -29,32 +32,32 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) ParallelGrid.hpp check_retval.h) - # which backend to use - target_compile_definitions(${benchmark_target} PRIVATE USE_${backend}) - - # directories to include - target_include_directories(${benchmark_target} - PRIVATE - ${PROJECT_SOURCE_DIR}/utilities - ${MPI_CXX_INCLUDE_DIRS} - ) - - # libraries to link against - target_link_libraries(${benchmark_target} - PRIVATE - sundials_arkode - sundials_cvode - sundials_ida - sundials_nvecmpiplusx - sundials_nveckokkos - ${MPI_CXX_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS} - ) - - install(TARGETS ${benchmark_target} + # which backend to use + target_compile_definitions(${benchmark_target} PRIVATE USE_${backend}) + + # directories to include + target_include_directories( + ${benchmark_target} PRIVATE ${PROJECT_SOURCE_DIR}/utilities + ${MPI_CXX_INCLUDE_DIRS}) + + # libraries to link against + target_link_libraries( + ${benchmark_target} + PRIVATE sundials_arkode + sundials_cvode + sundials_ida + sundials_nvecmpiplusx + sundials_nveckokkos + ${MPI_CXX_LIBRARIES} + ${EXE_EXTRA_LINK_LIBS}) + + install( + TARGETS ${benchmark_target} DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/kokkos") - install(FILES README.md ../scripts/compare_error.py ../scripts/compute_error.py ../scripts/pickle_solution_output.py + install( + FILES README.md ../scripts/compare_error.py ../scripts/compute_error.py + ../scripts/pickle_solution_output.py DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/kokkos") endforeach() diff --git a/benchmarks/advection_reaction_3D/raja/CMakeLists.txt b/benchmarks/advection_reaction_3D/raja/CMakeLists.txt index d816b35124..264e023b5a 100644 --- a/benchmarks/advection_reaction_3D/raja/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/raja/CMakeLists.txt @@ -13,24 +13,28 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) +if(BUILD_ARKODE + AND BUILD_CVODE + AND BUILD_IDA) - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(OTHER_LIBS OpenMP::OpenMP_CXX) endif() # Set up parameters to run benchmarks with set(BENCHMARK_VAR - "--method ARK-IMEX --nls tl-newton --tf 0.01 --dont-save\;arkimex_tlnewton" - "--method ARK-DIRK --nls newton --tf 0.01 --dont-save\;arkdirk_newton" - "--method CV-BDF --nls newton --tf 0.01 --dont-save\;cvbdf_newton" - "--method IDA --nls newton --tf 0.01 --dont-save\;ida_newton") + "--method ARK-IMEX --nls tl-newton --tf 0.01 --dont-save\;arkimex_tlnewton" + "--method ARK-DIRK --nls newton --tf 0.01 --dont-save\;arkdirk_newton" + "--method CV-BDF --nls newton --tf 0.01 --dont-save\;cvbdf_newton" + "--method IDA --nls newton --tf 0.01 --dont-save\;ida_newton") # ---------------------------------------------------------------------------- # MPI only # ---------------------------------------------------------------------------- - add_executable(advection_reaction_3D_raja + add_executable( + advection_reaction_3D_raja advection_reaction_3D.cpp arkode_driver.cpp cvode_driver.cpp @@ -41,39 +45,41 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) backends.hpp) # ensure the linker language is reset to CXX - set_target_properties(advection_reaction_3D_raja PROPERTIES LINKER_LANGUAGE CXX) - - target_include_directories(advection_reaction_3D_raja - PRIVATE - ${PROJECT_SOURCE_DIR}/utilities - ${MPI_CXX_INCLUDE_DIRS}) - - target_link_libraries(advection_reaction_3D_raja - PRIVATE - sundials_arkode - sundials_cvode - sundials_ida - sundials_nvecmpiplusx - sundials_nvecserial - RAJA - ${MPI_CXX_LIBRARIES} - ${OTHER_LIBS}) + set_target_properties(advection_reaction_3D_raja PROPERTIES LINKER_LANGUAGE + CXX) + + target_include_directories( + advection_reaction_3D_raja PRIVATE ${PROJECT_SOURCE_DIR}/utilities + ${MPI_CXX_INCLUDE_DIRS}) + + target_link_libraries( + advection_reaction_3D_raja + PRIVATE sundials_arkode + sundials_cvode + sundials_ida + sundials_nvecmpiplusx + sundials_nvecserial + RAJA + ${MPI_CXX_LIBRARIES} + ${OTHER_LIBS}) install(TARGETS advection_reaction_3D_raja - DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") - install(FILES README.md ../scripts/compare_error.py ../scripts/compute_error.py ../scripts/pickle_solution_output.py - DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") + install(FILES README.md ../scripts/compare_error.py + ../scripts/compute_error.py ../scripts/pickle_solution_output.py + DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") foreach(benchmark_tuple ${BENCHMARK_VAR}) list(GET benchmark_tuple 0 benchmark_args) list(GET benchmark_tuple 1 identifier) - sundials_add_benchmark(advection_reaction_3D_raja advection_reaction_3D_raja advection_reaction_3D + sundials_add_benchmark( + advection_reaction_3D_raja advection_reaction_3D_raja + advection_reaction_3D NUM_CORES ${SUNDIALS_BENCHMARK_NUM_CPUS} BENCHMARK_ARGS ${benchmark_args} - IDENTIFIER ${identifier} - ) + IDENTIFIER ${identifier}) endforeach() # ---------------------------------------------------------------------------- @@ -82,13 +88,14 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) if(BUILD_NVECTOR_CUDA) - set_source_files_properties(advection_reaction_3D.cpp - PROPERTIES LANGUAGE CUDA) + set_source_files_properties(advection_reaction_3D.cpp PROPERTIES LANGUAGE + CUDA) set_source_files_properties(arkode_driver.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(cvode_driver.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(ida_driver.cpp PROPERTIES LANGUAGE CUDA) - add_executable(advection_reaction_3D_raja_mpicuda + add_executable( + advection_reaction_3D_raja_mpicuda advection_reaction_3D.cpp arkode_driver.cpp cvode_driver.cpp @@ -100,35 +107,36 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) # ensure the linker language is reset to CXX set_target_properties(advection_reaction_3D_raja_mpicuda - PROPERTIES LINKER_LANGUAGE CXX) - - target_include_directories(advection_reaction_3D_raja_mpicuda - PRIVATE - ${PROJECT_SOURCE_DIR}/utilities - ${MPI_CXX_INCLUDE_DIRS}) - - target_link_libraries(advection_reaction_3D_raja_mpicuda - PRIVATE - sundials_arkode - sundials_cvode - sundials_ida - sundials_nvecmpiplusx - sundials_nveccuda - RAJA - ${MPI_CXX_LIBRARIES} - ${OTHER_LIBS}) - - target_compile_definitions(advection_reaction_3D_raja_mpicuda PRIVATE USE_CUDA_NVEC) + PROPERTIES LINKER_LANGUAGE CXX) + + target_include_directories( + advection_reaction_3D_raja_mpicuda PRIVATE ${PROJECT_SOURCE_DIR}/utilities + ${MPI_CXX_INCLUDE_DIRS}) + + target_link_libraries( + advection_reaction_3D_raja_mpicuda + PRIVATE sundials_arkode + sundials_cvode + sundials_ida + sundials_nvecmpiplusx + sundials_nveccuda + RAJA + ${MPI_CXX_LIBRARIES} + ${OTHER_LIBS}) + + target_compile_definitions(advection_reaction_3D_raja_mpicuda + PRIVATE USE_CUDA_NVEC) install(TARGETS advection_reaction_3D_raja_mpicuda - DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") foreach(benchmark_tuple ${BENCHMARK_VAR}) list(GET benchmark_tuple 0 benchmark_args) list(GET benchmark_tuple 1 identifier) - sundials_add_benchmark(advection_reaction_3D_raja_mpicuda advection_reaction_3D_raja_mpicuda advection_reaction_3D - ENABLE_GPU + sundials_add_benchmark( + advection_reaction_3D_raja_mpicuda advection_reaction_3D_raja_mpicuda + advection_reaction_3D ENABLE_GPU NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} BENCHMARK_ARGS ${benchmark_args} IDENTIFIER ${identifier}) @@ -141,7 +149,8 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) if(BUILD_NVECTOR_HIP) - add_executable(advection_reaction_3D_raja_mpihip + add_executable( + advection_reaction_3D_raja_mpihip advection_reaction_3D.cpp advection_reaction_3D.hpp arkode_driver.cpp @@ -152,34 +161,35 @@ if(BUILD_ARKODE AND BUILD_CVODE AND BUILD_IDA) check_retval.h backends.hpp) - target_include_directories(advection_reaction_3D_raja_mpihip - PRIVATE - ${PROJECT_SOURCE_DIR}/utilities - ${MPI_CXX_INCLUDE_DIRS}) - - target_link_libraries(advection_reaction_3D_raja_mpihip - PRIVATE - sundials_arkode - sundials_cvode - sundials_ida - sundials_nvecmpiplusx - sundials_nvechip - RAJA - hip::device - ${MPI_CXX_LIBRARIES} - ${OTHER_LIBS}) - - target_compile_definitions(advection_reaction_3D_raja_mpihip PRIVATE USE_HIP_NVEC) + target_include_directories( + advection_reaction_3D_raja_mpihip PRIVATE ${PROJECT_SOURCE_DIR}/utilities + ${MPI_CXX_INCLUDE_DIRS}) + + target_link_libraries( + advection_reaction_3D_raja_mpihip + PRIVATE sundials_arkode + sundials_cvode + sundials_ida + sundials_nvecmpiplusx + sundials_nvechip + RAJA + hip::device + ${MPI_CXX_LIBRARIES} + ${OTHER_LIBS}) + + target_compile_definitions(advection_reaction_3D_raja_mpihip + PRIVATE USE_HIP_NVEC) install(TARGETS advection_reaction_3D_raja_mpihip - DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/advection_reaction_3D/raja") foreach(benchmark_tuple ${BENCHMARK_VAR}) list(GET benchmark_tuple 0 benchmark_args) list(GET benchmark_tuple 1 identifier) - sundials_add_benchmark(advection_reaction_3D_raja_mpihip advection_reaction_3D_raja_mpihip advection_reaction_3D - ENABLE_GPU + sundials_add_benchmark( + advection_reaction_3D_raja_mpihip advection_reaction_3D_raja_mpihip + advection_reaction_3D ENABLE_GPU NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} BENCHMARK_ARGS ${benchmark_args} IDENTIFIER ${identifier}) diff --git a/benchmarks/diffusion_2D/CMakeLists.txt b/benchmarks/diffusion_2D/CMakeLists.txt index f64d3e90f3..f26f7397c2 100644 --- a/benchmarks/diffusion_2D/CMakeLists.txt +++ b/benchmarks/diffusion_2D/CMakeLists.txt @@ -12,13 +12,13 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -if(BUILD_ARKODE OR BUILD_CVODE OR BUILD_IDA) +if(BUILD_ARKODE + OR BUILD_CVODE + OR BUILD_IDA) # Shared sources - set(shared_sources - diffusion_2D.hpp - diffusion_2D.cpp - preconditioner_jacobi.cpp) + set(shared_sources diffusion_2D.hpp diffusion_2D.cpp + preconditioner_jacobi.cpp) # Benchmark prefix set(benchmark_prefix ${SUNDIALS_SOURCE_DIR}/benchmarks/diffusion_2D/) @@ -33,7 +33,6 @@ if(BUILD_ARKODE OR BUILD_CVODE OR BUILD_IDA) add_subdirectory(mpi_gpu) endif() - install(FILES README.md - DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") + install(FILES README.md DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") endif() diff --git a/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt b/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt index beb5d1a439..bedab66e97 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt +++ b/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt @@ -13,7 +13,7 @@ # ------------------------------------------------------------------------------ # list of tests -set(tests ) +set(tests) if(BUILD_ARKODE) if(BUILD_NVECTOR_CUDA) @@ -50,13 +50,8 @@ foreach(test_tuple ${tests}) list(GET test_tuple 1 problem_type) list(GET test_tuple 2 backend) - set(sources - ${benchmark_prefix}/main_${package}.cpp - ${shared_sources} - buffers.cpp - diffusion.cpp - solution.cpp - utils.cpp) + set(sources ${benchmark_prefix}/main_${package}.cpp ${shared_sources} + buffers.cpp diffusion.cpp solution.cpp utils.cpp) if("${backend}" STREQUAL "USE_CUDA") @@ -74,18 +69,13 @@ foreach(test_tuple ${tests}) add_executable(${target} ${sources}) - # if("${backend}" STREQUAL "USE_CUDA") - # sundials_add_benchmark(${target} ${target} diffusion_2D - # ENABLE_GPU - # NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} - # ) - #endif() + # if("${backend}" STREQUAL "USE_CUDA") sundials_add_benchmark(${target} + # ${target} diffusion_2D ENABLE_GPU NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} ) + # endif() if("${backend}" STREQUAL "USE_HIP") - sundials_add_benchmark(${target} ${target} diffusion_2D - ENABLE_GPU - NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} - ) + sundials_add_benchmark(${target} ${target} diffusion_2D ENABLE_GPU + NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS}) endif() @@ -99,11 +89,9 @@ foreach(test_tuple ${tests}) target_include_directories(${target} PRIVATE ${benchmark_prefix}) - target_link_libraries(${target} - PRIVATE - sundials_${package} - sundials_nvecmpiplusx - sundials_nveccuda) + target_link_libraries( + ${target} PRIVATE sundials_${package} sundials_nvecmpiplusx + sundials_nveccuda) else() @@ -111,12 +99,9 @@ foreach(test_tuple ${tests}) target_include_directories(${target} PRIVATE ${benchmark_prefix}) - target_link_libraries(${target} - PRIVATE - sundials_${package} - sundials_nvecmpiplusx - sundials_nvechip - hip::device) + target_link_libraries( + ${target} PRIVATE sundials_${package} sundials_nvecmpiplusx + sundials_nvechip hip::device) endif() @@ -125,6 +110,6 @@ foreach(test_tuple ${tests}) target_link_libraries(${target} PRIVATE ${MPI_CXX_LIBRARIES}) install(TARGETS ${target} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") endforeach() diff --git a/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt b/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt index 5e1e5c8862..a5cccdf1ed 100644 --- a/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt +++ b/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt @@ -13,7 +13,7 @@ # ------------------------------------------------------------------------------ # list of tests -set(tests ) +set(tests) if(BUILD_ARKODE) list(APPEND tests "arkode\;BENCHMARK_ODE") @@ -34,13 +34,8 @@ foreach(test_tuple ${tests}) list(GET test_tuple 0 package) list(GET test_tuple 1 problem_type) - set(sources - ${benchmark_prefix}/main_${package}.cpp - ${shared_sources} - buffers.cpp - diffusion.cpp - solution.cpp - utils.cpp) + set(sources ${benchmark_prefix}/main_${package}.cpp ${shared_sources} + buffers.cpp diffusion.cpp solution.cpp utils.cpp) # set the target name set(target ${package}_diffusion_2D_mpi) @@ -56,25 +51,19 @@ foreach(test_tuple ${tests}) target_include_directories(${target} PRIVATE ${benchmark_prefix}) - target_link_libraries(${target} - PRIVATE - sundials_${package} - sundials_nvecparallel - MPI::MPI_CXX) + target_link_libraries(${target} PRIVATE sundials_${package} + sundials_nvecparallel MPI::MPI_CXX) if(BUILD_SUNLINSOL_SUPERLUDIST) target_compile_definitions(${target} PRIVATE USE_SUPERLU_DIST) - target_link_libraries(${target} - PRIVATE - sundials_sunlinsolsuperludist - sundials_sunmatrixslunrloc) + target_link_libraries(${target} PRIVATE sundials_sunlinsolsuperludist + sundials_sunmatrixslunrloc) endif() install(TARGETS ${target} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/diffusion_2D") sundials_add_benchmark(${target} ${target} diffusion_2D - NUM_CORES ${SUNDIALS_BENCHMARK_NUM_CPUS} - ) + NUM_CORES ${SUNDIALS_BENCHMARK_NUM_CPUS}) endforeach() diff --git a/benchmarks/nvector/cuda/CMakeLists.txt b/benchmarks/nvector/cuda/CMakeLists.txt index d4db7b8c4d..2a6741fc40 100644 --- a/benchmarks/nvector/cuda/CMakeLists.txt +++ b/benchmarks/nvector/cuda/CMakeLists.txt @@ -14,8 +14,8 @@ message(STATUS "Added CUDA NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_cuda_benchmark +sundials_add_nvector_benchmark( + nvector_cuda_benchmark SOURCES test_nvector_performance_cuda.cu SUNDIALS_TARGETS sundials_nveccuda - INSTALL_SUBDIR nvector/cuda - ) + INSTALL_SUBDIR nvector/cuda) diff --git a/benchmarks/nvector/hip/CMakeLists.txt b/benchmarks/nvector/hip/CMakeLists.txt index f3b79304d1..f19d4df759 100644 --- a/benchmarks/nvector/hip/CMakeLists.txt +++ b/benchmarks/nvector/hip/CMakeLists.txt @@ -14,8 +14,8 @@ message(STATUS "Added HIP NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_hip_benchmark +sundials_add_nvector_benchmark( + nvector_hip_benchmark SOURCES test_nvector_performance_hip.cpp SUNDIALS_TARGETS sundials_nvechip - INSTALL_SUBDIR nvector/hip - ) + INSTALL_SUBDIR nvector/hip) diff --git a/benchmarks/nvector/kokkos/CMakeLists.txt b/benchmarks/nvector/kokkos/CMakeLists.txt index 43e7177166..2ca1539df0 100644 --- a/benchmarks/nvector/kokkos/CMakeLists.txt +++ b/benchmarks/nvector/kokkos/CMakeLists.txt @@ -14,15 +14,16 @@ message(STATUS "Added Kokkos NVECTOR benchmark") foreach(backend ${KOKKOS_EXAMPLES_BACKENDS}) - sundials_add_nvector_benchmark(test_nvector_performance_kokkos.${backend} + sundials_add_nvector_benchmark( + test_nvector_performance_kokkos.${backend} SOURCES test_nvector_performance_kokkos.cpp SUNDIALS_TARGETS sundials_core sundials_nveckokkos - INSTALL_SUBDIR nvector/kokkos - ) + INSTALL_SUBDIR nvector/kokkos) - target_compile_definitions(test_nvector_performance_kokkos.${backend} PRIVATE USE_${backend}) + target_compile_definitions(test_nvector_performance_kokkos.${backend} + PRIVATE USE_${backend}) install(TARGETS test_nvector_performance_kokkos.${backend} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/") endforeach() diff --git a/benchmarks/nvector/mpiplusx/CMakeLists.txt b/benchmarks/nvector/mpiplusx/CMakeLists.txt index ec6c3c49d9..6a1fd9c1f5 100644 --- a/benchmarks/nvector/mpiplusx/CMakeLists.txt +++ b/benchmarks/nvector/mpiplusx/CMakeLists.txt @@ -14,9 +14,9 @@ message(STATUS "Added MPIPlusX NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_mpiplusx_benchmark +sundials_add_nvector_benchmark( + nvector_mpiplusx_benchmark SOURCES test_nvector_performance_mpiplusx.c SUNDIALS_TARGETS sundials_nvecserial sundials_nvecmpiplusx LINK_LIBRARIES MPI::MPI_CXX - INSTALL_SUBDIR nvector/mpiplusx - ) \ No newline at end of file + INSTALL_SUBDIR nvector/mpiplusx) diff --git a/benchmarks/nvector/openmp/CMakeLists.txt b/benchmarks/nvector/openmp/CMakeLists.txt index 96c9f9e3b0..0980bb8ef4 100644 --- a/benchmarks/nvector/openmp/CMakeLists.txt +++ b/benchmarks/nvector/openmp/CMakeLists.txt @@ -16,14 +16,13 @@ message(STATUS "Added OpenMP NVECTOR benchmark") -# Set-up linker flags and link libraries -# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}") +# Set-up linker flags and link libraries set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} +# ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} +# ${OpenMP_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} +# ${OpenMP_C_FLAGS}") -sundials_add_nvector_benchmark(nvector_openmp_benchmark +sundials_add_nvector_benchmark( + nvector_openmp_benchmark SOURCES test_nvector_performance_openmp.c SUNDIALS_TARGETS sundials_nvecopenmp - INSTALL_SUBDIR nvector/openmp - ) - + INSTALL_SUBDIR nvector/openmp) diff --git a/benchmarks/nvector/openmpdev/CMakeLists.txt b/benchmarks/nvector/openmpdev/CMakeLists.txt index c78d4821d6..54789c9a95 100644 --- a/benchmarks/nvector/openmpdev/CMakeLists.txt +++ b/benchmarks/nvector/openmpdev/CMakeLists.txt @@ -22,13 +22,14 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}") -add_executable(test_nvector_performance_openmpdev - test_nvector_performance_openmpdev.c - ../test_nvector_performance.c +add_executable( + test_nvector_performance_openmpdev + test_nvector_performance_openmpdev.c ../test_nvector_performance.c ../../../src/sundials/sundials_nvector.c) # folder to organize targets in an IDE -set_target_properties(test_nvector_performance_openmp PROPERTIES FOLDER "Benchmarks") +set_target_properties(test_nvector_performance_openmp PROPERTIES FOLDER + "Benchmarks") target_include_directories(test_nvector_performance_openmpdev PRIVATE ..) @@ -36,4 +37,4 @@ target_include_directories(test_nvector_performance_openmpdev PRIVATE ..) target_link_libraries(test_nvector_performance_openmpdev ${SUNDIALS_LIBS}) install(TARGETS test_nvector_performance_openmpdev - DESTINATION "${BENCHMARKS_INSTALL_PATH}/nvector/openmpdev") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/nvector/openmpdev") diff --git a/benchmarks/nvector/parallel/CMakeLists.txt b/benchmarks/nvector/parallel/CMakeLists.txt index c096594f3d..87ed3138ba 100644 --- a/benchmarks/nvector/parallel/CMakeLists.txt +++ b/benchmarks/nvector/parallel/CMakeLists.txt @@ -14,9 +14,9 @@ message(STATUS "Added Parallel NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_parallel_benchmark +sundials_add_nvector_benchmark( + nvector_parallel_benchmark SOURCES test_nvector_performance_parallel.c SUNDIALS_TARGETS sundials_nvecparallel LINK_LIBRARIES MPI::MPI_CXX - INSTALL_SUBDIR nvector/parallel - ) + INSTALL_SUBDIR nvector/parallel) diff --git a/benchmarks/nvector/parhyp/CMakeLists.txt b/benchmarks/nvector/parhyp/CMakeLists.txt index 7e05ff3a0f..216085064b 100644 --- a/benchmarks/nvector/parhyp/CMakeLists.txt +++ b/benchmarks/nvector/parhyp/CMakeLists.txt @@ -16,9 +16,9 @@ message(STATUS "Added hypre NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_parhyp_benchmark +sundials_add_nvector_benchmark( + nvector_parhyp_benchmark SOURCES test_nvector_performance_parhyp.c SUNDIALS_TARGETS sundials_nvecparhyp LINK_LIBRARIES MPI::MPI_C SUNDIALS::HYPRE - INSTALL_SUBDIR nvector/parhyp - ) + INSTALL_SUBDIR nvector/parhyp) diff --git a/benchmarks/nvector/petsc/CMakeLists.txt b/benchmarks/nvector/petsc/CMakeLists.txt index 63e2f8a1e9..fd9183593d 100644 --- a/benchmarks/nvector/petsc/CMakeLists.txt +++ b/benchmarks/nvector/petsc/CMakeLists.txt @@ -16,9 +16,9 @@ message(STATUS "Added PETSc NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_petsc_benchmark +sundials_add_nvector_benchmark( + nvector_petsc_benchmark SOURCES test_nvector_performance_petsc.c SUNDIALS_TARGETS sundials_nvecpetsc LINK_LIBRARIES MPI::MPI_C PUBLIC SUNDIALS::PETSC - INSTALL_SUBDIR nvector/petsc - ) + INSTALL_SUBDIR nvector/petsc) diff --git a/benchmarks/nvector/pthreads/CMakeLists.txt b/benchmarks/nvector/pthreads/CMakeLists.txt index ae7ec038c0..bc7cac35f2 100644 --- a/benchmarks/nvector/pthreads/CMakeLists.txt +++ b/benchmarks/nvector/pthreads/CMakeLists.txt @@ -16,9 +16,9 @@ message(STATUS "Added PThreads NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_pthreads_benchmark +sundials_add_nvector_benchmark( + nvector_pthreads_benchmark SOURCES test_nvector_performance_pthreads.c SUNDIALS_TARGETS sundials_nvecpthreads LINK_LIBRARIES Threads::Threads - INSTALL_SUBDIR nvector/pthreads - ) + INSTALL_SUBDIR nvector/pthreads) diff --git a/benchmarks/nvector/raja/CMakeLists.txt b/benchmarks/nvector/raja/CMakeLists.txt index 4fe8575dbe..9c37eb6d99 100644 --- a/benchmarks/nvector/raja/CMakeLists.txt +++ b/benchmarks/nvector/raja/CMakeLists.txt @@ -37,13 +37,12 @@ foreach(backend ${SUNDIALS_RAJA_BACKENDS}) continue() endif() - sundials_add_nvector_benchmark(${example_target} + sundials_add_nvector_benchmark( + ${example_target} SOURCES test_nvector_performance_raja.cpp - SUNDIALS_TARGETS sundials_nvecraja - ) + SUNDIALS_TARGETS sundials_nvecraja) - target_compile_definitions(${example_target} - PRIVATE ${_defines}) + target_compile_definitions(${example_target} PRIVATE ${_defines}) if(backend MATCHES "CUDA") set_target_properties(${example_target} PROPERTIES LINKER_LANGUAGE CXX) @@ -54,6 +53,6 @@ foreach(backend ${SUNDIALS_RAJA_BACKENDS}) endif() install(TARGETS ${example_target} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/benchmarks/nvector/raja") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/benchmarks/nvector/raja") endforeach() diff --git a/benchmarks/nvector/serial/CMakeLists.txt b/benchmarks/nvector/serial/CMakeLists.txt index 01bb5c1c54..edac263500 100644 --- a/benchmarks/nvector/serial/CMakeLists.txt +++ b/benchmarks/nvector/serial/CMakeLists.txt @@ -16,8 +16,8 @@ message(STATUS "Added Serial NVECTOR benchmark") -sundials_add_nvector_benchmark(nvector_serial_benchmark +sundials_add_nvector_benchmark( + nvector_serial_benchmark SOURCES test_nvector_performance_serial.c SUNDIALS_TARGETS sundials_nvecserial - INSTALL_SUBDIR nvector/serial - ) + INSTALL_SUBDIR nvector/serial) diff --git a/benchmarks/nvector/sycl/CMakeLists.txt b/benchmarks/nvector/sycl/CMakeLists.txt index 6ff0ffbb9f..b92c202b53 100644 --- a/benchmarks/nvector/sycl/CMakeLists.txt +++ b/benchmarks/nvector/sycl/CMakeLists.txt @@ -16,7 +16,8 @@ message(STATUS "Added SYCL NVECTOR benchmark") set(BENCHMARKS_DIR ${PROJECT_SOURCE_DIR}/benchmarks) -sundials_add_nvector_benchmark(test_nvector_performance_sycl +sundials_add_nvector_benchmark( + test_nvector_performance_sycl SOURCES test_nvector_performance_sycl.cpp SUNDIALS_TARGETS sundials_nvecsycl INSTALL_SUBDIR nvector/sycl) diff --git a/cmake/SundialsBuildOptionsPost.cmake b/cmake/SundialsBuildOptionsPost.cmake index 01d6969bc6..2bf6acd14f 100644 --- a/cmake/SundialsBuildOptionsPost.cmake +++ b/cmake/SundialsBuildOptionsPost.cmake @@ -16,8 +16,8 @@ # --------------------------------------------------------------- # --------------------------------------------------------------- -# Option to use specialized fused kernels in the packages. -# Currently only available in CVODE. +# Option to use specialized fused kernels in the packages. Currently only +# available in CVODE. # --------------------------------------------------------------- if(ENABLE_CUDA OR ENABLE_HIP) @@ -26,9 +26,11 @@ else() set(CUDA_OR_HIP FALSE) endif() -sundials_option(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS BOOL "Build specialized fused GPU kernels" OFF - DEPENDS_ON BUILD_CVODE CUDA_OR_HIP - DEPENDS_ON_THROW_ERROR) +sundials_option( + SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS BOOL + "Build specialized fused GPU kernels" OFF + DEPENDS_ON BUILD_CVODE CUDA_OR_HIP + DEPENDS_ON_THROW_ERROR) # --------------------------------------------------------------- # Options to enable/disable build for NVECTOR modules. @@ -38,81 +40,100 @@ sundials_option(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS BOOL "Build specialized fus set(BUILD_NVECTOR_SERIAL TRUE) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_SERIAL") -sundials_option(BUILD_NVECTOR_CUDA BOOL "Build the NVECTOR_CUDA module (requires CUDA)" ON - DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER - ADVANCED) +sundials_option( + BUILD_NVECTOR_CUDA BOOL "Build the NVECTOR_CUDA module (requires CUDA)" ON + DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_CUDA") -sundials_option(BUILD_NVECTOR_HIP BOOL "Build the NVECTOR_HIP module (requires HIP)" ON - DEPENDS_ON ENABLE_HIP - ADVANCED) +sundials_option( + BUILD_NVECTOR_HIP BOOL "Build the NVECTOR_HIP module (requires HIP)" ON + DEPENDS_ON ENABLE_HIP + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_HIP") -sundials_option(BUILD_NVECTOR_SYCL BOOL "Build the NVECTOR_SYCL module (requires SYCL)" ON - DEPENDS_ON ENABLE_SYCL - ADVANCED) +sundials_option( + BUILD_NVECTOR_SYCL BOOL "Build the NVECTOR_SYCL module (requires SYCL)" ON + DEPENDS_ON ENABLE_SYCL + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_SYCL") -sundials_option(BUILD_NVECTOR_MANYVECTOR BOOL "Build the NVECTOR_MANYVECTOR module" ON - ADVANCED) +sundials_option(BUILD_NVECTOR_MANYVECTOR BOOL + "Build the NVECTOR_MANYVECTOR module" ON ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_MANYVECTOR") -sundials_option(BUILD_NVECTOR_MPIMANYVECTOR BOOL "Build the NVECTOR_MPIMANYVECTOR module (requires MPI)" ON - DEPENDS_ON ENABLE_MPI MPI_C_FOUND - ADVANCED) +sundials_option( + BUILD_NVECTOR_MPIMANYVECTOR BOOL + "Build the NVECTOR_MPIMANYVECTOR module (requires MPI)" ON + DEPENDS_ON ENABLE_MPI MPI_C_FOUND + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_MPIMANYVECTOR") -sundials_option(BUILD_NVECTOR_MPIPLUSX BOOL "Build the NVECTOR_MPIPLUSX module (requires MPI)" ON - DEPENDS_ON ENABLE_MPI MPI_C_FOUND BUILD_NVECTOR_MPIMANYVECTOR - ADVANCED) +sundials_option( + BUILD_NVECTOR_MPIPLUSX BOOL "Build the NVECTOR_MPIPLUSX module (requires MPI)" + ON + DEPENDS_ON ENABLE_MPI MPI_C_FOUND BUILD_NVECTOR_MPIMANYVECTOR + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_MPIPLUSX") -sundials_option(BUILD_NVECTOR_PARALLEL BOOL "Build the NVECTOR_PARALLEL module (requires MPI)" ON - DEPENDS_ON ENABLE_MPI MPI_C_FOUND - ADVANCED) +sundials_option( + BUILD_NVECTOR_PARALLEL BOOL "Build the NVECTOR_PARALLEL module (requires MPI)" + ON + DEPENDS_ON ENABLE_MPI MPI_C_FOUND + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_PARALLEL") -sundials_option(BUILD_NVECTOR_OPENMP BOOL "Build the NVECTOR_OPENMP module" ON - DEPENDS_ON ENABLE_OPENMP - ADVANCED) +sundials_option( + BUILD_NVECTOR_OPENMP BOOL "Build the NVECTOR_OPENMP module" ON + DEPENDS_ON ENABLE_OPENMP + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_OPENMP") -sundials_option(BUILD_NVECTOR_OPENMPDEV BOOL "Build the NVECTOR_OPENMPDEV module" ON - DEPENDS_ON ENABLE_OPENMP_DEVICE OPENMP_SUPPORTS_DEVICE_OFFLOADING - ADVANCED) +sundials_option( + BUILD_NVECTOR_OPENMPDEV BOOL "Build the NVECTOR_OPENMPDEV module" ON + DEPENDS_ON ENABLE_OPENMP_DEVICE OPENMP_SUPPORTS_DEVICE_OFFLOADING + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_OPENMPDEV") -sundials_option(BUILD_NVECTOR_PARHYP BOOL "Build the NVECTOR_PARHYP module (requires hypre)" ON - DEPENDS_ON ENABLE_HYPRE HYPRE_WORKS - ADVANCED) +sundials_option( + BUILD_NVECTOR_PARHYP BOOL "Build the NVECTOR_PARHYP module (requires hypre)" + ON + DEPENDS_ON ENABLE_HYPRE HYPRE_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_PARHYP") -sundials_option(BUILD_NVECTOR_PETSC BOOL "Build the NVECTOR_PETSC module (requires PETSc)" ON - DEPENDS_ON ENABLE_PETSC PETSC_WORKS - ADVANCED) +sundials_option( + BUILD_NVECTOR_PETSC BOOL "Build the NVECTOR_PETSC module (requires PETSc)" ON + DEPENDS_ON ENABLE_PETSC PETSC_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_PETSC") -sundials_option(BUILD_NVECTOR_PTHREADS BOOL "Build the NVECTOR_PTHREADS module" ON - DEPENDS_ON ENABLE_PTHREAD - ADVANCED) +sundials_option( + BUILD_NVECTOR_PTHREADS BOOL "Build the NVECTOR_PTHREADS module" ON + DEPENDS_ON ENABLE_PTHREAD + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_PTHREADS") -sundials_option(BUILD_NVECTOR_RAJA BOOL "Build the NVECTOR_RAJA module (requires RAJA)" ON - DEPENDS_ON ENABLE_RAJA - ADVANCED) +sundials_option( + BUILD_NVECTOR_RAJA BOOL "Build the NVECTOR_RAJA module (requires RAJA)" ON + DEPENDS_ON ENABLE_RAJA + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_RAJA") -sundials_option(BUILD_NVECTOR_TRILINOS BOOL "Build the NVECTOR_TRILINOS module (requires Trilinos)" ON - DEPENDS_ON ENABLE_TRILINOS Trilinos_WORKS - ADVANCED) +sundials_option( + BUILD_NVECTOR_TRILINOS BOOL + "Build the NVECTOR_TRILINOS module (requires Trilinos)" ON + DEPENDS_ON ENABLE_TRILINOS Trilinos_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_TRILINOS") -sundials_option(BUILD_NVECTOR_KOKKOS BOOL "Build the NVECTOR_KOKKOS module (requires Kokkos)" ON - DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS - ADVANCED) +sundials_option( + BUILD_NVECTOR_KOKKOS BOOL "Build the NVECTOR_KOKKOS module (requires Kokkos)" + ON + DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_NVECTOR_KOKKOS") - # --------------------------------------------------------------- # Options to enable/disable build for SUNMATRIX modules. # --------------------------------------------------------------- @@ -129,34 +150,47 @@ set(_COMPATIBLE_INDEX_SIZE FALSE) if(SUNDIALS_INDEX_SIZE MATCHES "32") set(_COMPATIBLE_INDEX_SIZE TRUE) endif() -sundials_option(BUILD_SUNMATRIX_CUSPARSE BOOL "Build the SUNMATRIX_CUSPARSE module (requires CUDA and 32-bit indexing)" ON - DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER _COMPATIBLE_INDEX_SIZE BUILD_NVECTOR_CUDA - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_CUSPARSE BOOL + "Build the SUNMATRIX_CUSPARSE module (requires CUDA and 32-bit indexing)" ON + DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER _COMPATIBLE_INDEX_SIZE + BUILD_NVECTOR_CUDA + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_CUSPARSE") -sundials_option(BUILD_SUNMATRIX_GINKGO BOOL "Build the SUNMATRIX_GINKGO module (requires Ginkgo)" ON - DEPENDS_ON ENABLE_GINKGO GINKGO_WORKS - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_GINKGO BOOL + "Build the SUNMATRIX_GINKGO module (requires Ginkgo)" ON + DEPENDS_ON ENABLE_GINKGO GINKGO_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_GINKGO") -sundials_option(BUILD_SUNMATRIX_KOKKOSDENSE BOOL "Build the SUNMATRIX_KOKKOSDENSE module" ON - DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS ENABLE_KOKKOS_KERNELS KOKKOS_KERNELS_WORKS - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_KOKKOSDENSE BOOL "Build the SUNMATRIX_KOKKOSDENSE module" ON + DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS ENABLE_KOKKOS_KERNELS + KOKKOS_KERNELS_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_KOKKOSDENSE") -sundials_option(BUILD_SUNMATRIX_MAGMADENSE BOOL "Build the SUNMATRIX_MAGMADENSE module (requires MAGMA)" ON - DEPENDS_ON ENABLE_MAGMA MAGMA_WORKS - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_MAGMADENSE BOOL + "Build the SUNMATRIX_MAGMADENSE module (requires MAGMA)" ON + DEPENDS_ON ENABLE_MAGMA MAGMA_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_MAGMADENSE") -sundials_option(BUILD_SUNMATRIX_ONEMKLDENSE BOOL "Build the SUNMATRIX_ONEMKLDENSE module (requires oneMKL)" ON - DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_ONEMKLDENSE BOOL + "Build the SUNMATRIX_ONEMKLDENSE module (requires oneMKL)" ON + DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_ONEMKLDENSE") -sundials_option(BUILD_SUNMATRIX_SLUNRLOC BOOL "Build the SUNMATRIX_SLUNRLOC module (requires SuperLU_DIST)" ON - DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS - ADVANCED) +sundials_option( + BUILD_SUNMATRIX_SLUNRLOC BOOL + "Build the SUNMATRIX_SLUNRLOC module (requires SuperLU_DIST)" ON + DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNMATRIX_SLUNRLOC") # --------------------------------------------------------------- @@ -179,57 +213,76 @@ list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_SPGMR") set(BUILD_SUNLINSOL_SPTFQMR TRUE) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_SPTFQMR") -sundials_option(BUILD_SUNLINSOL_CUSOLVERSP BOOL "Build the SUNLINSOL_CUSOLVERSP module (requires CUDA and 32-bit indexing)" ON - DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER BUILD_NVECTOR_CUDA BUILD_SUNMATRIX_CUSPARSE - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_CUSOLVERSP BOOL + "Build the SUNLINSOL_CUSOLVERSP module (requires CUDA and 32-bit indexing)" ON + DEPENDS_ON ENABLE_CUDA CMAKE_CUDA_COMPILER BUILD_NVECTOR_CUDA + BUILD_SUNMATRIX_CUSPARSE + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_CUSOLVERSP") -sundials_option(BUILD_SUNLINSOL_GINKGO BOOL "Build the SUNLINSOL_GINKGO module (requires Ginkgo)" ON - DEPENDS_ON ENABLE_GINKGO GINKGO_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_GINKGO BOOL + "Build the SUNLINSOL_GINKGO module (requires Ginkgo)" ON + DEPENDS_ON ENABLE_GINKGO GINKGO_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_GINKGO") -sundials_option(BUILD_SUNLINSOL_KLU BOOL "Build the SUNLINSOL_KLU module (requires KLU)" ON - DEPENDS_ON ENABLE_KLU KLU_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_KLU BOOL "Build the SUNLINSOL_KLU module (requires KLU)" ON + DEPENDS_ON ENABLE_KLU KLU_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_KLU") -sundials_option(BUILD_SUNLINSOL_KOKKOSDENSE BOOL "Build the SUNLINSOL_KOKKOSDENSE module" ON - DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS ENABLE_KOKKOS_KERNELS KOKKOS_KERNELS_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_KOKKOSDENSE BOOL "Build the SUNLINSOL_KOKKOSDENSE module" ON + DEPENDS_ON ENABLE_KOKKOS KOKKOS_WORKS ENABLE_KOKKOS_KERNELS + KOKKOS_KERNELS_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_KOKKOSDENSE") -sundials_option(BUILD_SUNLINSOL_LAPACKBAND BOOL "Build the SUNLINSOL_LAPACKBAND module (requires LAPACK)" ON - DEPENDS_ON ENABLE_LAPACK LAPACK_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_LAPACKBAND BOOL + "Build the SUNLINSOL_LAPACKBAND module (requires LAPACK)" ON + DEPENDS_ON ENABLE_LAPACK LAPACK_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_LAPACKBAND") -sundials_option(BUILD_SUNLINSOL_LAPACKDENSE BOOL "Build the SUNLINSOL_LAPACKDENSE module (requires LAPACK)" ON - DEPENDS_ON ENABLE_LAPACK LAPACK_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_LAPACKDENSE BOOL + "Build the SUNLINSOL_LAPACKDENSE module (requires LAPACK)" ON + DEPENDS_ON ENABLE_LAPACK LAPACK_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_LAPACKDENSE") -sundials_option(BUILD_SUNLINSOL_MAGMADENSE BOOL "Build the SUNLINSOL_MAGMADENSE module (requires MAGMA)" ON - DEPENDS_ON ENABLE_MAGMA MAGMA_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_MAGMADENSE BOOL + "Build the SUNLINSOL_MAGMADENSE module (requires MAGMA)" ON + DEPENDS_ON ENABLE_MAGMA MAGMA_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_MAGMADENSE") -sundials_option(BUILD_SUNLINSOL_ONEMKLDENSE BOOL "Build the SUNLINSOL_ONEMKLDENSE module (requires oneMKL)" ON - DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_ONEMKLDENSE BOOL + "Build the SUNLINSOL_ONEMKLDENSE module (requires oneMKL)" ON + DEPENDS_ON ENABLE_ONEMKL ONEMKL_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_ONEMKLDENSE") -sundials_option(BUILD_SUNLINSOL_SUPERLUDIST BOOL "Build the SUNLINSOL_SUPERLUDIST module (requires SUPERLUDIST)" ON - DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS BUILD_SUNMATRIX_SLUNRLOC - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_SUPERLUDIST BOOL + "Build the SUNLINSOL_SUPERLUDIST module (requires SUPERLUDIST)" ON + DEPENDS_ON ENABLE_SUPERLUDIST SUPERLUDIST_WORKS BUILD_SUNMATRIX_SLUNRLOC + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_SUPERLUDIST") -sundials_option(BUILD_SUNLINSOL_SUPERLUMT BOOL "Build the SUNLINSOL_SUPERLUMT module (requires SUPERLUMT)" ON - DEPENDS_ON ENABLE_SUPERLUMT SUPERLUMT_WORKS - ADVANCED) +sundials_option( + BUILD_SUNLINSOL_SUPERLUMT BOOL + "Build the SUNLINSOL_SUPERLUMT module (requires SUPERLUMT)" ON + DEPENDS_ON ENABLE_SUPERLUMT SUPERLUMT_WORKS + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNLINSOL_SUPERLUMT") - # --------------------------------------------------------------- # Options to enable/disable build for SUNNONLINSOL modules. # --------------------------------------------------------------- @@ -240,7 +293,9 @@ list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNNONLINSOL_NEWTON") set(BUILD_SUNNONLINSOL_FIXEDPOINT TRUE) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNNONLINSOL_FIXEDPOINT") -sundials_option(BUILD_SUNNONLINSOL_PETSCSNES BOOL "Build the SUNNONLINSOL_PETSCSNES module (requires PETSc)" ON - DEPENDS_ON ENABLE_PETSC PETSC_FOUND - ADVANCED) +sundials_option( + BUILD_SUNNONLINSOL_PETSCSNES BOOL + "Build the SUNNONLINSOL_PETSCSNES module (requires PETSc)" ON + DEPENDS_ON ENABLE_PETSC PETSC_FOUND + ADVANCED) list(APPEND SUNDIALS_BUILD_LIST "BUILD_SUNNONLINSOL_PETSCSNES") diff --git a/cmake/SundialsBuildOptionsPre.cmake b/cmake/SundialsBuildOptionsPre.cmake index 3c3f6b16cb..048137ff2d 100644 --- a/cmake/SundialsBuildOptionsPre.cmake +++ b/cmake/SundialsBuildOptionsPre.cmake @@ -33,7 +33,8 @@ endif() set(DOCSTR "single, double, or extended") sundials_option(SUNDIALS_PRECISION STRING "${DOCSTR}" "DOUBLE") string(TOUPPER ${SUNDIALS_PRECISION} _upper_SUNDIALS_PRECISION) -force_variable(SUNDIALS_PRECISION STRING "${DOCSTR}" ${_upper_SUNDIALS_PRECISION}) +force_variable(SUNDIALS_PRECISION STRING "${DOCSTR}" + ${_upper_SUNDIALS_PRECISION}) # --------------------------------------------------------------- # Option to specify index type @@ -65,7 +66,9 @@ set(DOCSTR "Build with simulation profiling capabilities enabled") sundials_option(SUNDIALS_BUILD_WITH_PROFILING BOOL "${DOCSTR}" OFF) if(SUNDIALS_BUILD_WITH_PROFILING) - message(WARNING "SUNDIALS built with profiling turned on, performance may be affected.") + message( + WARNING + "SUNDIALS built with profiling turned on, performance may be affected.") endif() # --------------------------------------------------------------- @@ -78,24 +81,35 @@ else() set(_default_err_checks ON) endif() -set(DOCSTR "Build with error checking enabled/disabled. Enabling error checks may affect performance.") -sundials_option(SUNDIALS_ENABLE_ERROR_CHECKS BOOL "${DOCSTR}" ${_default_err_checks}) +set(DOCSTR + "Build with error checking enabled/disabled. Enabling error checks may affect performance." +) +sundials_option(SUNDIALS_ENABLE_ERROR_CHECKS BOOL "${DOCSTR}" + ${_default_err_checks}) if(SUNDIALS_ENABLE_ERROR_CHECKS) message(STATUS "SUNDIALS error checking enabled") - message(WARNING "SUNDIALS is being built with extensive error checks, performance may be affected.") + message( + WARNING + "SUNDIALS is being built with extensive error checks, performance may be affected." + ) endif() # --------------------------------------------------------------- # Option to enable logging # --------------------------------------------------------------- -set(DOCSTR "Build with logging capabilities enabled (0 = no logging, 1 = errors, 2 = +warnings, 3 = +info, 4 = +debug, 5 = +extras") +set(DOCSTR + "Build with logging capabilities enabled (0 = no logging, 1 = errors, 2 = +warnings, 3 = +info, 4 = +debug, 5 = +extras" +) sundials_option(SUNDIALS_LOGGING_LEVEL STRING "${DOCSTR}" 2 OPTIONS "0;1;2;3;4;5") if(SUNDIALS_LOGGING_LEVEL GREATER_EQUAL 3) message(STATUS "SUNDIALS logging level set to ${SUNDIALS_LOGGING_LEVEL}") - message(WARNING "SUNDIALS built with additional logging turned on, performance may be affected.") + message( + WARNING + "SUNDIALS built with additional logging turned on, performance may be affected." + ) endif() # --------------------------------------------------------------- @@ -103,9 +117,11 @@ endif() # --------------------------------------------------------------- if(UNIX) - sundials_option(SUNDIALS_MATH_LIBRARY PATH "Which math library (e.g., libm) to link to" "-lm" ADVANCED) + sundials_option(SUNDIALS_MATH_LIBRARY PATH + "Which math library (e.g., libm) to link to" "-lm" ADVANCED) else() - sundials_option(SUNDIALS_MATH_LIBRARY PATH "Which math library (e.g., libm) to link to" "" ADVANCED) + sundials_option(SUNDIALS_MATH_LIBRARY PATH + "Which math library (e.g., libm) to link to" "" ADVANCED) endif() # all executables will be linked against the math library set(EXE_EXTRA_LINK_LIBS "${SUNDIALS_MATH_LIBRARY}") @@ -119,15 +135,16 @@ sundials_option(BUILD_SHARED_LIBS BOOL "Build shared libraries" ON) # Make sure we build at least one type of libraries if(NOT BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "Both static and shared library generation were disabled.") + message( + FATAL_ERROR "Both static and shared library generation were disabled.") endif() # --------------------------------------------------------------- # Options to enable SUNDIALS packages and modules # --------------------------------------------------------------- -# For each SUNDIALS package available (i.e. for which we have the -# sources), give the user the option of enabling/disabling it. +# For each SUNDIALS package available (i.e. for which we have the sources), give +# the user the option of enabling/disabling it. if(IS_DIRECTORY "${SUNDIALS_SOURCE_DIR}/src/arkode") sundials_option(BUILD_ARKODE BOOL "Build the ARKODE library" ON) @@ -182,7 +199,10 @@ sundials_option(BUILD_FORTRAN_MODULE_INTERFACE BOOL "${DOCSTR}" OFF) if(BUILD_FORTRAN_MODULE_INTERFACE) # F2003 interface only supports double precision if(NOT (SUNDIALS_PRECISION MATCHES "DOUBLE")) - message(FATAL_ERROR "F2003 interface is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR + "F2003 interface is not compatible with ${SUNDIALS_PRECISION} precision" + ) endif() # Allow a user to set where the Fortran modules will be installed @@ -196,7 +216,10 @@ endif() sundials_option(BUILD_BENCHMARKS BOOL "Build the SUNDIALS benchmark suite" OFF) -sundials_option(BENCHMARKS_INSTALL_PATH PATH "Output directory for installing benchmark executables" "${CMAKE_INSTALL_PREFIX}/benchmarks") +sundials_option( + BENCHMARKS_INSTALL_PATH PATH + "Output directory for installing benchmark executables" + "${CMAKE_INSTALL_PREFIX}/benchmarks") # --------------------------------------------------------------- # Options for CMake config installation @@ -210,14 +233,14 @@ sundials_option(SUNDIALS_INSTALL_CMAKEDIR STRING "${DOCSTR}" # Options to enable compiler warnings, address sanitizer # --------------------------------------------------------------- -sundials_option(ENABLE_ALL_WARNINGS BOOL - "Enable all compiler warnings" OFF ADVANCED) +sundials_option(ENABLE_ALL_WARNINGS BOOL "Enable all compiler warnings" OFF + ADVANCED) sundials_option(ENABLE_WARNINGS_AS_ERRORS BOOL - "Enable compiler warnings as errors" OFF ADVANCED) + "Enable compiler warnings as errors" OFF ADVANCED) -sundials_option(ENABLE_ADDRESS_SANITIZER BOOL - "Enable address sanitizer" OFF ADVANCED) +sundials_option(ENABLE_ADDRESS_SANITIZER BOOL "Enable address sanitizer" OFF + ADVANCED) # --------------------------------------------------------------- # Options to enable SUNDIALS debugging @@ -225,111 +248,127 @@ sundials_option(ENABLE_ADDRESS_SANITIZER BOOL # List of debugging options (used to add preprocessor directives) set(_SUNDIALS_DEBUG_OPTIONS - SUNDIALS_DEBUG - SUNDIALS_DEBUG_ASSERT - SUNDIALS_DEBUG_CUDA_LASTERROR - SUNDIALS_DEBUG_HIP_LASTERROR - SUNDIALS_DEBUG_PRINTVEC) + SUNDIALS_DEBUG SUNDIALS_DEBUG_ASSERT SUNDIALS_DEBUG_CUDA_LASTERROR + SUNDIALS_DEBUG_HIP_LASTERROR SUNDIALS_DEBUG_PRINTVEC) sundials_option(SUNDIALS_DEBUG BOOL - "Enable additional debugging output and options" OFF - ADVANCED) + "Enable additional debugging output and options" OFF ADVANCED) if(SUNDIALS_DEBUG AND SUNDIALS_LOGGING_LEVEL LESS 4) set(DOCSTR "SUNDIALS_DEBUG=ON forced the logging level to 4") message(STATUS "${DOCSTR}") - set(SUNDIALS_LOGGING_LEVEL "4" CACHE STRING "${DOCSTR}" FORCE) + set(SUNDIALS_LOGGING_LEVEL + "4" + CACHE STRING "${DOCSTR}" FORCE) endif() -sundials_option(SUNDIALS_DEBUG_ASSERT BOOL - "Enable assert when debugging" OFF +sundials_option( + SUNDIALS_DEBUG_ASSERT BOOL "Enable assert when debugging" OFF DEPENDS_ON SUNDIALS_DEBUG ADVANCED) -sundials_option(SUNDIALS_DEBUG_CUDA_LASTERROR BOOL +sundials_option( + SUNDIALS_DEBUG_CUDA_LASTERROR BOOL "Enable CUDA last error checks when debugging" OFF DEPENDS_ON SUNDIALS_DEBUG ENABLE_CUDA ADVANCED) -sundials_option(SUNDIALS_DEBUG_HIP_LASTERROR BOOL +sundials_option( + SUNDIALS_DEBUG_HIP_LASTERROR BOOL "Enable HIP last error checks when debugging" OFF DEPENDS_ON SUNDIALS_DEBUG ENABLE_HIP ADVANCED) -sundials_option(SUNDIALS_DEBUG_PRINTVEC BOOL - "Enable vector printing when debugging" OFF +sundials_option( + SUNDIALS_DEBUG_PRINTVEC BOOL "Enable vector printing when debugging" OFF DEPENDS_ON SUNDIALS_DEBUG ADVANCED) if(SUNDIALS_DEBUG_PRINTVEC AND SUNDIALS_LOGGING_LEVEL LESS 5) set(DOCSTR "SUNDIALS_DEBUG_PRINTVEC=ON forced the logging level to 5") message(STATUS "${DOCSTR}") - set(SUNDIALS_LOGGING_LEVEL "5" CACHE STRING "${DOCSTR}" FORCE) + set(SUNDIALS_LOGGING_LEVEL + "5" + CACHE STRING "${DOCSTR}" FORCE) endif() # --------------------------------------------------------------- # Options for SUNDIALS external # --------------------------------------------------------------- -sundials_option(SUNDIALS_ENABLE_EXTERNAL_ADDONS BOOL +sundials_option( + SUNDIALS_ENABLE_EXTERNAL_ADDONS BOOL "Enables including EXTERNALLY MAINTAINED addons in the SUNDIALS build." OFF) if(SUNDIALS_ENABLE_EXTERNAL_ADDONS) - message(WARNING "SUNDIALS_ENABLE_EXTERNAL_ADDONS=TRUE. External addons are not maintained by the SUNDIALS team. Use at your own risk.") + message( + WARNING + "SUNDIALS_ENABLE_EXTERNAL_ADDONS=TRUE. External addons are not maintained by the SUNDIALS team. Use at your own risk." + ) endif() # --------------------------------------------------------------- # Options for SUNDIALS testing # --------------------------------------------------------------- -sundials_option(SUNDIALS_TEST_FLOAT_PRECISION STRING +sundials_option( + SUNDIALS_TEST_FLOAT_PRECISION STRING "Precision for floating point comparisons (number of digits)" "-1" ADVANCED) -sundials_option(SUNDIALS_TEST_INTEGER_PRECISION STRING +sundials_option( + SUNDIALS_TEST_INTEGER_PRECISION STRING "Precision for integer comparisons (percent difference)" "-1" ADVANCED) sundials_option(SUNDIALS_TEST_OUTPUT_DIR PATH - "Location to write testing output files" "" ADVANCED) + "Location to write testing output files" "" ADVANCED) sundials_option(SUNDIALS_TEST_ANSWER_DIR PATH - "Location of testing answer files" "" ADVANCED) + "Location of testing answer files" "" ADVANCED) sundials_option(SUNDIALS_TEST_PROFILE BOOL - "Use Caliper to profile SUNDIALS tests" OFF ADVANCED) + "Use Caliper to profile SUNDIALS tests" OFF ADVANCED) -sundials_option(SUNDIALS_TEST_NODIFF BOOL +sundials_option( + SUNDIALS_TEST_NODIFF BOOL "Disable output comparison in the regression test suite" OFF ADVANCED) -sundials_option(SUNDIALS_TEST_CONTAINER_EXE PATH - "Path to docker or podman" "" ADVANCED) +sundials_option(SUNDIALS_TEST_CONTAINER_EXE PATH "Path to docker or podman" "" + ADVANCED) -sundials_option(SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS STRING - "Extra arguments to pass to docker/podman run command" "--tls-verify=false" ADVANCED) +sundials_option( + SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS STRING + "Extra arguments to pass to docker/podman run command" "--tls-verify=false" + ADVANCED) -sundials_option(SUNDIALS_TEST_CONTAINER_MNT STRING +sundials_option( + SUNDIALS_TEST_CONTAINER_MNT STRING "Path to project root inside the container" "/sundials" ADVANCED) # Include development examples in regression tests sundials_option(SUNDIALS_TEST_DEVTESTS BOOL - "Include development tests in make test" OFF ADVANCED) + "Include development tests in make test" OFF ADVANCED) # Include unit tests in regression tests -sundials_option(SUNDIALS_TEST_UNITTESTS BOOL - "Include unit tests in make test" OFF ADVANCED) +sundials_option(SUNDIALS_TEST_UNITTESTS BOOL "Include unit tests in make test" + OFF ADVANCED) # Include googletest unit tests in regression tests -sundials_option(SUNDIALS_TEST_ENABLE_GTEST BOOL - "Disable GTest unit tests" ON ADVANCED) +sundials_option(SUNDIALS_TEST_ENABLE_GTEST BOOL "Disable GTest unit tests" ON + ADVANCED) -sundials_option(SUNDIALS_DEV_IWYU BOOL - "Enable include-what-you-use" OFF ADVANCED) +sundials_option(SUNDIALS_DEV_IWYU BOOL "Enable include-what-you-use" OFF + ADVANCED) -sundials_option(SUNDIALS_DEV_CLANG_TIDY BOOL - "Enable clang-tidy" OFF ADVANCED) +sundials_option(SUNDIALS_DEV_CLANG_TIDY BOOL "Enable clang-tidy" OFF ADVANCED) -sundials_option(SUNDIALS_SCHEDULER_COMMAND STRING "Job scheduler command to use to launch SUNDIALS MPI tests" "" ADVANCED) +sundials_option( + SUNDIALS_SCHEDULER_COMMAND STRING + "Job scheduler command to use to launch SUNDIALS MPI tests" "" ADVANCED) -sundials_option(SUNDIALS_CALIPER_OUTPUT_DIR PATH "Location to write caliper output files" "" ADVANCED) +sundials_option(SUNDIALS_CALIPER_OUTPUT_DIR PATH + "Location to write caliper output files" "" ADVANCED) -sundials_option(SUNDIALS_BENCHMARK_NUM_CPUS STRING "Number of CPU cores to run benchmarks with" "40" ADVANCED) +sundials_option(SUNDIALS_BENCHMARK_NUM_CPUS STRING + "Number of CPU cores to run benchmarks with" "40" ADVANCED) -sundials_option(SUNDIALS_BENCHMARK_NUM_GPUS STRING "Number of GPUs to run benchmarks with" "4" ADVANCED) +sundials_option(SUNDIALS_BENCHMARK_NUM_GPUS STRING + "Number of GPUs to run benchmarks with" "4" ADVANCED) diff --git a/cmake/SundialsDeprecated.cmake b/cmake/SundialsDeprecated.cmake index 385a11361b..a426ac1814 100644 --- a/cmake/SundialsDeprecated.cmake +++ b/cmake/SundialsDeprecated.cmake @@ -18,8 +18,10 @@ if(DEFINED F2003_INTERFACE_ENABLE) message(DEPRECATION "The CMake option F2003_INTERFACE_ENABLE is deprecated. " - "Use BUILD_FORTRAN_MODULE_INTERFACE instead.") - set(BUILD_FORTRAN_MODULE_INTERFACE ${F2003_INTERFACE_ENABLE} CACHE BOOL "Enable Fortran 2003 module interfaces") + "Use BUILD_FORTRAN_MODULE_INTERFACE instead.") + set(BUILD_FORTRAN_MODULE_INTERFACE + ${F2003_INTERFACE_ENABLE} + CACHE BOOL "Enable Fortran 2003 module interfaces") endif() unset(F2003_INTERFACE_ENABLE CACHE) @@ -30,115 +32,146 @@ unset(F2003_INTERFACE_ENABLE CACHE) if(DEFINED MPI_ENABLE) message(DEPRECATION "The CMake option MPI_ENABLE is deprecated. " - "Use ENABLE_MPI instead.") - set(ENABLE_MPI ${MPI_ENABLE} CACHE BOOL "Enable MPI support" FORCE) + "Use ENABLE_MPI instead.") + set(ENABLE_MPI + ${MPI_ENABLE} + CACHE BOOL "Enable MPI support" FORCE) unset(MPI_ENABLE CACHE) endif() if(DEFINED OPENMP_ENABLE) message(DEPRECATION "The CMake option OPENMP_ENABLE is deprecated. " - "Use ENABLE_OPENMP instead.") - set(ENABLE_OPENMP ${OPENMP_ENABLE} CACHE BOOL "Enable OpenMP support" FORCE) + "Use ENABLE_OPENMP instead.") + set(ENABLE_OPENMP + ${OPENMP_ENABLE} + CACHE BOOL "Enable OpenMP support" FORCE) unset(OPENMP_ENABLE CACHE) endif() if(DEFINED OPENMP_DEVICE_ENABLE) message(DEPRECATION "The CMake option OPENMP_DEVICE_ENABLE is deprecated. " - "Use ENABLE_OPENMP_DEVICE instead.") - set(ENABLE_OPENMP_DEVICE ${OPENMP_DEVICE_ENABLE} CACHE BOOL - "Enable OpenMP device offloading support" FORCE) + "Use ENABLE_OPENMP_DEVICE instead.") + set(ENABLE_OPENMP_DEVICE + ${OPENMP_DEVICE_ENABLE} + CACHE BOOL "Enable OpenMP device offloading support" FORCE) unset(OPENMP_DEVICE_ENABLE CACHE) endif() if(DEFINED SKIP_OPENMP_DEVICE_CHECK) - message(DEPRECATION "The CMake option SKIP_OPENMP_DEVICE_CHECK is deprecated. " - "Use OPENMP_DEVICE_WORKS instead.") - set(OPENMP_DEVICE_WORKS ${SKIP_OPENMP_DEVICE_CHECK} CACHE BOOL - "Skip the compiler check for OpenMP device offloading" FORCE) + message( + DEPRECATION "The CMake option SKIP_OPENMP_DEVICE_CHECK is deprecated. " + "Use OPENMP_DEVICE_WORKS instead.") + set(OPENMP_DEVICE_WORKS + ${SKIP_OPENMP_DEVICE_CHECK} + CACHE BOOL "Skip the compiler check for OpenMP device offloading" FORCE) unset(SKIP_OPENMP_DEVICE_CHECK CACHE) endif() if(DEFINED PTHREAD_ENABLE) message(DEPRECATION "The CMake option PTHREAD_ENABLE is deprecated. " - "Use ENABLE_PTHREAD instead") - set(ENABLE_PTHREAD ${PTHREAD_ENABLE} CACHE BOOL "Enable Pthreads support" FORCE) + "Use ENABLE_PTHREAD instead") + set(ENABLE_PTHREAD + ${PTHREAD_ENABLE} + CACHE BOOL "Enable Pthreads support" FORCE) unset(PTHREAD_ENABLE CACHE) endif() if(DEFINED CUDA_ENABLE) message(DEPRECATION "The CMake option CUDA_ENABLE is deprecated. " - "Use ENABLE_CUDA instead.") - set(ENABLE_CUDA ${CUDA_ENABLE} CACHE BOOL "Enable CUDA support" FORCE) + "Use ENABLE_CUDA instead.") + set(ENABLE_CUDA + ${CUDA_ENABLE} + CACHE BOOL "Enable CUDA support" FORCE) unset(CUDA_ENABLE CACHE) endif() if(DEFINED LAPACK_ENABLE) message(DEPRECATION "The CMake option LAPACK_ENABLE is deprecated. " - "Use ENABLE_LAPACK instead.") - set(ENABLE_LAPACK ${LAPACK_ENABLE} CACHE BOOL "Enable LAPACK support" FORCE) + "Use ENABLE_LAPACK instead.") + set(ENABLE_LAPACK + ${LAPACK_ENABLE} + CACHE BOOL "Enable LAPACK support" FORCE) unset(LAPACK_ENABLE CACHE) endif() if(DEFINED SUPERLUDIST_ENABLE) message(DEPRECATION "The CMake option SUPERLUDIST_ENABLE is deprecated. " - "Use ENABLE_SUPERLUDIST instead.") - set(ENABLE_SUPERLUDIST ${SUPERLUDIST_ENABLE} CACHE BOOL "Enable SuperLU_DIST support" FORCE) + "Use ENABLE_SUPERLUDIST instead.") + set(ENABLE_SUPERLUDIST + ${SUPERLUDIST_ENABLE} + CACHE BOOL "Enable SuperLU_DIST support" FORCE) unset(SUPERLUDIST_ENABLE CACHE) endif() # Deprecated with SUNDIALS 6.4.0 if(DEFINED SUPERLUDIST_LIBRARY_DIR) message(DEPRECATION "The CMake option SUPERLUDIST_LIBRARY_DIR is deprecated. " - "Use SUPERLUDIST_DIR instead.") - set(SUPERLUDIST_DIR "${SUPERLUDIST_LIBRARY_DIR}/../" CACHE BOOL "SuperLU_DIST root directory" FORCE) + "Use SUPERLUDIST_DIR instead.") + set(SUPERLUDIST_DIR + "${SUPERLUDIST_LIBRARY_DIR}/../" + CACHE BOOL "SuperLU_DIST root directory" FORCE) unset(SUPERLUDIST_LIBRARY_DIR CACHE) endif() if(DEFINED SUPERLUDIST_INCLUDE_DIR) message(DEPRECATION "The CMake option SUPERLUDIST_INCLUDE_DIR is deprecated. " - "Use SUPERLUDIST_INCLUDE_DIRS instead.") - set(SUPERLUDIST_INCLUDE_DIRS "${SUPERLUDIST_INCLUDE_DIR}" CACHE BOOL "SuperLU_DIST include directoroes" FORCE) + "Use SUPERLUDIST_INCLUDE_DIRS instead.") + set(SUPERLUDIST_INCLUDE_DIRS + "${SUPERLUDIST_INCLUDE_DIR}" + CACHE BOOL "SuperLU_DIST include directoroes" FORCE) unset(SUPERLUDIST_INCLUDE_DIR CACHE) endif() if(DEFINED SUPERLUMT_ENABLE) message(DEPRECATION "The CMake option SUPERLUMT_ENABLE is deprecated. " - "Use ENABLE_SUPERLUMT instead.") - set(ENABLE_SUPERLUMT ${SUPERLUMT_ENABLE} CACHE BOOL "Enable SuperLU_MT support" FORCE) + "Use ENABLE_SUPERLUMT instead.") + set(ENABLE_SUPERLUMT + ${SUPERLUMT_ENABLE} + CACHE BOOL "Enable SuperLU_MT support" FORCE) unset(SUPERLUMT_ENABLE CACHE) endif() if(DEFINED KLU_ENABLE) message(DEPRECATION "The CMake option KLU_ENABLE is deprecated. " - "Use ENABLE_KLU instead.") - set(ENABLE_KLU ${KLU_ENABLE} CACHE BOOL "Enable KLU support" FORCE) + "Use ENABLE_KLU instead.") + set(ENABLE_KLU + ${KLU_ENABLE} + CACHE BOOL "Enable KLU support" FORCE) unset(KLU_ENABLE CACHE) endif() if(DEFINED HYPRE_ENABLE) message(DEPRECATION "The CMake option HYPRE_ENABLE is deprecated. " - "Use ENABLE_HYPRE instead.") - set(ENABLE_HYPRE ${HYPRE_ENABLE} CACHE BOOL "Enable HYPRE support" FORCE) + "Use ENABLE_HYPRE instead.") + set(ENABLE_HYPRE + ${HYPRE_ENABLE} + CACHE BOOL "Enable HYPRE support" FORCE) unset(HYPRE_ENABLE CACHE) endif() if(DEFINED PETSC_ENABLE) message(DEPRECATION "The CMake option PETSC_ENABLE is deprecated. " - "Use ENABLE_PETSC instead.") - set(ENABLE_PETSC ${PETSC_ENABLE} CACHE BOOL "Enable PETSC support" FORCE) + "Use ENABLE_PETSC instead.") + set(ENABLE_PETSC + ${PETSC_ENABLE} + CACHE BOOL "Enable PETSC support" FORCE) unset(PETSC_ENABLE CACHE) endif() if(DEFINED Trilinos_ENABLE) message(DEPRECATION "The CMake option Trilinos_ENABLE is deprecated. " - "Use ENABLE_TRILINOS instead.") - set(ENABLE_TRILINOS ${Trilinos_ENABLE} CACHE BOOL "Enable Trilinos support" FORCE) + "Use ENABLE_TRILINOS instead.") + set(ENABLE_TRILINOS + ${Trilinos_ENABLE} + CACHE BOOL "Enable Trilinos support" FORCE) unset(Trilinos_ENABLE CACHE) endif() if(DEFINED RAJA_ENABLE) message(DEPRECATION "The CMake option RAJA_ENABLE is deprecated. " - "Use ENABLE_RAJA instead.") - set(ENABLE_RAJA ${RAJA_ENABLE} CACHE BOOL "Enable RAJA support" FORCE) + "Use ENABLE_RAJA instead.") + set(ENABLE_RAJA + ${RAJA_ENABLE} + CACHE BOOL "Enable RAJA support" FORCE) unset(RAJA_ENABLE CACHE) endif() @@ -148,9 +181,11 @@ endif() if(DEFINED CUDA_ARCH) print_warning("The CMake option CUDA_ARCH is deprecated. " - "Use CMAKE_CUDA_ARCHITECTURES instead.") + "Use CMAKE_CUDA_ARCHITECTURES instead.") # convert sm_** to just ** string(REGEX MATCH "[0-9]+" arch_name "${CUDA_ARCH}") - set(CMAKE_CUDA_ARCHITECTURES ${arch_name} CACHE STRING "CUDA Architectures" FORCE) + set(CMAKE_CUDA_ARCHITECTURES + ${arch_name} + CACHE STRING "CUDA Architectures" FORCE) unset(CUDA_ARCH) endif() diff --git a/cmake/SundialsExampleOptions.cmake b/cmake/SundialsExampleOptions.cmake index 40d692771f..8d54377bd6 100644 --- a/cmake/SundialsExampleOptions.cmake +++ b/cmake/SundialsExampleOptions.cmake @@ -22,9 +22,16 @@ sundials_option(EXAMPLES_ENABLE_C BOOL "Build SUNDIALS C examples" ON) # Some TPLs only have C++ examples. Default the C++ examples to ON if any of # these are enabled on the initial configuration pass. -if (ENABLE_TRILINOS OR ENABLE_SUPERLUDIST OR ENABLE_XBRAID OR ENABLE_HIP OR - ENABLE_MAGMA OR ENABLE_SYCL OR ENABLE_ONEMKL OR ENABLE_RAJA OR ENABLE_GINKGO OR - ENABLE_KOKKOS) +if(ENABLE_TRILINOS + OR ENABLE_SUPERLUDIST + OR ENABLE_XBRAID + OR ENABLE_HIP + OR ENABLE_MAGMA + OR ENABLE_SYCL + OR ENABLE_ONEMKL + OR ENABLE_RAJA + OR ENABLE_GINKGO + OR ENABLE_KOKKOS) sundials_option(EXAMPLES_ENABLE_CXX BOOL "Build SUNDIALS C++ examples" ON) else() sundials_option(EXAMPLES_ENABLE_CXX BOOL "Build SUNDIALS C++ examples" OFF) @@ -34,24 +41,30 @@ endif() # Options for Fortran Examples # ----------------------------------------------------------------------------- -# F2003 examples (on by default) are an option only if the -# Fortran 2003 interface is enabled. +# F2003 examples (on by default) are an option only if the Fortran 2003 +# interface is enabled. set(DOCSTR "Build SUNDIALS Fortran 2003 examples") if(BUILD_FORTRAN_MODULE_INTERFACE) - set(EXAMPLES_ENABLE_F2003 ON CACHE BOOL "${DOCSTR}") + set(EXAMPLES_ENABLE_F2003 + ON + CACHE BOOL "${DOCSTR}") # Fortran 2003 examples only support double precision if(EXAMPLES_ENABLE_F2003 AND (NOT (SUNDIALS_PRECISION MATCHES "DOUBLE"))) - message(WARNING "F2003 examples are not compatible with ${SUNDIALS_PRECISION} precision. " - "Setting EXAMPLES_ENABLE_F2003 to OFF.") + message( + WARNING + "F2003 examples are not compatible with ${SUNDIALS_PRECISION} precision. " + "Setting EXAMPLES_ENABLE_F2003 to OFF.") force_variable(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" OFF) endif() else() # set back to OFF (in case it was ON) if(EXAMPLES_ENABLE_F2003) - message(WARNING "EXAMPLES_ENABLE_F2003 is ON but BUILD_FORTRAN_MODULE_INTERFACE is OFF. " - "Setting EXAMPLES_ENABLE_F2003 to OFF.") + message( + WARNING + "EXAMPLES_ENABLE_F2003 is ON but BUILD_FORTRAN_MODULE_INTERFACE is OFF. " + "Setting EXAMPLES_ENABLE_F2003 to OFF.") force_variable(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" OFF) endif() @@ -71,25 +84,33 @@ sundials_option(EXAMPLES_ENABLE_CUDA BOOL "Build SUNDIALS CUDA examples" ON # Enable installing examples by default sundials_option(EXAMPLES_INSTALL BOOL "Install SUNDIALS examples" ON) -sundials_option(EXAMPLES_INSTALL_PATH PATH "Output directory for installing example files" "${CMAKE_INSTALL_PREFIX}/examples") +sundials_option( + EXAMPLES_INSTALL_PATH PATH "Output directory for installing example files" + "${CMAKE_INSTALL_PREFIX}/examples") # If examples are to be exported, check where we should install them. if(EXAMPLES_INSTALL AND NOT EXAMPLES_INSTALL_PATH) - message(WARNING "The example installation path is empty. Example installation " - "path was reset to its default value") - set(EXAMPLES_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/examples" CACHE STRING - "Output directory for installing example files" FORCE) + message( + WARNING "The example installation path is empty. Example installation " + "path was reset to its default value") + set(EXAMPLES_INSTALL_PATH + "${CMAKE_INSTALL_PREFIX}/examples" + CACHE STRING "Output directory for installing example files" FORCE) endif() # ----------------------------------------------------------------------------- # Internal variables. # ----------------------------------------------------------------------------- -if(EXAMPLES_ENABLE_C OR - EXAMPLES_ENABLE_CXX OR - EXAMPLES_ENABLE_CUDA OR - EXAMPLES_ENABLE_F2003) - set(_BUILD_EXAMPLES TRUE CACHE INTERNAL "") +if(EXAMPLES_ENABLE_C + OR EXAMPLES_ENABLE_CXX + OR EXAMPLES_ENABLE_CUDA + OR EXAMPLES_ENABLE_F2003) + set(_BUILD_EXAMPLES + TRUE + CACHE INTERNAL "") else() - set(_BUILD_EXAMPLES FALSE CACHE INTERNAL "") + set(_BUILD_EXAMPLES + FALSE + CACHE INTERNAL "") endif() diff --git a/cmake/SundialsIndexSize.cmake b/cmake/SundialsIndexSize.cmake index 6498637bd3..f8f4836144 100644 --- a/cmake/SundialsIndexSize.cmake +++ b/cmake/SundialsIndexSize.cmake @@ -24,8 +24,9 @@ include(CheckTypeSize) if(SUNDIALS_INDEX_SIZE MATCHES "64") set(SUNDIALS_CINDEX_TYPE "") - # if the user specified an index type use it, otherwise try the standard options - if (SUNDIALS_INDEX_TYPE) + # if the user specified an index type use it, otherwise try the standard + # options + if(SUNDIALS_INDEX_TYPE) set(POSSIBLE_INT64 ${SUNDIALS_INDEX_TYPE}) else() set(POSSIBLE_INT64 int64_t;__int64;long long;long) @@ -42,8 +43,11 @@ if(SUNDIALS_INDEX_SIZE MATCHES "64") endforeach() if(NOT SUNDIALS_CINDEX_TYPE) - message(FATAL_ERROR "No integer type of size 8 was found. Tried " - "${POSSIBLE_INT64}. Try setting the advanced option SUNDIALS_INDEX_TYPE.") + message( + FATAL_ERROR + "No integer type of size 8 was found. Tried " + "${POSSIBLE_INT64}. Try setting the advanced option SUNDIALS_INDEX_TYPE." + ) endif() # set Fortran integer size too @@ -51,8 +55,9 @@ if(SUNDIALS_INDEX_SIZE MATCHES "64") elseif(SUNDIALS_INDEX_SIZE MATCHES "32") set(SUNDIALS_CINDEX_TYPE "") - # if the user specified an index type use it, otherwise try the standard options - if (SUNDIALS_INDEX_TYPE) + # if the user specified an index type use it, otherwise try the standard + # options + if(SUNDIALS_INDEX_TYPE) set(POSSIBLE_INT32 ${SUNDIALS_INDEX_TYPE}) else() set(POSSIBLE_INT32 int32_t;int;long) @@ -69,8 +74,11 @@ elseif(SUNDIALS_INDEX_SIZE MATCHES "32") endforeach() if(NOT SUNDIALS_CINDEX_TYPE) - message(FATAL_ERROR "No integer type of size 4 was found. Tried " - "${POSSIBLE_INT32}. Try setting the advanced option SUNDIALS_INDEX_TYPE.") + message( + FATAL_ERROR + "No integer type of size 4 was found. Tried " + "${POSSIBLE_INT32}. Try setting the advanced option SUNDIALS_INDEX_TYPE." + ) endif() # set Fortran integer size too diff --git a/cmake/SundialsSetupCXX.cmake b/cmake/SundialsSetupCXX.cmake index 32a6a9b003..f4967f16cc 100644 --- a/cmake/SundialsSetupCXX.cmake +++ b/cmake/SundialsSetupCXX.cmake @@ -19,24 +19,21 @@ enable_language(CXX) set(CXX_FOUND TRUE) # --------------------------------------------------------------- -# Option to specify the C++ standard SUNDIALS will use. Defined -# here so it is set in the same configuration pass as the C++ -# compiler and related options. +# Option to specify the C++ standard SUNDIALS will use. Defined here so it is +# set in the same configuration pass as the C++ compiler and related options. # --------------------------------------------------------------- # Do not allow decaying to previous standards -- generates error if the standard # is not supported -sundials_option(CMAKE_CXX_STANDARD_REQUIRED BOOL - "Require C++ standard version" ON) +sundials_option(CMAKE_CXX_STANDARD_REQUIRED BOOL "Require C++ standard version" + ON) if(ENABLE_SYCL) set(DOCSTR "The C++ standard to use if C++ is enabled (17, 20)") - sundials_option(CMAKE_CXX_STANDARD STRING "${DOCSTR}" "17" - OPTIONS "17;20") + sundials_option(CMAKE_CXX_STANDARD STRING "${DOCSTR}" "17" OPTIONS "17;20") else() set(DOCSTR "The C++ standard to use if C++ is enabled (14, 17, 20)") - sundials_option(CMAKE_CXX_STANDARD STRING "${DOCSTR}" "14" - OPTIONS "14;17;20") + sundials_option(CMAKE_CXX_STANDARD STRING "${DOCSTR}" "14" OPTIONS "14;17;20") endif() message(STATUS "CXX standard set to ${CMAKE_CXX_STANDARD}") diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index 7790f61609..797c743a3f 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -25,12 +25,12 @@ include(SundialsIndexSize) # =============================================================== if(WIN32) - # Under Windows, add compiler directive to inhibit warnings - # about use of unsecure functions. + # Under Windows, add compiler directive to inhibit warnings about use of + # unsecure functions. add_compile_definitions(_CRT_SECURE_NO_WARNINGS) - # Under Windows, we need to have dll and exe files in the - # same directory to run the test suite properly. + # Under Windows, we need to have dll and exe files in the same directory to + # run the test suite properly. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") @@ -38,7 +38,8 @@ endif() if(APPLE) # Allow undefined symbols that will be resolved by a user program. - set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup") + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS + "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup") endif() # =============================================================== @@ -50,18 +51,20 @@ if(BUILD_SHARED_LIBS) # use, i.e. don't skip the full RPATH for the build tree set(CMAKE_SKIP_BUILD_RPATH FALSE) - # when building, don't use the install RPATH already - # (but later on when installing) + # when building, don't use the install RPATH already (but later on when + # installing) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") - # add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH + # add the automatically determined parts of the RPATH which point to + # directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - # the RPATH to be used when installing, but only if it's not a system directory - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir) + # the RPATH to be used when installing, but only if it's not a system + # directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir) if("${isSystemDir}" STREQUAL "-1") set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") endif() @@ -82,7 +85,8 @@ if(ENABLE_ALL_WARNINGS) set(CMAKE_CXX_FLAGS "-Wdouble-promotion ${CMAKE_CXX_FLAGS}") endif() - if((SUNDIALS_PRECISION MATCHES "DOUBLE") AND (SUNDIALS_INDEX_SIZE MATCHES "32")) + if((SUNDIALS_PRECISION MATCHES "DOUBLE") AND (SUNDIALS_INDEX_SIZE MATCHES "32" + )) set(CMAKE_C_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_CXX_FLAGS}") endif() @@ -100,15 +104,17 @@ if(ENABLE_ALL_WARNINGS) # to use gfortran > 5.5 which segfaults with -fcheck=array-temps,bounds,do,mem # no- options were added in gfortran 6 # - # Exclude run-time pointer checks (no-pointer) because passing null objects - # to SUNDIALS functions (e.g., sunmat => null() to SetLinearSolver) causes a + # Exclude run-time pointer checks (no-pointer) because passing null objects to + # SUNDIALS functions (e.g., sunmat => null() to SetLinearSolver) causes a # run-time error with this check # # Exclude checks for subroutines and functions not marked as recursive # (no-recursion) e.g., ark_brusselator1D_task_local_nls_f2003 calls # SUNNonlinsolFree from within a custom nonlinear solver implementation of # SUNNonlinsolFree which causes a run-time error with this check - set(CMAKE_Fortran_FLAGS "-Wall -Wpedantic -Wno-unused-dummy-argument -Wno-c-binding-type -ffpe-summary=none ${CMAKE_Fortran_FLAGS}") + set(CMAKE_Fortran_FLAGS + "-Wall -Wpedantic -Wno-unused-dummy-argument -Wno-c-binding-type -ffpe-summary=none ${CMAKE_Fortran_FLAGS}" + ) endif() if(ENABLE_WARNINGS_AS_ERRORS) @@ -122,16 +128,22 @@ endif() if(ENABLE_ADDRESS_SANITIZER) message(STATUS "Enabling address sanitizer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined") + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined" + ) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined" + ) + set(CMAKE_Fortran_FLAGS + "${CMAKE_Fortran_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined" + ) endif() if(SUNDIALS_DEBUG) message(STATUS "Adding debugging preprocessor directives") foreach(debug ${_SUNDIALS_DEBUG_OPTIONS}) - if (${${debug}}) + if(${${debug}}) add_compile_definitions(${debug}) endif() endforeach() @@ -142,8 +154,7 @@ endif() # =============================================================== set(DOCSTR "The C standard to use (99, 11, 17)") -sundials_option(CMAKE_C_STANDARD STRING "${DOCSTR}" "99" - OPTIONS "99;11;17") +sundials_option(CMAKE_C_STANDARD STRING "${DOCSTR}" "99" OPTIONS "99;11;17") message(STATUS "C standard set to ${CMAKE_C_STANDARD}") set(DOCSTR "Enable C compiler specific extensions") @@ -154,7 +165,8 @@ message(STATUS "C extensions set to ${CMAKE_C_EXTENSIONS}") # Check for __builtin_expect # --------------------------------------------------------------- -check_c_source_compiles(" +check_c_source_compiles( + " #include int main(void) { double a = 0.0; @@ -165,14 +177,16 @@ check_c_source_compiles(" printf(\"a=%g\", a); return 0; } -" SUNDIALS_C_COMPILER_HAS_BUILTIN_EXPECT) +" + SUNDIALS_C_COMPILER_HAS_BUILTIN_EXPECT) # --------------------------------------------------------------- # Check for assume related extensions # --------------------------------------------------------------- # gcc >= 13 should have __attribute__((assume)) -check_c_source_compiles(" +check_c_source_compiles( + " #include int main(void) { double a = 0.0; @@ -188,11 +202,13 @@ check_c_source_compiles(" printf(\"a=%g\", a); return 0; } -" SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME) +" + SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME) # LLVM based compilers should have __builtin_assume if(NOT SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME) - check_c_source_compiles(" + check_c_source_compiles( + " #include int main(void) { double a = 0.0; @@ -201,12 +217,15 @@ if(NOT SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME) printf(\"a=%g\", a); return 0; } - " SUNDIALS_C_COMPILER_HAS_BUILTIN_ASSUME) + " + SUNDIALS_C_COMPILER_HAS_BUILTIN_ASSUME) endif() # MSVC provides __assume -if(NOT (SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME OR SUNDIALS_C_COMPILER_HAS_BUILTIN_ASSUME)) - check_c_source_compiles(" +if(NOT (SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME + OR SUNDIALS_C_COMPILER_HAS_BUILTIN_ASSUME)) + check_c_source_compiles( + " #include int main(void) { double a = 0.0; @@ -215,19 +234,22 @@ if(NOT (SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME OR SUNDIALS_C_COMPILER_HAS_BUIL printf(\"a=%g\", a); return 0; } - " SUNDIALS_C_COMPILER_HAS_ASSUME) + " + SUNDIALS_C_COMPILER_HAS_ASSUME) endif() # --------------------------------------------------------------- # Check for unused extension # --------------------------------------------------------------- -check_c_source_compiles(" +check_c_source_compiles( + " int main(void) { __attribute__((unused)) double a = 0.0; return 0; } -" SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_UNUSED) +" + SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_UNUSED) # --------------------------------------------------------------- # Check for POSIX timers @@ -236,25 +258,29 @@ include(SundialsPOSIXTimers) if(SUNDIALS_POSIX_TIMERS AND POSIX_TIMERS_NEED_POSIX_C_SOURCE) set(DOCSTR "Value of _POSIX_C_SOURCE") - sundials_option(SUNDIALS_POSIX_C_SOURCE STRING "${DOCSTR}" "200112L" - ADVANCED) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE=${SUNDIALS_POSIX_C_SOURCE}") + sundials_option(SUNDIALS_POSIX_C_SOURCE STRING "${DOCSTR}" "200112L" ADVANCED) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE=${SUNDIALS_POSIX_C_SOURCE}") endif() - # --------------------------------------------------------------- # Check for deprecated attribute with message # --------------------------------------------------------------- if(WIN32) - set(COMPILER_DEPRECATED_MSG_ATTRIBUTE "__declspec(deprecated(msg))" CACHE INTERNAL "") + set(COMPILER_DEPRECATED_MSG_ATTRIBUTE + "__declspec(deprecated(msg))" + CACHE INTERNAL "") else() - set(COMPILER_DEPRECATED_MSG_ATTRIBUTE "__attribute__ ((__deprecated__(msg)))" CACHE INTERNAL "") + set(COMPILER_DEPRECATED_MSG_ATTRIBUTE + "__attribute__ ((__deprecated__(msg)))" + CACHE INTERNAL "") endif() -check_c_source_compiles(" +check_c_source_compiles( + " #define msg \"test\" ${COMPILER_DEPRECATED_MSG_ATTRIBUTE} int somefunc(void) { return 0; } - int main(void) { return somefunc();}" COMPILER_HAS_DEPRECATED_MSG -) + int main(void) { return somefunc();}" + COMPILER_HAS_DEPRECATED_MSG) # =============================================================== # Fortran settings @@ -282,24 +308,22 @@ endif() # The case to use in the name-mangling scheme sundials_option(SUNDIALS_LAPACK_CASE STRING - "case of LAPACK function names (lower/upper)" - "" - ADVANCED) + "case of LAPACK function names (lower/upper)" "" ADVANCED) # The number of underscores of appended in the name-mangling scheme -sundials_option(SUNDIALS_LAPACK_UNDERSCORES STRING - "number of underscores appended to LAPACK function names (none/one/two)" - "" - ADVANCED) +sundials_option( + SUNDIALS_LAPACK_UNDERSCORES STRING + "number of underscores appended to LAPACK function names (none/one/two)" "" + ADVANCED) # If used, both case and underscores must be set if((NOT SUNDIALS_LAPACK_CASE) AND SUNDIALS_LAPACK_UNDERSCORES) message(FATAL_ERROR "If SUNDIALS_LAPACK_UNDERSCORES is set, " - "SUNDIALS_LAPACK_CASE must also be set.") + "SUNDIALS_LAPACK_CASE must also be set.") endif() if(SUNDIALS_LAPACK_CASE AND (NOT SUNDIALS_LAPACK_UNDERSCORES)) message(FATAL_ERROR "If SUNDIALS_LAPACK_CASE is set, " - "SUNDIALS_LAPACK_UNDERSCORES must also be set.") + "SUNDIALS_LAPACK_UNDERSCORES must also be set.") endif() # Did the user provide a name-mangling scheme? @@ -318,11 +342,15 @@ if(SUNDIALS_LAPACK_CASE AND SUNDIALS_LAPACK_UNDERSCORES) set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name") set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name") elseif(SUNDIALS_LAPACK_UNDERSCORES MATCHES "ONE") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## _") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## _") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## _") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## _") elseif(SUNDIALS_LAPACK_UNDERSCORES MATCHES "TWO") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## __") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## __") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## __") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## __") else() message(FATAL_ERROR "Invalid SUNDIALS_LAPACK_UNDERSCORES option.") endif() @@ -331,11 +359,15 @@ if(SUNDIALS_LAPACK_CASE AND SUNDIALS_LAPACK_UNDERSCORES) set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME") set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME") elseif(SUNDIALS_LAPACK_UNDERSCORES MATCHES "ONE") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## _") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## _") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## _") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## _") elseif(SUNDIALS_LAPACK_UNDERSCORES MATCHES "TWO") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## __") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## __") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## __") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## __") else() message(FATAL_ERROR "Invalid SUNDIALS_LAPACK_UNDERSCORES option.") endif() @@ -346,16 +378,13 @@ if(SUNDIALS_LAPACK_CASE AND SUNDIALS_LAPACK_UNDERSCORES) # name-mangling scheme has been manually set set(NEED_FORTRAN_NAME_MANGLING FALSE) - configure_file( - ${PROJECT_SOURCE_DIR}/src/sundials/sundials_lapack_defs.h.in - ${PROJECT_BINARY_DIR}/src/sundials/sundials_lapack_defs.h - ) + configure_file(${PROJECT_SOURCE_DIR}/src/sundials/sundials_lapack_defs.h.in + ${PROJECT_BINARY_DIR}/src/sundials/sundials_lapack_defs.h) endif() # Do we need a Fortran compiler? -if(BUILD_FORTRAN_MODULE_INTERFACE OR - NEED_FORTRAN_NAME_MANGLING) +if(BUILD_FORTRAN_MODULE_INTERFACE OR NEED_FORTRAN_NAME_MANGLING) include(SundialsSetupFortran) endif() @@ -363,17 +392,19 @@ endif() # C++ settings # =============================================================== -if(BUILD_BENCHMARKS OR SUNDIALS_TEST_UNITTESTS OR EXAMPLES_ENABLE_CXX OR - ENABLE_CUDA OR - ENABLE_HIP OR - ENABLE_SYCL OR - ENABLE_RAJA OR - ENABLE_TRILINOS OR - ENABLE_SUPERLUDIST OR - ENABLE_MAGMA OR - ENABLE_GINKGO OR - ENABLE_KOKKOS OR - ENABLE_ADIAK) +if(BUILD_BENCHMARKS + OR SUNDIALS_TEST_UNITTESTS + OR EXAMPLES_ENABLE_CXX + OR ENABLE_CUDA + OR ENABLE_HIP + OR ENABLE_SYCL + OR ENABLE_RAJA + OR ENABLE_TRILINOS + OR ENABLE_SUPERLUDIST + OR ENABLE_MAGMA + OR ENABLE_GINKGO + OR ENABLE_KOKKOS + OR ENABLE_ADIAK) include(SundialsSetupCXX) endif() @@ -416,8 +447,8 @@ endif() # Upper case version of build type string(TOUPPER "${CMAKE_BUILD_TYPE}" _cmake_build_type) -# Make build type specific flag options ADVANCED, -# except for the one corresponding to the current build type +# Make build type specific flag options ADVANCED, except for the one +# corresponding to the current build type foreach(lang ${_SUNDIALS_ENABLED_LANGS}) foreach(build_type DEBUG;RELEASE;RELWITHDEBINFO;MINSIZEREL) if("${_cmake_build_type}" STREQUAL "${build_type}") @@ -431,7 +462,6 @@ foreach(lang ${_SUNDIALS_ENABLED_LANGS}) mark_as_advanced(CLEAR CMAKE_${lang}_COMPILER CMAKE_${lang}_FLAGS) endforeach() - # =============================================================== # Configure compilers for installed examples # =============================================================== @@ -439,14 +469,17 @@ endforeach() foreach(lang ${_SUNDIALS_ENABLED_LANGS}) if(ENABLE_MPI) if(DEFINED MPI_${lang}_COMPILER) - set(_EXAMPLES_${lang}_COMPILER "${MPI_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_${lang}_COMPILER + "${MPI_${lang}_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") endif() else() - set(_EXAMPLES_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_${lang}_COMPILER + "${CMAKE_${lang}_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") endif() endforeach() - # =============================================================== # Configure clang-tidy for linting # =============================================================== @@ -456,7 +489,7 @@ set(SUNDIALS_DEV_CLANG_TIDY_DIR ${CMAKE_BINARY_DIR}/clang-tidy/) if(SUNDIALS_DEV_CLANG_TIDY) find_program(CLANG_TIDY_PATH NAMES clang-tidy) if(NOT CLANG_TIDY_PATH) - message(FATAL_ERROR "Could not find the program clang-tidy") + message(FATAL_ERROR "Could not find the program clang-tidy") endif() message(STATUS "Found clang-tidy: ${CLANG_TIDY_PATH}") @@ -465,15 +498,12 @@ if(SUNDIALS_DEV_CLANG_TIDY) set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_PATH} -format-style='file' --fix) set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_PATH} -format-style='file' --fix) else() - set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_PATH} - -format-style='file' - --export-fixes=${SUNDIALS_DEV_CLANG_TIDY_DIR}/clang-tidy-fixes.yaml - ) + set(CMAKE_C_CLANG_TIDY + ${CLANG_TIDY_PATH} -format-style='file' + --export-fixes=${SUNDIALS_DEV_CLANG_TIDY_DIR}/clang-tidy-fixes.yaml) set(CMAKE_CXX_CLANG_TIDY - ${CLANG_TIDY_PATH} - -format-style='file' - --export-fixes=${SUNDIALS_DEV_CLANG_TIDY_DIR}/clang-tidy-cxx-fixes.yaml - ) + ${CLANG_TIDY_PATH} -format-style='file' + --export-fixes=${SUNDIALS_DEV_CLANG_TIDY_DIR}/clang-tidy-cxx-fixes.yaml) endif() endif() @@ -483,10 +513,10 @@ if(SUNDIALS_DEV_IWYU) message(FATAL_ERROR "Could not find the program include-what-you-use") endif() message(STATUS "Found IWYU: ${IWYU_PATH}") - set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH} - -Xiwyu --mapping_file=${CMAKE_SOURCE_DIR}/scripts/iwyu.imp - -Xiwyu --error_always) - set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH} - -Xiwyu --mapping_file=${CMAKE_SOURCE_DIR}/scripts/iwyu.imp - -Xiwyu --error_always) + set(CMAKE_C_INCLUDE_WHAT_YOU_USE + ${IWYU_PATH} -Xiwyu --mapping_file=${CMAKE_SOURCE_DIR}/scripts/iwyu.imp + -Xiwyu --error_always) + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + ${IWYU_PATH} -Xiwyu --mapping_file=${CMAKE_SOURCE_DIR}/scripts/iwyu.imp + -Xiwyu --error_always) endif() diff --git a/cmake/SundialsSetupConfig.cmake b/cmake/SundialsSetupConfig.cmake index 482a267ac4..e1ea1f1929 100644 --- a/cmake/SundialsSetupConfig.cmake +++ b/cmake/SundialsSetupConfig.cmake @@ -44,10 +44,9 @@ else() string(TIMESTAMP JOB_START_TIME "%Y%m%d%H%M%S") endif() - # ============================================================================ -# Generate macros and substitution variables related to TPLs -# that SUNDIALS is being built with. +# Generate macros and substitution variables related to TPLs that SUNDIALS is +# being built with. # ============================================================================ # prepare substitution variables for modules that have been built @@ -59,7 +58,8 @@ foreach(_item ${SUNDIALS_BUILD_LIST}) endif() endforeach() -# prepare substitution variable SUNDIALS_${TPL NAME}_ENABLED for sundials_config.h +# prepare substitution variable SUNDIALS_${TPL NAME}_ENABLED for +# sundials_config.h foreach(tpl ${SUNDIALS_TPL_LIST}) set(SUNDIALS_${tpl}_ENABLED TRUE) endforeach() @@ -94,7 +94,5 @@ endif() # Generate the header file and place it in the binary dir. # ============================================================================= -configure_file( - ${PROJECT_SOURCE_DIR}/include/sundials/sundials_config.in - ${PROJECT_BINARY_DIR}/include/sundials/sundials_config.h - ) +configure_file(${PROJECT_SOURCE_DIR}/include/sundials/sundials_config.in + ${PROJECT_BINARY_DIR}/include/sundials/sundials_config.h) diff --git a/cmake/SundialsSetupCuda.cmake b/cmake/SundialsSetupCuda.cmake index f971e691a6..8a0703336b 100644 --- a/cmake/SundialsSetupCuda.cmake +++ b/cmake/SundialsSetupCuda.cmake @@ -19,9 +19,11 @@ # =============================================================== if(NOT CMAKE_CUDA_HOST_COMPILER) - # If a user did not provide the host compiler, then we - # assume that they want to use the CXX compiler that was set. - set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH "NVCC host compiler") + # If a user did not provide the host compiler, then we assume that they want + # to use the CXX compiler that was set. + set(CMAKE_CUDA_HOST_COMPILER + ${CMAKE_CXX_COMPILER} + CACHE FILEPATH "NVCC host compiler") endif() # =============================================================== @@ -31,18 +33,19 @@ endif() # Do not allow decaying to previous standards -- generates error if the standard # is not supported sundials_option(CMAKE_CUDA_STANDARD_REQUIRED BOOL - "Require C++ standard version" ON) + "Require C++ standard version" ON) set(DOCSTR "The CUDA standard to use if CUDA is enabled (14, 17, 20)") sundials_option(CMAKE_CUDA_STANDARD STRING "${DOCSTR}" "${CMAKE_CXX_STANDARD}" OPTIONS "14;17;20") message(STATUS "CUDA standard set to ${CMAKE_CUDA_STANDARD}") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda --expt-relaxed-constexpr") +set(CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} --expt-extended-lambda --expt-relaxed-constexpr") -if( (CMAKE_CXX_COMPILER_ID MATCHES GNU) - OR (CMAKE_CXX_COMPILER_ID MATCHES Clang) - AND (CMAKE_SYSTEM_PROCESSOR MATCHES ppc64le) ) +if((CMAKE_CXX_COMPILER_ID MATCHES GNU) + OR (CMAKE_CXX_COMPILER_ID MATCHES Clang) + AND (CMAKE_SYSTEM_PROCESSOR MATCHES ppc64le)) include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-mno-float128 _hasflag) if(_hasflag) @@ -75,15 +78,19 @@ message(STATUS "CUDA Library Directory: ${CUDAToolkit_LIBRARY_DIR}") message(STATUS "CUDA Compile Flags: ${CMAKE_CUDA_FLAGS}") message(STATUS "CUDA Link Flags: ${CMAKE_CUDA_LINK_FLAGS}") message(STATUS "CUDA Link Executable: ${CMAKE_CUDA_LINK_EXECUTABLE}") -message(STATUS "CUDA Separable Compilation: ${CMAKE_CUDA_SEPARABLE_COMPILATION}") - +message( + STATUS "CUDA Separable Compilation: ${CMAKE_CUDA_SEPARABLE_COMPILATION}") # =============================================================== # Configure compiler for installed examples # =============================================================== if(ENABLE_MPI) - set(_EXAMPLES_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_CUDA_HOST_COMPILER + "${MPI_CXX_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") else() - set(_EXAMPLES_CUDA_HOST_COMPILER "${CMAKE_CUDA_HOST_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_CUDA_HOST_COMPILER + "${CMAKE_CUDA_HOST_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") endif() diff --git a/cmake/SundialsSetupFortran.cmake b/cmake/SundialsSetupFortran.cmake index de9beea905..bdef010422 100644 --- a/cmake/SundialsSetupFortran.cmake +++ b/cmake/SundialsSetupFortran.cmake @@ -39,7 +39,8 @@ if(BUILD_FORTRAN_MODULE_INTERFACE) file(MAKE_DIRECTORY ${F2003Test_DIR}) # Create a CMakeLists.txt file - file(WRITE ${F2003Test_DIR}/CMakeLists.txt + file( + WRITE ${F2003Test_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ftest Fortran)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -54,29 +55,42 @@ if(BUILD_FORTRAN_MODULE_INTERFACE) # Create a Fortran source file which tries to use iso_c_binding file(WRITE ${F2003Test_DIR}/ftest.f90 - "program main\n" - "use, intrinsic :: iso_c_binding\n" - "end program main\n") + "program main\n" "use, intrinsic :: iso_c_binding\n" + "end program main\n") # Attempt compile the executable - try_compile(FTEST_OK ${F2003Test_DIR} ${F2003Test_DIR} - ftest OUTPUT_VARIABLE COMPILE_OUTPUT) + try_compile( + FTEST_OK ${F2003Test_DIR} + ${F2003Test_DIR} ftest + OUTPUT_VARIABLE COMPILE_OUTPUT) - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove + # the CMakeFiles directory. file(REMOVE_RECURSE ${F2003Test_DIR}/CMakeFiles) if(FTEST_OK) - message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports F2003 -- yes") - set(F2003_FOUND TRUE CACHE BOOL "${CMAKE_Fortran_COMPILER} supports F2003" FORCE) + message( + STATUS + "Checking whether ${CMAKE_Fortran_COMPILER} supports F2003 -- yes") + set(F2003_FOUND + TRUE + CACHE BOOL "${CMAKE_Fortran_COMPILER} supports F2003" FORCE) else() - message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports F2003 -- no") + message( + STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports F2003 -- no" + ) message(STATUS "Check output:") message("${COMPILE_OUTPUT}") - message(FATAL_ERROR "BUILD_FORTRAN_MODULE_INTERFACE is set to ON, but the CMAKE_Fortran_COMPILER does not support F2003") + message( + FATAL_ERROR + "BUILD_FORTRAN_MODULE_INTERFACE is set to ON, but the CMAKE_Fortran_COMPILER does not support F2003" + ) endif() else() - message(STATUS "Skipped F2003 tests, assuming ${CMAKE_Fortran_COMPILER} supports the f2003 standard. To rerun the F2003 tests, set F2003_FOUND to FALSE.") + message( + STATUS + "Skipped F2003 tests, assuming ${CMAKE_Fortran_COMPILER} supports the f2003 standard. To rerun the F2003 tests, set F2003_FOUND to FALSE." + ) endif() endif() diff --git a/cmake/SundialsSetupHIP.cmake b/cmake/SundialsSetupHIP.cmake index bc5a6c3776..709e335d55 100644 --- a/cmake/SundialsSetupHIP.cmake +++ b/cmake/SundialsSetupHIP.cmake @@ -16,25 +16,37 @@ if(NOT DEFINED ROCM_PATH) if(NOT DEFINED ENV{ROCM_PATH}) - set(ROCM_PATH "/opt/rocm/" CACHE PATH "Path to which ROCm has been installed") + set(ROCM_PATH + "/opt/rocm/" + CACHE PATH "Path to which ROCm has been installed") else() - set(ROCM_PATH "$ENV{ROCM_PATH}" CACHE PATH "Path to which ROCm has been installed") + set(ROCM_PATH + "$ENV{ROCM_PATH}" + CACHE PATH "Path to which ROCm has been installed") endif() endif() if(NOT DEFINED HIP_PATH) if(NOT DEFINED ENV{HIP_PATH}) - set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed") + set(HIP_PATH + "/opt/rocm/hip" + CACHE PATH "Path to which HIP has been installed") else() - set(HIP_PATH "$ENV{HIP_PATH}" CACHE PATH "Path to which HIP has been installed") + set(HIP_PATH + "$ENV{HIP_PATH}" + CACHE PATH "Path to which HIP has been installed") endif() endif() if(NOT DEFINED HIP_PLATFORM) if(NOT DEFINED ENV{HIP_PLATFORM}) - set(HIP_PLATFORM "amd" CACHE STRING "HIP platform (amd, nvidia)") + set(HIP_PLATFORM + "amd" + CACHE STRING "HIP platform (amd, nvidia)") else() - set(HIP_PLATFORM "$ENV{HIP_PLATFORM}" CACHE STRING "HIP platform (amd, nvidia)") + set(HIP_PLATFORM + "$ENV{HIP_PLATFORM}" + CACHE STRING "HIP platform (amd, nvidia)") endif() endif() @@ -46,7 +58,8 @@ set(CMAKE_PREFIX_PATH "${ROCM_PATH};${HIP_PATH}") find_package(HIP REQUIRED) if("${HIP_COMPILER}" STREQUAL "hcc") - message(FATAL_ERROR "Deprecated HCC compiler is not supported" "Please update ROCm") + message(FATAL_ERROR "Deprecated HCC compiler is not supported" + "Please update ROCm") endif() message(STATUS "HIP version: ${HIP_VERSION}") diff --git a/cmake/SundialsSetupTPLs.cmake b/cmake/SundialsSetupTPLs.cmake index fe57c20a7c..d23bb95503 100644 --- a/cmake/SundialsSetupTPLs.cmake +++ b/cmake/SundialsSetupTPLs.cmake @@ -15,8 +15,8 @@ # --------------------------------------------------------------- # --------------------------------------------------------------- -# Setup MPI, OpenMP, and OpenMP offload first as other TPLs may -# need targets or variables corresponding to these TPLs. +# Setup MPI, OpenMP, and OpenMP offload first as other TPLs may need targets or +# variables corresponding to these TPLs. # --------------------------------------------------------------- # --------------------------------------------------------------- @@ -77,7 +77,6 @@ if(ENABLE_GINKGO) list(APPEND SUNDIALS_TPL_LIST "GINKGO") endif() - # --------------------------------------------------------------- # Find (and test) the hypre libraries # --------------------------------------------------------------- diff --git a/cmake/SundialsSetupTesting.cmake b/cmake/SundialsSetupTesting.cmake index 11a445900d..b261ffe385 100644 --- a/cmake/SundialsSetupTesting.cmake +++ b/cmake/SundialsSetupTesting.cmake @@ -18,17 +18,25 @@ include(CTest) # Check if development tests are enabled -if (SUNDIALS_TEST_DEVTESTS OR BUILD_BENCHMARKS) +if(SUNDIALS_TEST_DEVTESTS OR BUILD_BENCHMARKS) # Python is needed to use the test runner find_package(Python3 REQUIRED) # look for the testRunner script in the test directory - find_program(TESTRUNNER testRunner PATHS test NO_DEFAULT_PATH) + find_program( + TESTRUNNER testRunner + PATHS test + NO_DEFAULT_PATH) if(NOT TESTRUNNER) - message(FATAL_ERROR "Could not locate testRunner. Set SUNDIALS_TEST_DEVTESTS=OFF or BUILD_BENCHMARKS=OFF to continue.") + message( + FATAL_ERROR + "Could not locate testRunner. Set SUNDIALS_TEST_DEVTESTS=OFF or BUILD_BENCHMARKS=OFF to continue." + ) endif() message(STATUS "Found testRunner: ${TESTRUNNER}") - set(TESTRUNNER ${TESTRUNNER} CACHE INTERNAL "") + set(TESTRUNNER + ${TESTRUNNER} + CACHE INTERNAL "") endif() @@ -46,7 +54,9 @@ if(SUNDIALS_TEST_DEVTESTS) # If a non-default output directory was provided make sure it exists if(SUNDIALS_TEST_OUTPUT_DIR) - message(STATUS "Using non-default test output directory: ${SUNDIALS_TEST_OUTPUT_DIR}") + message( + STATUS + "Using non-default test output directory: ${SUNDIALS_TEST_OUTPUT_DIR}") if(NOT EXISTS ${SUNDIALS_TEST_OUTPUT_DIR}) file(MAKE_DIRECTORY ${SUNDIALS_TEST_OUTPUT_DIR}) endif() @@ -54,7 +64,9 @@ if(SUNDIALS_TEST_DEVTESTS) # If a non-default answer directory was provided make sure it exists if(SUNDIALS_TEST_ANSWER_DIR) - message(STATUS "Using non-default test answer directory: ${SUNDIALS_TEST_ANSWER_DIR}") + message( + STATUS + "Using non-default test answer directory: ${SUNDIALS_TEST_ANSWER_DIR}") if(NOT EXISTS ${SUNDIALS_TEST_ANSWER_DIR}) message(FATAL_ERROR "SUNDIALS_TEST_ANSWER_DIR does not exist!") endif() @@ -62,7 +74,10 @@ if(SUNDIALS_TEST_DEVTESTS) # If a non-default caliper output directory was provided make sure it exists if(SUNDIALS_CALIPER_OUTPUT_DIR) - message(STATUS "Using non-default caliper output directory: ${SUNDIALS_CALIPER_OUTPUT_DIR}") + message( + STATUS + "Using non-default caliper output directory: ${SUNDIALS_CALIPER_OUTPUT_DIR}" + ) if(NOT EXISTS ${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}) file(MAKE_DIRECTORY ${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}) endif() @@ -70,11 +85,16 @@ if(SUNDIALS_TEST_DEVTESTS) # Check if using non-default comparison precisions when testing if(SUNDIALS_TEST_FLOAT_PRECISION GREATER_EQUAL "0") - message(STATUS "Using non-default float precision: ${SUNDIALS_TEST_FLOAT_PRECISION}") + message( + STATUS + "Using non-default float precision: ${SUNDIALS_TEST_FLOAT_PRECISION}") endif() if(SUNDIALS_TEST_INTEGER_PRECISION GREATER_EQUAL "0") - message(STATUS "Using non-default integer precision: ${SUNDIALS_TEST_INTEGER_PRECISION}") + message( + STATUS + "Using non-default integer precision: ${SUNDIALS_TEST_INTEGER_PRECISION}" + ) endif() # @@ -85,32 +105,57 @@ if(SUNDIALS_TEST_DEVTESTS) if(NOT container_exe) find_program(container_exe podman) endif() - set(SUNDIALS_TEST_CONTAINER_EXE ${container_exe} CACHE PATH "Path to docker or podman" FORCE) + set(SUNDIALS_TEST_CONTAINER_EXE + ${container_exe} + CACHE PATH "Path to docker or podman" FORCE) endif() if(SUNDIALS_TEST_CONTAINER_EXE) - add_custom_target(setup_local_ci - ${CMAKE_COMMAND} -E cmake_echo_color --cyan - "Pulled SUNDIALS CI containers.") + add_custom_target(setup_local_ci ${CMAKE_COMMAND} -E cmake_echo_color + --cyan "Pulled SUNDIALS CI containers.") - add_custom_target(test_local_ci - ${CMAKE_COMMAND} -E cmake_echo_color --cyan - "All testing with SUNDIALS CI containers complete.") + add_custom_target( + test_local_ci ${CMAKE_COMMAND} -E cmake_echo_color --cyan + "All testing with SUNDIALS CI containers complete.") macro(add_local_ci_target index_size precision tag) string(TOLOWER "${precision}" precision_) set(container sundials-ci-int${index_size}-${precision_}) - set(container_exe_args run ${SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS} -t -d --name ${container} --cap-add SYS_PTRACE - -v ${CMAKE_SOURCE_DIR}:${SUNDIALS_TEST_CONTAINER_MNT} ghcr.io/llnl/${container}:${tag}) - add_custom_target(setup_local_ci_${index_size}_${precision_} + set(container_exe_args + run + ${SUNDIALS_TEST_CONTAINER_RUN_EXTRA_ARGS} + -t + -d + --name + ${container} + --cap-add + SYS_PTRACE + -v + ${CMAKE_SOURCE_DIR}:${SUNDIALS_TEST_CONTAINER_MNT} + ghcr.io/llnl/${container}:${tag}) + add_custom_target( + setup_local_ci_${index_size}_${precision_} COMMENT "Pulling SUNDIALS CI container ghcr.io/llnl/${container}:${tag}" COMMAND ${SUNDIALS_TEST_CONTAINER_EXE} ${container_exe_args}) - add_dependencies(setup_local_ci setup_local_ci_${index_size}_${precision_}) + add_dependencies(setup_local_ci + setup_local_ci_${index_size}_${precision_}) set(container_test_exe ./test_driver.sh) - set(container_test_exe_args --testtype CUSTOM --env env/docker.sh --tpls --sunrealtype ${precision_} --indexsize ${index_size}) - set(container_exe_args exec -w ${SUNDIALS_TEST_CONTAINER_MNT}/test ${container} ${container_test_exe} ${container_test_exe_args}) - add_custom_target(test_local_ci_${index_size}_${precision_} + set(container_test_exe_args + --testtype + CUSTOM + --env + env/docker.sh + --tpls + --sunrealtype + ${precision_} + --indexsize + ${index_size}) + set(container_exe_args + exec -w ${SUNDIALS_TEST_CONTAINER_MNT}/test ${container} + ${container_test_exe} ${container_test_exe_args}) + add_custom_target( + test_local_ci_${index_size}_${precision_} COMMENT "Running tests in CI container ${container}:${tag}" WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${SUNDIALS_TEST_CONTAINER_EXE} ${container_exe_args} @@ -136,11 +181,13 @@ if(SUNDIALS_TEST_UNITTESTS AND SUNDIALS_TEST_ENABLE_GTEST) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip - GIT_TAG v1.14.0 - ) + GIT_TAG v1.14.0) if(WIN32) - # For Windows: Prevent overriding the parent project's compiler/linker settings - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + # For Windows: Prevent overriding the parent project's compiler/linker + # settings + set(gtest_force_shared_crt + ON + CACHE BOOL "" FORCE) endif() FetchContent_MakeAvailable(googletest) include(GoogleTest) @@ -164,13 +211,11 @@ if(EXAMPLES_INSTALL) endif() # Create test_install and test_install_all targets - add_custom_target(test_install - ${CMAKE_COMMAND} -E cmake_echo_color --cyan - "All installation tests complete.") + add_custom_target(test_install ${CMAKE_COMMAND} -E cmake_echo_color --cyan + "All installation tests complete.") - add_custom_target(test_install_all - ${CMAKE_COMMAND} -E cmake_echo_color --cyan - "All installation tests complete.") + add_custom_target(test_install_all ${CMAKE_COMMAND} -E cmake_echo_color + --cyan "All installation tests complete.") endif() @@ -180,8 +225,6 @@ if(BUILD_BENCHMARKS) message("SUNDIALS Benchmarking") # Create benchmark targets - add_custom_target(benchmark - ${CMAKE_COMMAND} -E cmake_echo_color --cyan - "All benchmarks complete." - ) + add_custom_target(benchmark ${CMAKE_COMMAND} -E cmake_echo_color --cyan + "All benchmarks complete.") endif() diff --git a/cmake/SundialsTPLOptions.cmake b/cmake/SundialsTPLOptions.cmake index 36e0dc5a1b..40110eed74 100644 --- a/cmake/SundialsTPLOptions.cmake +++ b/cmake/SundialsTPLOptions.cmake @@ -30,12 +30,11 @@ sundials_option(ENABLE_OPENMP BOOL "Enable OpenMP support" OFF) sundials_option(ENABLE_OPENMP_DEVICE BOOL "Enable OpenMP device offloading support" OFF) -# Advanced option to skip OpenMP device offloading support check. -# This is needed for a specific compiler that doesn't correctly -# report its OpenMP spec date (with CMake >= 3.9). +# Advanced option to skip OpenMP device offloading support check. This is needed +# for a specific compiler that doesn't correctly report its OpenMP spec date +# (with CMake >= 3.9). sundials_option(OPENMP_DEVICE_WORKS BOOL - "Skip the OpenMP device offloading support check" OFF - ADVANCED) + "Skip the OpenMP device offloading support check" OFF ADVANCED) # --------------------------------------------------------------- # Enable Pthread support? @@ -61,112 +60,145 @@ sundials_option(ENABLE_HIP BOOL "Enable HIP support" OFF) # ------------------------------------------------------------- sundials_option(ENABLE_SYCL BOOL "Enable SYCL support" OFF) -sundials_option(SUNDIALS_SYCL_2020_UNSUPPORTED BOOL - "Disable the use of some SYCL 2020 features in SUNDIALS libraries and examples" OFF - DEPENDS_ON ENABLE_SYCL - ADVANCED) +sundials_option( + SUNDIALS_SYCL_2020_UNSUPPORTED + BOOL + "Disable the use of some SYCL 2020 features in SUNDIALS libraries and examples" + OFF + DEPENDS_ON ENABLE_SYCL + ADVANCED) # --------------------------------------------------------------- # Enable LAPACK support? # --------------------------------------------------------------- sundials_option(ENABLE_LAPACK BOOL "Enable Lapack support" OFF) -sundials_option(LAPACK_LIBRARIES STRING "Lapack and Blas libraries" "${LAPACK_LIBRARIES}" - DEPENDS_ON ENABLE_LAPACK) +sundials_option(LAPACK_LIBRARIES STRING "Lapack and Blas libraries" + "${LAPACK_LIBRARIES}" DEPENDS_ON ENABLE_LAPACK) -sundials_option(LAPACK_WORKS BOOL "Set to ON to force CMake to accept a given LAPACK configuration" OFF - DEPENDS_ON ENABLE_LAPACK - ADVANCED) +sundials_option( + LAPACK_WORKS BOOL + "Set to ON to force CMake to accept a given LAPACK configuration" OFF + DEPENDS_ON ENABLE_LAPACK + ADVANCED) # --------------------------------------------------------------- # Enable Ginkgo support? # --------------------------------------------------------------- sundials_option(ENABLE_GINKGO BOOL "Enable Ginkgo support" OFF) -sundials_option(Ginkgo_DIR PATH "Path to the root of a Ginkgo installation" "${Ginkgo_DIR}" - DEPENDS_ON ENABLE_GINKGO) +sundials_option(Ginkgo_DIR PATH "Path to the root of a Ginkgo installation" + "${Ginkgo_DIR}" DEPENDS_ON ENABLE_GINKGO) -sundials_option(SUNDIALS_GINKGO_BACKENDS STRING "Which Ginkgo backend(s) to build the SUNDIALS Ginkgo interfaces for (REF, OMP, CUDA, HIP, SYCL)" "REF;OMP" - DEPENDS_ON ENABLE_GINKGO) +sundials_option( + SUNDIALS_GINKGO_BACKENDS + STRING + "Which Ginkgo backend(s) to build the SUNDIALS Ginkgo interfaces for (REF, OMP, CUDA, HIP, SYCL)" + "REF;OMP" + DEPENDS_ON ENABLE_GINKGO) -sundials_option(GINKGO_WORKS BOOL "Set to ON to force CMake to accept a given Ginkgo configuration" OFF - DEPENDS_ON ENABLE_GINKGO - ADVANCED) +sundials_option( + GINKGO_WORKS BOOL + "Set to ON to force CMake to accept a given Ginkgo configuration" OFF + DEPENDS_ON ENABLE_GINKGO + ADVANCED) # --------------------------------------------------------------- # Enable MAGMA support? # --------------------------------------------------------------- sundials_option(ENABLE_MAGMA BOOL "Enable MAGMA support" OFF) -sundials_option(MAGMA_DIR PATH "Path to the root of a MAGMA installation" "${MAGMA_DIR}" - DEPENDS_ON ENABLE_MAGMA) +sundials_option(MAGMA_DIR PATH "Path to the root of a MAGMA installation" + "${MAGMA_DIR}" DEPENDS_ON ENABLE_MAGMA) -sundials_option(SUNDIALS_MAGMA_BACKENDS STRING "Which MAGMA backend to use under the SUNDIALS MAGMA interfaces (CUDA, HIP)" "CUDA" - OPTIONS "CUDA;HIP" - DEPENDS_ON ENABLE_MAGMA) +sundials_option( + SUNDIALS_MAGMA_BACKENDS STRING + "Which MAGMA backend to use under the SUNDIALS MAGMA interfaces (CUDA, HIP)" + "CUDA" + OPTIONS "CUDA;HIP" + DEPENDS_ON ENABLE_MAGMA) -sundials_option(MAGMA_WORKS BOOL "Set to ON to force CMake to accept a given MAGMA configuration" OFF - DEPENDS_ON ENABLE_MAGMA - ADVANCED) +sundials_option( + MAGMA_WORKS BOOL + "Set to ON to force CMake to accept a given MAGMA configuration" OFF + DEPENDS_ON ENABLE_MAGMA + ADVANCED) # --------------------------------------------------------------- # Enable SuperLU_DIST support? # --------------------------------------------------------------- sundials_option(ENABLE_SUPERLUDIST BOOL "Enable SuperLU_DIST support" OFF) -sundials_option(SUPERLUDIST_DIR PATH "Path to the root of the SuperLU_DIST installation" "${SUPERLUDIST_DIR}" - DEPENDS_ON ENABLE_SUPERLUDIST) +sundials_option( + SUPERLUDIST_DIR PATH "Path to the root of the SuperLU_DIST installation" + "${SUPERLUDIST_DIR}" DEPENDS_ON ENABLE_SUPERLUDIST) -sundials_option(SUPERLUDIST_INCLUDE_DIRS PATH "SuperLU_DIST include directories" "${SUPERLUDIST_INCLUDE_DIRS}" - DEPENDS_ON ENABLE_SUPERLUDIST - ADVANCED) +sundials_option( + SUPERLUDIST_INCLUDE_DIRS PATH "SuperLU_DIST include directories" + "${SUPERLUDIST_INCLUDE_DIRS}" + DEPENDS_ON ENABLE_SUPERLUDIST + ADVANCED) -sundials_option(SUPERLUDIST_LIBRARIES STRING "Semi-colon separated list of libraries needed for SuperLU_DIST." "${SUPERLUDIST_LIBRARIES}" - DEPENDS_ON ENABLE_SUPERLUDIST - ADVANCED) +sundials_option( + SUPERLUDIST_LIBRARIES STRING + "Semi-colon separated list of libraries needed for SuperLU_DIST." + "${SUPERLUDIST_LIBRARIES}" + DEPENDS_ON ENABLE_SUPERLUDIST + ADVANCED) -sundials_option(SUPERLUDIST_OpenMP BOOL "Enable SUNDIALS support for SuperLU_DIST OpenMP on-node parallelism" OFF - DEPENDS_ON ENABLE_SUPERLUDIST) +sundials_option( + SUPERLUDIST_OpenMP BOOL + "Enable SUNDIALS support for SuperLU_DIST OpenMP on-node parallelism" OFF + DEPENDS_ON ENABLE_SUPERLUDIST) -sundials_option(SUPERLUDIST_WORKS BOOL "Set to ON to force CMake to accept a given SuperLU_DIST configuration" OFF - DEPENDS_ON ENABLE_SUPERLUDIST - ADVANCED) +sundials_option( + SUPERLUDIST_WORKS BOOL + "Set to ON to force CMake to accept a given SuperLU_DIST configuration" OFF + DEPENDS_ON ENABLE_SUPERLUDIST + ADVANCED) # --------------------------------------------------------------- # Enable SuperLU_MT support? # --------------------------------------------------------------- sundials_option(ENABLE_SUPERLUMT BOOL "Enable SuperLU_MT support" OFF) -sundials_option(SUPERLUMT_INCLUDE_DIR PATH "SuperLU_MT include directory" "${SUPERLUMT_INCLUDE_DIR}" - DEPENDS_ON ENABLE_SUPERLUMT) +sundials_option(SUPERLUMT_INCLUDE_DIR PATH "SuperLU_MT include directory" + "${SUPERLUMT_INCLUDE_DIR}" DEPENDS_ON ENABLE_SUPERLUMT) -sundials_option(SUPERLUMT_LIBRARY_DIR PATH "SuperLU_MT library directory" "${SUPERLUMT_LIBRARY_DIR}" - DEPENDS_ON ENABLE_SUPERLUMT) +sundials_option(SUPERLUMT_LIBRARY_DIR PATH "SuperLU_MT library directory" + "${SUPERLUMT_LIBRARY_DIR}" DEPENDS_ON ENABLE_SUPERLUMT) -sundials_option(SUPERLUMT_LIBRARIES STRING "Semi-colon separated list of additional libraries needed for SuperLU_MT." "${SUPERLUMT_LIBRARIES}" - DEPENDS_ON ENABLE_SUPERLUMT) +sundials_option( + SUPERLUMT_LIBRARIES STRING + "Semi-colon separated list of additional libraries needed for SuperLU_MT." + "${SUPERLUMT_LIBRARIES}" DEPENDS_ON ENABLE_SUPERLUMT) -sundials_option(SUPERLUMT_THREAD_TYPE STRING "SuperLU_MT threading type: OPENMP or PTHREAD" "PTHREAD" - DEPENDS_ON ENABLE_SUPERLUMT) +sundials_option( + SUPERLUMT_THREAD_TYPE STRING "SuperLU_MT threading type: OPENMP or PTHREAD" + "PTHREAD" DEPENDS_ON ENABLE_SUPERLUMT) -sundials_option(SUPERLUMT_WORKS BOOL "Set to ON to force CMake to accept a given SUPERLUMT configuration" OFF - DEPENDS_ON ENABLE_SUPERLUMT - ADVANCED) +sundials_option( + SUPERLUMT_WORKS BOOL + "Set to ON to force CMake to accept a given SUPERLUMT configuration" OFF + DEPENDS_ON ENABLE_SUPERLUMT + ADVANCED) # --------------------------------------------------------------- # Enable KLU support? # --------------------------------------------------------------- sundials_option(ENABLE_KLU BOOL "Enable KLU support" OFF) -sundials_option(KLU_INCLUDE_DIR PATH "KLU include directory" "${KLU_INCLUDE_DIR}" - DEPENDS_ON ENABLE_KLU) +sundials_option(KLU_INCLUDE_DIR PATH "KLU include directory" + "${KLU_INCLUDE_DIR}" DEPENDS_ON ENABLE_KLU) -sundials_option(KLU_LIBRARY_DIR PATH "KLU library directory" "${KLU_LIBRARY_DIR}" - DEPENDS_ON ENABLE_KLU) +sundials_option(KLU_LIBRARY_DIR PATH "KLU library directory" + "${KLU_LIBRARY_DIR}" DEPENDS_ON ENABLE_KLU) -sundials_option(KLU_WORKS BOOL "Set to ON to force CMake to accept a given KLU configuration" OFF - DEPENDS_ON ENABLE_KLU - ADVANCED) +sundials_option( + KLU_WORKS BOOL "Set to ON to force CMake to accept a given KLU configuration" + OFF + DEPENDS_ON ENABLE_KLU + ADVANCED) # --------------------------------------------------------------- # Enable hypre support? @@ -176,15 +208,17 @@ sundials_option(ENABLE_HYPRE BOOL "Enable hypre support" OFF) sundials_option(HYPRE_DIR PATH "Path to hypre installation" "${HYPRE_DIR}" DEPENDS_ON ENABLE_HYPRE) -sundials_option(HYPRE_INCLUDE_DIR PATH "HYPRE include directory" "${HYPRE_INCLUDE_DIR}" - DEPENDS_ON ENABLE_HYPRE) +sundials_option(HYPRE_INCLUDE_DIR PATH "HYPRE include directory" + "${HYPRE_INCLUDE_DIR}" DEPENDS_ON ENABLE_HYPRE) -sundials_option(HYPRE_LIBRARY_DIR PATH "HYPRE library directory" "${HYPRE_LIBRARY_DIR}" - DEPENDS_ON ENABLE_HYPRE) +sundials_option(HYPRE_LIBRARY_DIR PATH "HYPRE library directory" + "${HYPRE_LIBRARY_DIR}" DEPENDS_ON ENABLE_HYPRE) -sundials_option(HYPRE_WORKS BOOL "Set to ON to force CMake to accept a given hypre configuration" OFF - DEPENDS_ON ENABLE_HYPRE - ADVANCED) +sundials_option( + HYPRE_WORKS BOOL + "Set to ON to force CMake to accept a given hypre configuration" OFF + DEPENDS_ON ENABLE_HYPRE + ADVANCED) # --------------------------------------------------------------- # Enable PETSc support? @@ -192,23 +226,29 @@ sundials_option(HYPRE_WORKS BOOL "Set to ON to force CMake to accept a given hyp sundials_option(ENABLE_PETSC BOOL "Enable PETSc support" OFF) -sundials_option(PETSC_DIR PATH "Path to the root of a PETSc installation" "${PETSC_DIR}" - DEPENDS_ON ENABLE_PETSC) +sundials_option(PETSC_DIR PATH "Path to the root of a PETSc installation" + "${PETSC_DIR}" DEPENDS_ON ENABLE_PETSC) -sundials_option(PETSC_ARCH STRING "PETSc architecture (optional)" "${PETSC_ARCH}" - DEPENDS_ON ENABLE_PETSC) +sundials_option(PETSC_ARCH STRING "PETSc architecture (optional)" + "${PETSC_ARCH}" DEPENDS_ON ENABLE_PETSC) -sundials_option(PETSC_LIBRARIES STRING "Semi-colon separated list of PETSc link libraries" "${PETSC_LIBRARIES}" - DEPENDS_ON ENABLE_PETSC - ADVANCED) +sundials_option( + PETSC_LIBRARIES STRING "Semi-colon separated list of PETSc link libraries" + "${PETSC_LIBRARIES}" + DEPENDS_ON ENABLE_PETSC + ADVANCED) -sundials_option(PETSC_INCLUDES STRING "Semi-colon separated list of PETSc include directories" "${PETSC_INCLUDES}" - DEPENDS_ON ENABLE_PETSC - ADVANCED) +sundials_option( + PETSC_INCLUDES STRING "Semi-colon separated list of PETSc include directories" + "${PETSC_INCLUDES}" + DEPENDS_ON ENABLE_PETSC + ADVANCED) -sundials_option(PETSC_WORKS BOOL "Set to ON to force CMake to accept a given PETSc configuration" OFF - DEPENDS_ON ENABLE_PETSC - ADVANCED) +sundials_option( + PETSC_WORKS BOOL + "Set to ON to force CMake to accept a given PETSc configuration" OFF + DEPENDS_ON ENABLE_PETSC + ADVANCED) # ------------------------------------------------------------- # Enable RAJA support? @@ -218,46 +258,56 @@ sundials_option(ENABLE_RAJA BOOL "Enable RAJA support" OFF) sundials_option(RAJA_DIR PATH "Path to root of RAJA installation" "${RAJA_DIR}" DEPENDS_ON ENABLE_RAJA) -sundials_option(SUNDIALS_RAJA_BACKENDS STRING "Which RAJA backend under the SUNDIALS RAJA interfaces (CUDA, HIP, SYCL)" "CUDA" - OPTIONS "CUDA;HIP;SYCL" - DEPENDS_ON ENABLE_RAJA) +sundials_option( + SUNDIALS_RAJA_BACKENDS STRING + "Which RAJA backend under the SUNDIALS RAJA interfaces (CUDA, HIP, SYCL)" + "CUDA" + OPTIONS "CUDA;HIP;SYCL" + DEPENDS_ON ENABLE_RAJA) # --------------------------------------------------------------- # Enable Trilinos support? # --------------------------------------------------------------- sundials_option(ENABLE_TRILINOS BOOL "Enable Trilinos support" OFF) -sundials_option(Trilinos_DIR PATH "Path to root of Trilinos installation" "${Trilinos_DIR}" - DEPENDS_ON ENABLE_TRILINOS) - -sundials_option(Trilinos_INTERFACE_CXX_COMPILER STRING - "C++ compiler for Trilinos interface" "${Trilinos_CXX_COMPILER}" - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) - -sundials_option(Trilinos_INTERFACE_C_COMPILER STRING - "C compiler for Trilinos interface" "${Trilinos_C_COMPILER}" - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) - -sundials_option(Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING - "C++ compiler flags for Trilinos interface" "${Trilinos_CXX_COMPILER_FLAGS}" - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) - -sundials_option(Trilinos_INTERFACE_C_COMPILER_FLAGS STRING - "C compiler flags for Trilinos interface" "${Trilinos_C_COMPILER_FLAGS}" - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) - -sundials_option(Trilinos_INTERFACE_MPIEXEC STRING - "MPI executable for Trilinos interface" "${Trilinos_MPI_EXEC}" - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) - -sundials_option(Trilinos_WORKS BOOL "Set to ON to force CMake to accept a given Trilinos configuration" OFF - DEPENDS_ON ENABLE_TRILINOS - ADVANCED) +sundials_option(Trilinos_DIR PATH "Path to root of Trilinos installation" + "${Trilinos_DIR}" DEPENDS_ON ENABLE_TRILINOS) + +sundials_option( + Trilinos_INTERFACE_CXX_COMPILER STRING "C++ compiler for Trilinos interface" + "${Trilinos_CXX_COMPILER}" + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) + +sundials_option( + Trilinos_INTERFACE_C_COMPILER STRING "C compiler for Trilinos interface" + "${Trilinos_C_COMPILER}" + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) + +sundials_option( + Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING + "C++ compiler flags for Trilinos interface" "${Trilinos_CXX_COMPILER_FLAGS}" + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) + +sundials_option( + Trilinos_INTERFACE_C_COMPILER_FLAGS STRING + "C compiler flags for Trilinos interface" "${Trilinos_C_COMPILER_FLAGS}" + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) + +sundials_option( + Trilinos_INTERFACE_MPIEXEC STRING "MPI executable for Trilinos interface" + "${Trilinos_MPI_EXEC}" + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) + +sundials_option( + Trilinos_WORKS BOOL + "Set to ON to force CMake to accept a given Trilinos configuration" OFF + DEPENDS_ON ENABLE_TRILINOS + ADVANCED) # --------------------------------------------------------------- # Enable XBraid support? @@ -265,20 +315,26 @@ sundials_option(Trilinos_WORKS BOOL "Set to ON to force CMake to accept a given sundials_option(ENABLE_XBRAID BOOL "Enable XBraid support" OFF) -sundials_option(XBRAID_DIR PATH "Path to the root of an XBraid installation" "${XBRAID_DIR}" - DEPENDS_ON ENABLE_XBRAID) +sundials_option(XBRAID_DIR PATH "Path to the root of an XBraid installation" + "${XBRAID_DIR}" DEPENDS_ON ENABLE_XBRAID) -sundials_option(XBRAID_LIBRARIES STRING "Semi-colon separated list of XBraid link libraries" "${XBRAID_LIBRARIES}" - DEPENDS_ON ENABLE_XBRAID - ADVANCED) +sundials_option( + XBRAID_LIBRARIES STRING "Semi-colon separated list of XBraid link libraries" + "${XBRAID_LIBRARIES}" + DEPENDS_ON ENABLE_XBRAID + ADVANCED) -sundials_option(XBRAID_INCLUDES STRING "Semi-colon separated list of XBraid include directories" "${XBRAID_INCLUDES}" - DEPENDS_ON ENABLE_XBRAID - ADVANCED) +sundials_option( + XBRAID_INCLUDES STRING + "Semi-colon separated list of XBraid include directories" "${XBRAID_INCLUDES}" + DEPENDS_ON ENABLE_XBRAID + ADVANCED) -sundials_option(XBRAID_WORKS BOOL "Set to ON to force CMake to accept a given XBraid configuration" OFF - DEPENDS_ON ENABLE_XBRAID - ADVANCED) +sundials_option( + XBRAID_WORKS BOOL + "Set to ON to force CMake to accept a given XBraid configuration" OFF + DEPENDS_ON ENABLE_XBRAID + ADVANCED) # ------------------------------------------------------------- # Enable oneMKL support? @@ -286,22 +342,26 @@ sundials_option(XBRAID_WORKS BOOL "Set to ON to force CMake to accept a given XB sundials_option(ENABLE_ONEMKL BOOL "Enable oneMKL support" OFF) -sundials_option(ONEMKL_DIR PATH "Path to root of oneMKL installation" "${ONEMKL_DIR}" - DEPENDS_ON ENABLE_ONEMKL) +sundials_option(ONEMKL_DIR PATH "Path to root of oneMKL installation" + "${ONEMKL_DIR}" DEPENDS_ON ENABLE_ONEMKL) -sundials_option(ONEMKL_WORKS BOOL "Set to ON to force CMake to accept a given oneMKL configuration" OFF - DEPENDS_ON ENABLE_ONEMKL - ADVANCED) +sundials_option( + ONEMKL_WORKS BOOL + "Set to ON to force CMake to accept a given oneMKL configuration" OFF + DEPENDS_ON ENABLE_ONEMKL + ADVANCED) -sundials_option(SUNDIALS_ONEMKL_USE_GETRF_LOOP BOOL - "Replace batched getrf call with loop over getrf" OFF - DEPENDS_ON ENABLE_ONEMKL - ADVANCED) +sundials_option( + SUNDIALS_ONEMKL_USE_GETRF_LOOP BOOL + "Replace batched getrf call with loop over getrf" OFF + DEPENDS_ON ENABLE_ONEMKL + ADVANCED) -sundials_option(SUNDIALS_ONEMKL_USE_GETRS_LOOP BOOL - "Replace batched getrs call with loop over getrs" OFF - DEPENDS_ON ENABLE_ONEMKL - ADVANCED) +sundials_option( + SUNDIALS_ONEMKL_USE_GETRS_LOOP BOOL + "Replace batched getrs call with loop over getrs" OFF + DEPENDS_ON ENABLE_ONEMKL + ADVANCED) # --------------------------------------------------------------- # Enable Caliper support? @@ -310,20 +370,24 @@ sundials_option(SUNDIALS_ONEMKL_USE_GETRS_LOOP BOOL sundials_option(ENABLE_CALIPER BOOL "Enable CALIPER support" OFF DEPENDS_ON SUNDIALS_BUILD_WITH_PROFILING) -sundials_option(CALIPER_DIR PATH "Path to the root of an CALIPER installation" "${CALIPER_DIR}" - DEPENDS_ON ENABLE_CALIPER) +sundials_option(CALIPER_DIR PATH "Path to the root of an CALIPER installation" + "${CALIPER_DIR}" DEPENDS_ON ENABLE_CALIPER) -sundials_option(CALIPER_WORKS BOOL "Set to ON to force CMake to accept a given CALIPER configuration" OFF - DEPENDS_ON ENABLE_CALIPER - ADVANCED) +sundials_option( + CALIPER_WORKS BOOL + "Set to ON to force CMake to accept a given CALIPER configuration" OFF + DEPENDS_ON ENABLE_CALIPER + ADVANCED) # --------------------------------------------------------------- # Enable Adiak support? # --------------------------------------------------------------- -sundials_option(ENABLE_ADIAK BOOL "Enable Adiak support" OFF DEPENDS_ON SUNDIALS_BUILD_WITH_PROFILING) +sundials_option(ENABLE_ADIAK BOOL "Enable Adiak support" OFF + DEPENDS_ON SUNDIALS_BUILD_WITH_PROFILING) -sundials_option(adiak_DIR PATH "Path to the root of an Adiak installation" "${ADIAK_DIR}" DEPENDS_ON ENABLE_ADIAK) +sundials_option(adiak_DIR PATH "Path to the root of an Adiak installation" + "${ADIAK_DIR}" DEPENDS_ON ENABLE_ADIAK) # --------------------------------------------------------------- # Enable Kokkos support? @@ -331,11 +395,14 @@ sundials_option(adiak_DIR PATH "Path to the root of an Adiak installation" "${AD sundials_option(ENABLE_KOKKOS BOOL "Enable Kokkos support" OFF) -sundials_option(Kokkos_DIR PATH "Path to the root of a Kokkos installation" "${Kokkos_DIR}") +sundials_option(Kokkos_DIR PATH "Path to the root of a Kokkos installation" + "${Kokkos_DIR}") -sundials_option(KOKKOS_WORKS BOOL "Set to ON to force CMake to accept a given Kokkos configuration" OFF - DEPENDS_ON ENABLE_KOKKOS - ADVANCED) +sundials_option( + KOKKOS_WORKS BOOL + "Set to ON to force CMake to accept a given Kokkos configuration" OFF + DEPENDS_ON ENABLE_KOKKOS + ADVANCED) # --------------------------------------------------------------- # Enable Kokkos Kernels support? @@ -343,8 +410,12 @@ sundials_option(KOKKOS_WORKS BOOL "Set to ON to force CMake to accept a given Ko sundials_option(ENABLE_KOKKOS_KERNELS BOOL "Enable Kokkos Kernels support" OFF) -sundials_option(KokkosKernels_DIR PATH "Path to the root of a Kokkos Kernels installation" "${KokkosKernels_DIR}") +sundials_option( + KokkosKernels_DIR PATH "Path to the root of a Kokkos Kernels installation" + "${KokkosKernels_DIR}") -sundials_option(KOKKOS_KERNELS_WORKS BOOL "Set to ON to force CMake to accept a given Kokkos configuration" OFF - DEPENDS_ON ENABLE_KOKKOS ENABLE_KOKKOS_KERNELS - ADVANCED) +sundials_option( + KOKKOS_KERNELS_WORKS BOOL + "Set to ON to force CMake to accept a given Kokkos configuration" OFF + DEPENDS_ON ENABLE_KOKKOS ENABLE_KOKKOS_KERNELS + ADVANCED) diff --git a/cmake/macros/SundialsAddBenchmark.cmake b/cmake/macros/SundialsAddBenchmark.cmake index f3b3aec4e6..f5352f2d29 100644 --- a/cmake/macros/SundialsAddBenchmark.cmake +++ b/cmake/macros/SundialsAddBenchmark.cmake @@ -18,37 +18,41 @@ macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) # Define single value parameters the macro takes in to set up the test runner # - # NUM_CORES = number of cores (GPU count or CPU count) to run on/number of resource sets - # BENCHMARK_ARGS = arguments to pass to the executable - # IDENTIFIER = suffix to append to end of benchmark name + # NUM_CORES = number of cores (GPU count or CPU count) to run + # on/number of resource sets BENCHMARK_ARGS = arguments to pass to the + # executable IDENTIFIER = suffix to append to end of benchmark name set(oneValueArgs NUM_CORES BENCHMARK_ARGS IDENTIFIER) # TEST_RUNNER_ARGS = command line arguments to pass to the test executable - set(multiValueArgs TEST_RUNNER_ARGS ) + set(multiValueArgs TEST_RUNNER_ARGS) # ENABLE_GPU = indicate this benchmark should be run with GPUs set(options ENABLE_GPU) - cmake_parse_arguments(sundials_add_benchmark - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(sundials_add_benchmark "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) # set the target name if(sundials_add_benchmark_IDENTIFIER) set(TARGET_NAME ${NAME}_${sundials_add_benchmark_IDENTIFIER}) else() if(sundials_add_benchmark_BENCHMARK_ARGS) - string(REPLACE " " "_" TEST_SUFFIX "${sundials_add_benchmark_BENCHMARK_ARGS}") + string(REPLACE " " "_" TEST_SUFFIX + "${sundials_add_benchmark_BENCHMARK_ARGS}") set(TARGET_NAME ${NAME}_${TEST_SUFFIX}) else() set(TARGET_NAME ${NAME}_run) endif() endif() - # Create default benchmark caliper output directory if custom directory is not defined + # Create default benchmark caliper output directory if custom directory is not + # defined if(SUNDIALS_CALIPER_OUTPUT_DIR) - set(SUNDIALS_BENCHMARK_OUTPUT_DIR ${SUNDIALS_CALIPER_OUTPUT_DIR}/Benchmarking/${BASE_BENCHMARK_NAME}) + set(SUNDIALS_BENCHMARK_OUTPUT_DIR + ${SUNDIALS_CALIPER_OUTPUT_DIR}/Benchmarking/${BASE_BENCHMARK_NAME}) else() - set(SUNDIALS_BENCHMARK_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Benchmarking/${BASE_BENCHMARK_NAME}) + set(SUNDIALS_BENCHMARK_OUTPUT_DIR + ${PROJECT_BINARY_DIR}/Benchmarking/${BASE_BENCHMARK_NAME}) endif() # make the caliper output directory if it doesn't exist @@ -63,22 +67,24 @@ macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) # command line arguments for the test runner script set(TEST_RUNNER_ARGS - "--profile" - "--verbose" - "--executablename=$" - "--outputdir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/output" - "--calidir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${TARGET_NAME}" - "--nodiff") + "--profile" "--verbose" "--executablename=$" + "--outputdir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/output" + "--calidir=${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${TARGET_NAME}" "--nodiff") # incorporate scheduler arguments into test_runner if(SUNDIALS_SCHEDULER_COMMAND STREQUAL "flux run") set(SCHEDULER_STRING " -n${sundials_add_benchmark_NUM_CORES}") - elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "jsrun" AND ${sundials_add_benchmark_ENABLE_GPU}) - set(SCHEDULER_STRING " --smpiargs=\\\"-gpu\\\" -n${sundials_add_benchmark_NUM_CORES} -a1 -c1 -g1") + elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "jsrun" + AND ${sundials_add_benchmark_ENABLE_GPU}) + set(SCHEDULER_STRING + " --smpiargs=\\\"-gpu\\\" -n${sundials_add_benchmark_NUM_CORES} -a1 -c1 -g1" + ) elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "jsrun") set(SCHEDULER_STRING " -n${sundials_add_benchmark_NUM_CORES} -a1 -c1") elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "srun") - set(SCHEDULER_STRING " -n${sundials_add_benchmark_NUM_CORES} --cpus-per-task=1 --ntasks-per-node=1") + set(SCHEDULER_STRING + " -n${sundials_add_benchmark_NUM_CORES} --cpus-per-task=1 --ntasks-per-node=1" + ) endif() string(REPLACE " " ";" SCHEDULER_ARGS "${SCHEDULER_STRING}") string(REPLACE " " ";" SCHEDULER_COMMAND_ARGS "${SUNDIALS_SCHEDULER_COMMAND}") @@ -87,8 +93,11 @@ macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) set(RUN_COMMAND ${SCHEDULER_COMMAND_ARGS} ${SCHEDULER_ARGS}) list(APPEND TEST_RUNNER_ARGS "--runcommand=\"${RUN_COMMAND}\"") - list(APPEND TEST_RUNNER_ARGS "--runargs=${sundials_add_benchmark_BENCHMARK_ARGS}" "--testname=${TARGET_NAME}") - add_custom_target(${TARGET_NAME} + list(APPEND TEST_RUNNER_ARGS + "--runargs=${sundials_add_benchmark_BENCHMARK_ARGS}" + "--testname=${TARGET_NAME}") + add_custom_target( + ${TARGET_NAME} COMMENT "Running ${TARGET_NAME}" COMMAND ${PYTHON_EXECUTABLE} ${TESTRUNNER} ${TEST_RUNNER_ARGS}) add_dependencies(benchmark ${TARGET_NAME}) diff --git a/cmake/macros/SundialsAddExamplesGinkgo.cmake b/cmake/macros/SundialsAddExamplesGinkgo.cmake index 1e23dfdb58..c723f68f29 100644 --- a/cmake/macros/SundialsAddExamplesGinkgo.cmake +++ b/cmake/macros/SundialsAddExamplesGinkgo.cmake @@ -40,8 +40,8 @@ macro(sundials_add_examples_ginkgo EXAMPLES_VAR) set(multiValueArgs TARGETS BACKENDS) # Parse keyword arguments and options - cmake_parse_arguments(arg - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN}) foreach(example_tuple ${${EXAMPLES_VAR}}) foreach(backend ${arg_BACKENDS}) @@ -87,17 +87,13 @@ macro(sundials_add_examples_ginkgo EXAMPLES_VAR) target_compile_definitions(${example_target} PRIVATE USE_${backend}) # directories to include - target_include_directories(${example_target} - PRIVATE - "${PROJECT_SOURCE_DIR}/examples/utilities") + target_include_directories( + ${example_target} PRIVATE "${PROJECT_SOURCE_DIR}/examples/utilities") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - ${arg_TARGETS} - sundials_${vector} - Ginkgo::ginkgo - ${EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} PRIVATE ${arg_TARGETS} sundials_${vector} + Ginkgo::ginkgo ${EXTRA_LINK_LIBS}) endif() @@ -105,17 +101,20 @@ macro(sundials_add_examples_ginkgo EXAMPLES_VAR) if("${example_args}" STREQUAL "") set(test_name ${example_target}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${example_args}) endif() # add example to regression tests if(${arg_UNIT_TEST}) - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} EXAMPLE_TYPE ${example_type} TEST_ARGS ${example_args} NODIFF) else() - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} EXAMPLE_TYPE ${example_type} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/cmake/macros/SundialsAddExecutable.cmake b/cmake/macros/SundialsAddExecutable.cmake index a2582a3485..00508c76b2 100644 --- a/cmake/macros/SundialsAddExecutable.cmake +++ b/cmake/macros/SundialsAddExecutable.cmake @@ -16,30 +16,26 @@ macro(sundials_add_nvector_benchmark NAME) - set(options ) - set(singleValueArgs ) - set(multiValueArgs SOURCES SUNDIALS_TARGETS LINK_LIBRARIES - INSTALL_SUBDIR) + set(options) + set(singleValueArgs) + set(multiValueArgs SOURCES SUNDIALS_TARGETS LINK_LIBRARIES INSTALL_SUBDIR) - cmake_parse_arguments(arg - "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(arg "${options}" "${singleValueArgs}" + "${multiValueArgs}" ${ARGN}) set(BENCHMARKS_DIR ${PROJECT_SOURCE_DIR}/benchmarks) - add_executable(${NAME} - ${BENCHMARKS_DIR}/nvector/test_nvector_performance.c - ${arg_SOURCES}) + add_executable(${NAME} ${BENCHMARKS_DIR}/nvector/test_nvector_performance.c + ${arg_SOURCES}) set_target_properties(${NAME} PROPERTIES FOLDER "Benchmarks") - target_include_directories(${NAME} PRIVATE - ${BENCHMARKS_DIR}/nvector) + target_include_directories(${NAME} PRIVATE ${BENCHMARKS_DIR}/nvector) - target_link_libraries(${NAME} PRIVATE - ${arg_SUNDIALS_TARGETS} ${arg_LINK_LIBRARIES} -lm) + target_link_libraries(${NAME} PRIVATE ${arg_SUNDIALS_TARGETS} + ${arg_LINK_LIBRARIES} -lm) install(TARGETS ${NAME} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/${arg_INSTALL_SUBDIR}") + DESTINATION "${BENCHMARKS_INSTALL_PATH}/${arg_INSTALL_SUBDIR}") endmacro(sundials_add_nvector_benchmark) - diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake index 199f790e66..e3d0bb893d 100644 --- a/cmake/macros/SundialsAddLibrary.cmake +++ b/cmake/macros/SundialsAddLibrary.cmake @@ -15,45 +15,49 @@ # Wraps the add_library command for sundials specific needs. # --------------------------------------------------------------- - -# The macro: -# -# SUNDIALS_ADD_LIBRARY( -# SOURCES source1 source2 ... -# [HEADERS header1 header2 ...] -# [OBJECT_LIBRARIES objlib1 objlib2 ...] -# [LINK_LIBRARIES ... +# ~~~ +# sundials_add_library( +# SOURCES source1 source2 ... +# [HEADERS header1 header2 ...] +# [OBJECT_LIBRARIES objlib1 objlib2 ...] +# [LINK_LIBRARIES ... +# [ ...] ] +# [INCLUDE_DIRECTORIES ... +# [ ...] ] +# [COMPILE_DEFINITIONS ... +# [ ...] ] +# [COMPILE_OPTIONS ... +# [ ...] ] +# [COMPILE_FEATURES ... # [ ...] ] -# [INCLUDE_DIRECTORIES ... -# [ ...] ] -# [COMPILE_DEFINITIONS ... -# [ ...] ] -# [COMPILE_OPTIONS ... -# [ ...] ] -# [COMPILE_FEATURES ... -# [ ...] ] -# [PROPERTIES ... [ ...] ] -# [INCLUDE_SUBDIR] -# [OUTPUT_NAME name] -# [VERSION version] -# [SOVERSION version] -# [STATIC_ONLY | SHARED_ONLY] -# [OBJECT_LIB_ONLY]) +# [PROPERTIES ... [ ...] ] +# [INCLUDE_SUBDIR] +# [OUTPUT_NAME name] +# [VERSION version] +# [SOVERSION version] +# [STATIC_ONLY | SHARED_ONLY] +# [OBJECT_LIB_ONLY]) +# ~~~ # -# adds libraries to be built from the source files listed in the command +# Adds libraries to be built from the source files listed in the command # invocation. It is a convenient wrapper of the CMake add_library command that # is specific to our usage of add_library in SUNDIALS. # # By default, the macro uses the CMake add_library command to create the # targets: -# - ${_SHARED_LIB_SUFFIX} (will be a shared library) -# - ${_STATIC_LIB_SUFFIX} (will be a static library) -# - _obj${_SHARED_LIB_SUFFIX} (an object library that is used to -# create ${_SHARED_LIB_SUFFIX}) -# - _obj${_STATIC_LIB_SUFFIX} (an object library that is used to -# create ${_STATIC_LIB_SUFFIX}) -# - (an alias to the shared library, if enabled, otherwise an -# alias to the static library) +# +# * ${_SHARED_LIB_SUFFIX} (will be a shared library) +# +# * ${_STATIC_LIB_SUFFIX} (will be a static library) +# +# * _obj${_SHARED_LIB_SUFFIX} (an object library that is used to create +# ${_SHARED_LIB_SUFFIX}) +# +# * _obj${_STATIC_LIB_SUFFIX} (an object library that is used to create +# ${_STATIC_LIB_SUFFIX}) +# +# * (an alias to the shared library, if enabled, otherwise an alias to +# the static library) # # The SOURCES input is a list of source files used to create the library. # @@ -108,17 +112,25 @@ # # The option OBJECT_LIB_ONLY will cause the macro to only create the object # library targets. + macro(sundials_add_library target) set(options STATIC_ONLY SHARED_ONLY OBJECT_LIB_ONLY) set(oneValueArgs INCLUDE_SUBDIR OUTPUT_NAME VERSION SOVERSION) - set(multiValueArgs SOURCES HEADERS OBJECT_LIBRARIES LINK_LIBRARIES - INCLUDE_DIRECTORIES COMPILE_DEFINITIONS COMPILE_OPTIONS - COMPILE_FEATURES PROPERTIES) + set(multiValueArgs + SOURCES + HEADERS + OBJECT_LIBRARIES + LINK_LIBRARIES + INCLUDE_DIRECTORIES + COMPILE_DEFINITIONS + COMPILE_OPTIONS + COMPILE_FEATURES + PROPERTIES) # parse keyword arguments/options - cmake_parse_arguments(sundials_add_library - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(sundials_add_library "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) # library types to create set(_libtypes "") @@ -150,14 +162,15 @@ macro(sundials_add_library target) # -------------------------------------------------------------------------- # create the target for the object library - add_library(${obj_target} OBJECT ${sources} ${sundials_add_library_UNPARSED_ARGUMENTS}) + add_library(${obj_target} OBJECT ${sources} + ${sundials_add_library_UNPARSED_ARGUMENTS}) set_target_properties(${obj_target} PROPERTIES FOLDER "obj") # add all object libraries to object library if(sundials_add_library_OBJECT_LIBRARIES) target_link_libraries(${obj_target} - PRIVATE ${sundials_add_library_OBJECT_LIBRARIES}) + PRIVATE ${sundials_add_library_OBJECT_LIBRARIES}) endif() # add all link libraries to object library @@ -173,9 +186,11 @@ macro(sundials_add_library target) else() set(_all_libs ${sundials_add_library_LINK_LIBRARIES}) endif() - # Due to various issues in CMake, particularly https://gitlab.kitware.com/cmake/cmake/-/issues/25365, - # we create a fake custom target to enforce a build order. Without this, parallel builds - # might fail with an error about a missing '.mod' file when Fortran is enabled (see GitHub #410). + # Due to various issues in CMake, particularly + # https://gitlab.kitware.com/cmake/cmake/-/issues/25365, we create a fake + # custom target to enforce a build order. Without this, parallel builds + # might fail with an error about a missing '.mod' file when Fortran is + # enabled (see GitHub #410). set(_stripped_all_libs ${_all_libs}) list(FILTER _stripped_all_libs EXCLUDE REGEX "PUBLIC|INTERFACE|PRIVATE") foreach(_item ${_stripped_all_libs}) @@ -184,7 +199,8 @@ macro(sundials_add_library target) endif() endforeach() add_custom_target(fake_to_force_build_order_${obj_target}) - add_dependencies(fake_to_force_build_order_${obj_target} ${_stripped_all_libs}) + add_dependencies(fake_to_force_build_order_${obj_target} + ${_stripped_all_libs}) add_dependencies(${obj_target} fake_to_force_build_order_${obj_target}) target_link_libraries(${obj_target} ${_all_libs}) endif() @@ -194,20 +210,21 @@ macro(sundials_add_library target) target_link_libraries(${obj_target} PUBLIC caliper) endif() if(ENABLE_ADIAK) - target_link_libraries(${obj_target} PUBLIC adiak::adiak ${CMAKE_DL_LIBS}) + target_link_libraries(${obj_target} PUBLIC adiak::adiak + ${CMAKE_DL_LIBS}) endif() endif() # add includes to object library - target_include_directories(${obj_target} - PUBLIC - $ - $ - $ - $ - ) + target_include_directories( + ${obj_target} + PUBLIC $ + $ + $ + $) if(sundials_add_library_INCLUDE_DIRECTORIES) - string(REPLACE "{{libtype}}" "${_libtype}" _includes "${sundials_add_library_INCLUDE_DIRECTORIES}") + string(REPLACE "{{libtype}}" "${_libtype}" _includes + "${sundials_add_library_INCLUDE_DIRECTORIES}") target_include_directories(${obj_target} ${_includes}) endif() @@ -220,25 +237,30 @@ macro(sundials_add_library target) # add all other compile definitions to object library if(sundials_add_library_COMPILE_DEFINITIONS) - target_compile_definitions(${obj_target} ${sundials_add_library_COMPILE_DEFINITIONS}) + target_compile_definitions(${obj_target} + ${sundials_add_library_COMPILE_DEFINITIONS}) endif() # add compile options to object library if(sundials_add_library_COMPILE_OPTIONS) - target_compile_options(${obj_target} ${sundials_add_library_COMPILE_OPTIONS}) + target_compile_options(${obj_target} + ${sundials_add_library_COMPILE_OPTIONS}) endif() # add compile features if(sundials_add_library_COMPILE_FEATURES) - target_compile_features(${obj_target} ${sundials_add_library_COMPILE_FEATURES}) + target_compile_features(${obj_target} + ${sundials_add_library_COMPILE_FEATURES}) endif() # object files going into shared libs need PIC code - set_target_properties(${obj_target} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + set_target_properties(${obj_target} PROPERTIES POSITION_INDEPENDENT_CODE + TRUE) # set any other properties if(sundials_add_library_PROPERTIES) - string(REPLACE "{{libtype}}" "${_libtype}" _properties "${sundials_add_library_PROPERTIES}") + string(REPLACE "{{libtype}}" "${_libtype}" _properties + "${sundials_add_library_PROPERTIES}") set_target_properties(${obj_target} PROPERTIES ${_properties}) endif() @@ -264,19 +286,24 @@ macro(sundials_add_library target) endforeach() endif() - add_library(${_actual_target_name} ${_libtype} ${_object_sources} ${sundials_add_library_UNPARSED_ARGUMENTS}) + add_library( + ${_actual_target_name} ${_libtype} ${_object_sources} + ${sundials_add_library_UNPARSED_ARGUMENTS}) set_target_properties(${_actual_target_name} PROPERTIES FOLDER "src") # add all link libraries if(SUNDIALS_MATH_LIBRARY) - target_link_libraries(${_actual_target_name} PRIVATE "${SUNDIALS_MATH_LIBRARY}") + target_link_libraries(${_actual_target_name} + PRIVATE "${SUNDIALS_MATH_LIBRARY}") endif() if(SUNDIALS_RT_LIBRARY) - target_link_libraries(${_actual_target_name} PRIVATE "${SUNDIALS_RT_LIBRARY}") + target_link_libraries(${_actual_target_name} + PRIVATE "${SUNDIALS_RT_LIBRARY}") endif() if(sundials_add_library_LINK_LIBRARIES) - target_link_libraries(${_actual_target_name} ${sundials_add_library_LINK_LIBRARIES}) + target_link_libraries(${_actual_target_name} + ${sundials_add_library_LINK_LIBRARIES}) endif() if(SUNDIALS_BUILD_WITH_PROFILING) @@ -284,90 +311,103 @@ macro(sundials_add_library target) target_link_libraries(${_actual_target_name} PUBLIC caliper) endif() if(ENABLE_ADIAK) - target_link_libraries(${_actual_target_name} PUBLIC adiak::adiak ${CMAKE_DL_LIBS}) + target_link_libraries(${_actual_target_name} PUBLIC adiak::adiak + ${CMAKE_DL_LIBS}) endif() endif() # add common includes + # # Building: public, config/export generated, and shared private headers + # # Installing: installed include directory - target_include_directories(${_actual_target_name} PUBLIC - $ - $ - $ - $ - $) + target_include_directories( + ${_actual_target_name} + PUBLIC $ + $ + $ + $ + $) # add all other includes if(sundials_add_library_INCLUDE_DIRECTORIES) - string(REPLACE "{{libtype}}" "${_libtype}" _includes "${sundials_add_library_INCLUDE_DIRECTORIES}") + string(REPLACE "{{libtype}}" "${_libtype}" _includes + "${sundials_add_library_INCLUDE_DIRECTORIES}") target_include_directories(${_actual_target_name} ${_includes}) endif() # add compile definitions for SUNDIALS_EXPORT if(${_libtype} MATCHES "STATIC") - target_compile_definitions(${_actual_target_name} PUBLIC SUNDIALS_STATIC_DEFINE) + target_compile_definitions(${_actual_target_name} + PUBLIC SUNDIALS_STATIC_DEFINE) else() target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS) endif() # add all other compile definitions if(sundials_add_library_COMPILE_DEFINITIONS) - target_compile_definitions(${_actual_target_name} ${sundials_add_library_COMPILE_DEFINITIONS}) + target_compile_definitions(${_actual_target_name} + ${sundials_add_library_COMPILE_DEFINITIONS}) endif() # add all compile options if(sundials_add_library_COMPILE_OPTIONS) - target_compile_options(${_actual_target_name} ${sundials_add_library_COMPILE_OPTIONS}) + target_compile_options(${_actual_target_name} + ${sundials_add_library_COMPILE_OPTIONS}) endif() # add compile features if(sundials_add_library_COMPILE_FEATURES) - target_compile_features(${_actual_target_name} ${sundials_add_library_COMPILE_FEATURES}) + target_compile_features(${_actual_target_name} + ${sundials_add_library_COMPILE_FEATURES}) endif() - # exported targets are in the SUNDIALS:: namespace, so we remove the sundials_ prefix from the exported name + # exported targets are in the SUNDIALS:: namespace, so we remove the + # sundials_ prefix from the exported name string(REPLACE "sundials_" "" _export_name "${_actual_target_name}") - set_target_properties(${_actual_target_name} PROPERTIES EXPORT_NAME ${_export_name}) + set_target_properties(${_actual_target_name} PROPERTIES EXPORT_NAME + ${_export_name}) - # create an alias to match the exported target name, this way another projects can use it with either find_package() or add_subdirectory() + # create an alias to match the exported target name, this way another + # projects can use it with either find_package() or add_subdirectory() add_library(SUNDIALS::${_export_name} ALIAS ${_actual_target_name}) # set the correct output name if(sundials_add_library_OUTPUT_NAME) - if((MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) AND ${_libtype} MATCHES "STATIC") - set_target_properties(${_actual_target_name} PROPERTIES - OUTPUT_NAME "${sundials_add_library_OUTPUT_NAME}_static" - CLEAN_DIRECT_OUTPUT 1 - ) + if((MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) + AND ${_libtype} MATCHES "STATIC") + set_target_properties( + ${_actual_target_name} + PROPERTIES OUTPUT_NAME "${sundials_add_library_OUTPUT_NAME}_static" + CLEAN_DIRECT_OUTPUT 1) else() - set_target_properties(${_actual_target_name} PROPERTIES - OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME} - CLEAN_DIRECT_OUTPUT 1 - ) + set_target_properties( + ${_actual_target_name} + PROPERTIES OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME} + CLEAN_DIRECT_OUTPUT 1) endif() else() - set_target_properties(${_actual_target_name} PROPERTIES - OUTPUT_NAME ${target} - CLEAN_DIRECT_OUTPUT 1 - ) + set_target_properties( + ${_actual_target_name} PROPERTIES OUTPUT_NAME ${target} + CLEAN_DIRECT_OUTPUT 1) endif() # set the library versions if(sundials_add_library_VERSION) - set_target_properties(${_actual_target_name} PROPERTIES - VERSION ${sundials_add_library_VERSION} - ) + set_target_properties( + ${_actual_target_name} PROPERTIES VERSION + ${sundials_add_library_VERSION}) endif() if(sundials_add_library_SOVERSION) - set_target_properties(${_actual_target_name} PROPERTIES - SOVERSION ${sundials_add_library_SOVERSION} - ) + set_target_properties( + ${_actual_target_name} PROPERTIES SOVERSION + ${sundials_add_library_SOVERSION}) endif() # set any other properties if(sundials_add_library_PROPERTIES) - string(REPLACE "{{libtype}}" "${_libtype}" _properties "${sundials_add_library_PROPERTIES}") + string(REPLACE "{{libtype}}" "${_libtype}" _properties + "${sundials_add_library_PROPERTIES}") set_target_properties(${_actual_target_name} PROPERTIES ${_properties}) endif() @@ -383,8 +423,10 @@ macro(sundials_add_library target) # -------------------------------------------------------------------------- if(sundials_add_library_HEADERS) - install(FILES ${sundials_add_library_HEADERS} - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${sundials_add_library_INCLUDE_SUBDIR}") + install( + FILES ${sundials_add_library_HEADERS} + DESTINATION + "${CMAKE_INSTALL_INCLUDEDIR}/${sundials_add_library_INCLUDE_SUBDIR}") endif() # -------------------------------------------------------------------------- @@ -395,21 +437,27 @@ macro(sundials_add_library target) add_library(${target}_obj ALIAS ${target}_obj${_SHARED_LIB_SUFFIX}) if(NOT sundials_add_library_OBJECT_LIB_ONLY) add_library(${target} ALIAS ${target}${_SHARED_LIB_SUFFIX}) - set(_SUNDIALS_ALIAS_TARGETS "${target}->${target}${_SHARED_LIB_SUFFIX};${_SUNDIALS_ALIAS_TARGETS}" CACHE INTERNAL "" FORCE) + set(_SUNDIALS_ALIAS_TARGETS + "${target}->${target}${_SHARED_LIB_SUFFIX};${_SUNDIALS_ALIAS_TARGETS}" + CACHE INTERNAL "" FORCE) # Namespaced alias for using build directory directly string(REPLACE "sundials_" "" _export_name "${target}") - add_library(SUNDIALS::${_export_name} ALIAS ${target}${_SHARED_LIB_SUFFIX}) + add_library(SUNDIALS::${_export_name} ALIAS + ${target}${_SHARED_LIB_SUFFIX}) endif() else() add_library(${target}_obj ALIAS ${target}_obj${_STATIC_LIB_SUFFIX}) if(NOT sundials_add_library_OBJECT_LIB_ONLY) add_library(${target} ALIAS ${target}${_STATIC_LIB_SUFFIX}) - set(_SUNDIALS_ALIAS_TARGETS "${target}->${target}${_STATIC_LIB_SUFFIX};${_SUNDIALS_ALIAS_TARGETS}" CACHE INTERNAL "" FORCE) + set(_SUNDIALS_ALIAS_TARGETS + "${target}->${target}${_STATIC_LIB_SUFFIX};${_SUNDIALS_ALIAS_TARGETS}" + CACHE INTERNAL "" FORCE) # Namespaced alias for using build directory directly string(REPLACE "sundials_" "" _export_name "${target}") - add_library(SUNDIALS::${_export_name} ALIAS ${target}${_STATIC_LIB_SUFFIX}) + add_library(SUNDIALS::${_export_name} ALIAS + ${target}${_STATIC_LIB_SUFFIX}) endif() endif() @@ -419,40 +467,45 @@ macro(sundials_add_library target) if(NOT sundials_add_library_OBJECT_LIB_ONLY) string(REPLACE "sundials_" "" _comp_name "${target}") - set(_SUNDIALS_INSTALLED_COMPONENTS "${_comp_name};${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + set(_SUNDIALS_INSTALLED_COMPONENTS + "${_comp_name};${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() endmacro(sundials_add_library) - macro(sundials_add_f2003_library target) - set(options ) + set(options) set(oneValueArgs OUTPUT_NAME VERSION SOVERSION) - set(multiValueArgs SOURCES OBJECT_LIBRARIES LINK_LIBRARIES INCLUDE_DIRECTORIES - COMPILE_DEFINITIONS COMPILE_OPTIONS PROPERTIES) + set(multiValueArgs + SOURCES + OBJECT_LIBRARIES + LINK_LIBRARIES + INCLUDE_DIRECTORIES + COMPILE_DEFINITIONS + COMPILE_OPTIONS + PROPERTIES) # parse keyword arguments/options - cmake_parse_arguments(sundials_add_f2003_library - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(sundials_add_f2003_library "${options}" + "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(CMAKE_Fortran_MODULE_DIRECTORY) set(_includes - PUBLIC - $ - $ - ) - set(_properties PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_Fortran_MODULE_DIRECTORY}_{{libtype}}" + PUBLIC $ + $) + set(_properties + PROPERTIES Fortran_MODULE_DIRECTORY + "${CMAKE_Fortran_MODULE_DIRECTORY}_{{libtype}}" WINDOWS_EXPORT_ALL_SYMBOLS ON) else() set(_includes - PUBLIC - $ - $ - ) - set(_properties PROPERTIES - Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir" + PUBLIC $ + $) + set(_properties + PROPERTIES Fortran_MODULE_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir" WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() @@ -462,30 +515,27 @@ macro(sundials_add_f2003_library target) if(TARGET ${_clib_name}) set(_clib_target ${_clib_name}) else() - set(_clib_target ) + set(_clib_target) endif() - sundials_add_library(${target} + sundials_add_library( + ${target} SOURCES ${sundials_add_f2003_library_SOURCES} OBJECT_LIBRARIES ${sundials_add_f2003_library_OBJECT_LIBRARIES} - LINK_LIBRARIES - PUBLIC ${_clib_target} # depend on the c library - ${sundials_add_f2003_library_LINK_LIBRARIES} - INCLUDE_DIRECTORIES - ${sundials_add_f2003_library_INCLUDE_DIRECTORIES} - ${_includes} - COMPILE_DEFINITIONS ${sundials_add_f2003_library_COMPILE_DEFINITIONS} - PUBLIC "SUNDIALS_INT${SUNDIALS_INDEX_SIZE}_T" + LINK_LIBRARIES PUBLIC ${_clib_target} # depend on the c library + ${sundials_add_f2003_library_LINK_LIBRARIES} + INCLUDE_DIRECTORIES ${sundials_add_f2003_library_INCLUDE_DIRECTORIES} + ${_includes} + COMPILE_DEFINITIONS ${sundials_add_f2003_library_COMPILE_DEFINITIONS} PUBLIC + "SUNDIALS_INT${SUNDIALS_INDEX_SIZE}_T" COMPILE_OPTIONS ${sundials_add_f2003_library_COMPILE_OPTIONS} PROPERTIES ${sundials_add_f2003_library_PROPERTIES} ${_properties} OUTPUT_NAME ${sundials_add_f2003_library_OUTPUT_NAME} VERSION ${sundials_add_f2003_library_VERSION} SOVERSION ${sundials_add_f2003_library_SOVERSION} - ${sundials_add_f2003_library_UNPARSED_ARGUMENTS} - ) + ${sundials_add_f2003_library_UNPARSED_ARGUMENTS}) endmacro() - macro(append_static_suffix libs_in libs_out) set(${libs_out} "") foreach(_lib ${${libs_in}}) diff --git a/cmake/macros/SundialsAddTest.cmake b/cmake/macros/SundialsAddTest.cmake index 33eb8d7fa1..a1eb373b67 100644 --- a/cmake/macros/SundialsAddTest.cmake +++ b/cmake/macros/SundialsAddTest.cmake @@ -11,12 +11,40 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# -# SUNDIALS_ADD_TEST( ) + +# ~~~ +# sundials_add_test( +# [NODIFF] +# [MPI_NPROCS num_processes] +# [FLOAT_PRECISION num_digits] +# [INTEGER_PRECISION percent_difference] +# [ANSWER_DIR path] +# [ANSWER_FIEL file] +# [EXAMPLE_TYPE type] +# [TEST_ARGS arg1 arg2 ...]) +# ~~~ # # CMake macro to add a SUNDIALS regression test. Keyword input arguments can be -# added after to set regression test options (see oneValueArgs and -# multiValueArgs below). +# added after to set regression test options. +# +# The option NODIFF disables comparison of the test output against the answer +# file +# +# The option MPI_NPROCS sets the number of mpi tasks to use in parallel tests +# +# The option FLOAT_PRECISION set the precision (number of digits) for floating +# point failure comparisons. To use the default value, either don't provide the +# keyword, or provide the value "default". +# +# The option INTEGER_PRECISION sets the integer percentage difference for +# failure comparison. +# +# The option ANSWER_DIR sets the path to the directory containing the test +# answer file +# +# The option ANSWER_FILE set the name of test answer file +# +# The option EXAMPLE_TYPE set the example type i.e., release or develop examples # # When SUNDIALS_TEST_DEVTESTS is OFF (default) the executable is run and success # or failure is determined by the executable return value (zero or non-zero @@ -32,56 +60,44 @@ # for all tests with the cache variables SUNDIALS_TEST_FLOAT_PRECISION and # SUNDIALS_TEST_INTEGER_PRECISION. # -# -D SUNDIALS_TEST_FLOAT_PRECISION= -# -D SUNDIALS_TEST_INTEGER_PRECISION=<% difference> +# -D SUNDIALS_TEST_FLOAT_PRECISION= +# +# -D SUNDIALS_TEST_INTEGER_PRECISION=<% difference> # # By default testing output is written to builddir/Testing/output and the .out # answer file directory is set using the ANSWER_DIR keyword input to # sourcedir/examples/package/testdir. These can be changed by setting the cache # variables SUNDIALS_TEST_OUTPUT_DIR and SUNDIALS_TEST_ANSWER_DIR. # -# -D SUNDIALS_TEST_OUTPUT_DIR= -# -D SUNDIALS_TEST_ANSWER_DIR= +# -D SUNDIALS_TEST_OUTPUT_DIR= +# +# -D SUNDIALS_TEST_ANSWER_DIR= # # By default the caliper output is written to builddir/Caliper. This can be # changed by setting the cache variable SUNDIALS_CALIPER_OUTPUT_DIR. # # -D SUNDIALS_CALIPER_OUTPUT_DIR= -# -# ------------------------------------------------------------------------------ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) - # macro options - # NODIFF = do not diff the test output against an answer file set(options "NODIFF") - - # macro keyword inputs followed by a single value - # MPI_NPROCS = number of mpi tasks to use in parallel tests - # FLOAT_PRECISION = precision for floating point failure comparision (num digits), - # to use the default, either don't provide the keyword, or - # provide the value "default" - # INTEGER_PRECISION = integer percentage difference for failure comparison - # ANSWER_DIR = path to the directory containing the test answer file - # ANSWER_FILE = name of test answer file - # EXAMPLE_TYPE = release or develop examples set(oneValueArgs "MPI_NPROCS" "FLOAT_PRECISION" "INTEGER_PRECISION" - "ANSWER_DIR" "ANSWER_FILE" "EXAMPLE_TYPE") - - # macro keyword inputs followed by multiple values - # TEST_ARGS = command line arguments to pass to the test executable + "ANSWER_DIR" "ANSWER_FILE" "EXAMPLE_TYPE") set(multiValueArgs "TEST_ARGS" "EXTRA_ARGS") # parse inputs and create variables SUNDIALS_ADD_TEST_ - cmake_parse_arguments(SUNDIALS_ADD_TEST - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(SUNDIALS_ADD_TEST "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) # check that the test is not excluded string(TOLOWER "exclude-${SUNDIALS_PRECISION}" _exclude_precision) - if( ("${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}" STREQUAL "exclude") OR - ("${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}" STREQUAL _exclude_precision) ) + if(("${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}" STREQUAL "exclude") + OR ("${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}" STREQUAL _exclude_precision)) - message(STATUS "Skipped test ${NAME} because it had type ${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}") + message( + STATUS + "Skipped test ${NAME} because it had type ${SUNDIALS_ADD_TEST_EXAMPLE_TYPE}" + ) else() @@ -90,16 +106,14 @@ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) # run all tests (standard and develop) with the test runner # command line arguments for the test runner script - set(TEST_ARGS - "--verbose" - "--testname=${NAME}" - "--executablename=$" - ) + set(TEST_ARGS "--verbose" "--testname=${NAME}" + "--executablename=$") if(SUNDIALS_TEST_PROFILE) list(APPEND TEST_ARGS "--profile") - if (SUNDIALS_CALIPER_OUTPUT_DIR) - list(APPEND TEST_ARGS "--calidir=${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}") + if(SUNDIALS_CALIPER_OUTPUT_DIR) + list(APPEND TEST_ARGS + "--calidir=${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}") else() list(APPEND TEST_ARGS "--calidir=${TEST_OUTPUT_DIR}/Caliper/Example") endif() @@ -129,28 +143,40 @@ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) # do not diff the output and answer files list(APPEND TEST_ARGS "--nodiff") else() - # set a non-default floating point precision (number of digits, default 4) - if(SUNDIALS_ADD_TEST_FLOAT_PRECISION AND - (NOT SUNDIALS_ADD_TEST_FLOAT_PRECISION MATCHES "DEFAULT|default")) - list(APPEND TEST_ARGS "--floatprecision=${SUNDIALS_ADD_TEST_FLOAT_PRECISION}") + # set a non-default floating point precision (number of digits, default + # 4) + if(SUNDIALS_ADD_TEST_FLOAT_PRECISION + AND (NOT SUNDIALS_ADD_TEST_FLOAT_PRECISION MATCHES "DEFAULT|default" + )) + list(APPEND TEST_ARGS + "--floatprecision=${SUNDIALS_ADD_TEST_FLOAT_PRECISION}") elseif(SUNDIALS_TEST_FLOAT_PRECISION GREATER_EQUAL "0") - list(APPEND TEST_ARGS "--floatprecision=${SUNDIALS_TEST_FLOAT_PRECISION}") + list(APPEND TEST_ARGS + "--floatprecision=${SUNDIALS_TEST_FLOAT_PRECISION}") endif() # set a non-default integer precision (percent difference, default 10%) - if(SUNDIALS_ADD_TEST_INTEGER_PRECISION AND - (NOT SUNDIALS_ADD_TEST_INTEGER_PRECISION MATCHES "DEFAULT|default")) - list(APPEND TEST_ARGS "--integerpercentage=${SUNDIALS_ADD_TEST_INTEGER_PRECISION}") + if(SUNDIALS_ADD_TEST_INTEGER_PRECISION + AND (NOT SUNDIALS_ADD_TEST_INTEGER_PRECISION MATCHES + "DEFAULT|default")) + list(APPEND TEST_ARGS + "--integerpercentage=${SUNDIALS_ADD_TEST_INTEGER_PRECISION}") elseif(SUNDIALS_TEST_INTEGER_PRECISION GREATER_EQUAL "0") - list(APPEND TEST_ARGS "--integerpercentage=${SUNDIALS_TEST_INTEGER_PRECISION}") + list(APPEND TEST_ARGS + "--integerpercentage=${SUNDIALS_TEST_INTEGER_PRECISION}") endif() endif() # check if this test is run with MPI and set the MPI run command - if((SUNDIALS_ADD_TEST_MPI_NPROCS) AND ((MPIEXEC_EXECUTABLE) OR (SUNDIALS_TEST_MPIRUN_COMMAND))) - if (SUNDIALS_TEST_MPIRUN_COMMAND) - set(RUN_COMMAND "${SUNDIALS_TEST_MPIRUN_COMMAND} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${MPIEXEC_PREFLAGS}") + if((SUNDIALS_ADD_TEST_MPI_NPROCS) AND ((MPIEXEC_EXECUTABLE) + OR (SUNDIALS_TEST_MPIRUN_COMMAND))) + if(SUNDIALS_TEST_MPIRUN_COMMAND) + set(RUN_COMMAND + "${SUNDIALS_TEST_MPIRUN_COMMAND} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${MPIEXEC_PREFLAGS}" + ) elseif(MPIEXEC_EXECUTABLE) - set(RUN_COMMAND "${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${MPIEXEC_PREFLAGS}") + set(RUN_COMMAND + "${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${MPIEXEC_PREFLAGS}" + ) endif() # remove trailing white space (empty MPIEXEC_PREFLAGS) as it can cause @@ -170,19 +196,22 @@ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) set(_run_args "${_run_args} ${_extra_args}") unset(_extra_args) endif() - if (_run_args) + if(_run_args) string(STRIP "${_run_args}" _run_args) list(APPEND TEST_ARGS "--runargs=\"${_run_args}\"") unset(_run_args) endif() - # create test case with the corresponding test runner command and arguments - # all tests are added during development and only unlabeled tests when released - add_test(NAME ${NAME} COMMAND ${PYTHON_EXECUTABLE} ${TESTRUNNER} ${TEST_ARGS}) + # create test case with the corresponding test runner command and + # arguments all tests are added during development and only unlabeled + # tests when released + add_test(NAME ${NAME} COMMAND ${PYTHON_EXECUTABLE} ${TESTRUNNER} + ${TEST_ARGS}) elseif(NOT SUNDIALS_ADD_TEST_EXAMPLE_TYPE) - # if a test type was not set then it is a standard test that returns pass/fail + # if a test type was not set then it is a standard test that returns + # pass/fail # convert string to list if(SUNDIALS_ADD_TEST_TEST_ARGS) @@ -190,15 +219,27 @@ macro(SUNDIALS_ADD_TEST NAME EXECUTABLE) endif() # check if this test is run with MPI and add the test run command - if((SUNDIALS_ADD_TEST_MPI_NPROCS) AND ((MPIEXEC_EXECUTABLE) OR (SUNDIALS_TEST_MPIRUN_COMMAND))) + if((SUNDIALS_ADD_TEST_MPI_NPROCS) AND ((MPIEXEC_EXECUTABLE) + OR (SUNDIALS_TEST_MPIRUN_COMMAND))) if(MPIEXEC_PREFLAGS) string(REPLACE " " ";" PREFLAGS "${MPIEXEC_PREFLAGS}") endif() - if (SUNDIALS_TEST_MPIRUN_COMMAND) - string(REPLACE " " ";" MPI_EXEC_ARGS "${SUNDIALS_TEST_MPIRUN_COMMAND}") - add_test(NAME ${NAME} COMMAND ${MPI_EXEC_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${PREFLAGS} $ ${TEST_ARGS}) + if(SUNDIALS_TEST_MPIRUN_COMMAND) + string(REPLACE " " ";" MPI_EXEC_ARGS + "${SUNDIALS_TEST_MPIRUN_COMMAND}") + add_test( + NAME ${NAME} + COMMAND + ${MPI_EXEC_ARGS} ${MPIEXEC_NUMPROC_FLAG} + ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${PREFLAGS} + $ ${TEST_ARGS}) else() - add_test(NAME ${NAME} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${PREFLAGS} $ ${TEST_ARGS}) + add_test( + NAME ${NAME} + COMMAND + ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} + ${SUNDIALS_ADD_TEST_MPI_NPROCS} ${PREFLAGS} + $ ${TEST_ARGS}) endif() else() add_test(NAME ${NAME} COMMAND $ ${TEST_ARGS}) diff --git a/cmake/macros/SundialsAddTestInstall.cmake b/cmake/macros/SundialsAddTestInstall.cmake index cf2a6fb76b..159fc54cd6 100644 --- a/cmake/macros/SundialsAddTestInstall.cmake +++ b/cmake/macros/SundialsAddTestInstall.cmake @@ -11,31 +11,30 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------- -# -# SUNDIALS_ADD_TEST_INSTALL( ) + +# ~~~ +# sundials_add_test_install( +# EXECUTABLE exec) +# ~~~ # # CMake macro to add a Sundials installation smoke tests. -# --------------------------------------------------------------- +# +# The input is the SUNDIALS package name e.g., cvode, arkode, +# etc. +# +# The input is the test directory name e.g., serial, C_parallel, etc. +# +# The input EXECUTABLE is the executable to add to make test_install target macro(SUNDIALS_ADD_TEST_INSTALL PACKAGE TESTDIR) - # required macro args - # PACKAGE = Sundials package name (e.g., cvode, arkode, etc.) - # TESTDIR = Test directory name (e.g., serial, C_parallel, etc.) - - # macro options - set(options ) - - # macro keyword inputs followed by a single value - # EXECUTABLE = executable to add to make test_install target + set(options) set(oneValueArgs EXECUTABLE) - - # macro keyword inputs followed by multiple values - set(multiValueArgs ) + set(multiValueArgs) # parse inputs and create variables SUNDIALS_ADD_TEST_ - cmake_parse_arguments(SUNDIALS_ADD_TEST_INSTALL - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(SUNDIALS_ADD_TEST_INSTALL "${options}" + "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(SUNDIALS_ADD_TEST_INSTALL_EXECUTABLE) @@ -45,22 +44,26 @@ macro(SUNDIALS_ADD_TEST_INSTALL PACKAGE TESTDIR) endif() # build and run only the desired install test - add_custom_target(test_install_${PACKAGE}_${TESTDIR} + add_custom_target( + test_install_${PACKAGE}_${TESTDIR} COMMENT "Running ${PACKAGE} installation tests" WORKING_DIRECTORY ${TEST_INSTALL_DIR}/${PACKAGE}/${TESTDIR} VERBATIM - COMMAND ${CMAKE_COMMAND} ${EXAMPLES_INSTALL_PATH}/${PACKAGE}/${TESTDIR} > cmake.out - COMMAND ${CMAKE_COMMAND} --build ${TEST_INSTALL_DIR}/${PACKAGE}/${TESTDIR} --target ${SUNDIALS_ADD_TEST_INSTALL_EXECUTABLE} > make.out - COMMAND ${CMAKE_CTEST_COMMAND} -R ^${SUNDIALS_ADD_TEST_INSTALL_EXECUTABLE}$) + COMMAND ${CMAKE_COMMAND} ${EXAMPLES_INSTALL_PATH}/${PACKAGE}/${TESTDIR} > + cmake.out + COMMAND ${CMAKE_COMMAND} --build ${TEST_INSTALL_DIR}/${PACKAGE}/${TESTDIR} + --target ${SUNDIALS_ADD_TEST_INSTALL_EXECUTABLE} > make.out + COMMAND ${CMAKE_CTEST_COMMAND} -R + ^${SUNDIALS_ADD_TEST_INSTALL_EXECUTABLE}$) # make test_install depend on test_install_package add_dependencies(test_install test_install_${PACKAGE}_${TESTDIR}) endif() - # Possible extensions: - # * Make EXECUTABLE a multiple value option to add several tests to test_install - # * Make test_install_all only available when development tests are turned on + # Possible extensions: * Make EXECUTABLE a multiple value option to add + # several tests to test_install * Make test_install_all only available when + # development tests are turned on # create testing directory if necessary if(NOT EXISTS ${TEST_INSTALL_ALL_DIR}/${PACKAGE}/${TESTDIR}) @@ -68,12 +71,15 @@ macro(SUNDIALS_ADD_TEST_INSTALL PACKAGE TESTDIR) endif() # build and run all install tests - add_custom_target(test_install_all_${PACKAGE}_${TESTDIR} + add_custom_target( + test_install_all_${PACKAGE}_${TESTDIR} COMMENT "Running ${PACKAGE} installation tests" WORKING_DIRECTORY ${TEST_INSTALL_ALL_DIR}/${PACKAGE}/${TESTDIR} VERBATIM - COMMAND ${CMAKE_COMMAND} ${EXAMPLES_INSTALL_PATH}/${PACKAGE}/${TESTDIR} > cmake.out - COMMAND ${CMAKE_COMMAND} --build ${TEST_INSTALL_ALL_DIR}/${PACKAGE}/${TESTDIR} > make.out) + COMMAND ${CMAKE_COMMAND} ${EXAMPLES_INSTALL_PATH}/${PACKAGE}/${TESTDIR} > + cmake.out + COMMAND ${CMAKE_COMMAND} --build + ${TEST_INSTALL_ALL_DIR}/${PACKAGE}/${TESTDIR} > make.out) # In the future add "COMMAND ${CMAKE_CTEST_COMMAND}" here to run ctest with # the installed examples. Left out for now as some MPI tests require running # with a specific number of MPI tasks. diff --git a/cmake/macros/SundialsCMakeMacros.cmake b/cmake/macros/SundialsCMakeMacros.cmake index 20d101c834..513ada4288 100644 --- a/cmake/macros/SundialsCMakeMacros.cmake +++ b/cmake/macros/SundialsCMakeMacros.cmake @@ -19,13 +19,15 @@ # show variable (set as cache) and overwrite (force) its value macro(FORCE_VARIABLE var type doc val) - set(${var} "${val}" CACHE "${type}" "${doc}" FORCE) + set(${var} + "${val}" + CACHE "${type}" "${doc}" FORCE) endmacro(FORCE_VARIABLE) # Macros to append a common suffix or prefix to the elements of a list macro(ADD_SUFFIX rootlist suffix) - set(outlist ) + set(outlist) foreach(root ${${rootlist}}) list(APPEND outlist ${root}${suffix}) endforeach(root) @@ -33,20 +35,20 @@ macro(ADD_SUFFIX rootlist suffix) endmacro(ADD_SUFFIX) macro(ADD_PREFIX prefix rootlist) - set(outlist ) + set(outlist) foreach(root ${${rootlist}}) list(APPEND outlist ${prefix}${root}) endforeach(root) set(${rootlist} ${outlist}) endmacro(ADD_PREFIX) -# Returns an unquoted string. Note that CMake will readily turn such -# strings back into lists, due to the duality of lists and -# semicolon-separated strings. So be careful how you use it. +# Returns an unquoted string. Note that CMake will readily turn such strings +# back into lists, due to the duality of lists and semicolon-separated strings. +# So be careful how you use it. macro(LIST2STRING alist astring) foreach(elem ${${alist}}) - set(${astring} "${${astring}} ${elem}") + set(${astring} "${${astring}} ${elem}") endforeach(elem) endmacro(LIST2STRING) @@ -70,13 +72,16 @@ function(sundials_git_version) set(_tmp "") if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/.git AND ${GIT_FOUND}) - execute_process(COMMAND git describe --abbrev=12 --dirty --always --tags - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - OUTPUT_VARIABLE _tmp) + execute_process( + COMMAND git describe --abbrev=12 --dirty --always --tags + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE _tmp) string(STRIP "${_tmp}" _tmp) endif() - set(SUNDIALS_GIT_VERSION "${_tmp}" CACHE INTERNAL "") + set(SUNDIALS_GIT_VERSION + "${_tmp}" + CACHE INTERNAL "") unset(_tmp) endfunction() diff --git a/cmake/macros/SundialsInstallExamples.cmake b/cmake/macros/SundialsInstallExamples.cmake index 7f40b7af6e..471c18e0a5 100644 --- a/cmake/macros/SundialsInstallExamples.cmake +++ b/cmake/macros/SundialsInstallExamples.cmake @@ -14,21 +14,20 @@ # CMake macro for installing examples. # ------------------------------------------------------------------------------ -# The macro: -# -# SUNDIALS_INSTALL_EXAMPLES( -# DESTINATION path -# CMAKE_TEMPLATE name -# [MAKE_TEMPLATE name [SOLVER_LIBRARY target]] -# [SUNDIALS_COMPONENTS components] -# [SUNDIALS_TARGETS targets] -# [DEPENDENCIES files] -# [TEST_INSTALL target] -# [EXTRA_FILES files] -# [EXTRA_INCLUDES includes] -# ) -# -# adds an install target for examples in EXAMPLES_VAR that go with MODULE (e.g. +# ~~~ +# sundials_install_examples( +# DESTINATION path +# CMAKE_TEMPLATE name +# [MAKE_TEMPLATE name [SOLVER_LIBRARY target]] +# [SUNDIALS_COMPONENTS components] +# [SUNDIALS_TARGETS targets] +# [DEPENDENCIES files] +# [TEST_INSTALL target] +# [EXTRA_FILES files] +# [EXTRA_INCLUDES includes]) +# ~~~ +# +# Adds an install target for examples in EXAMPLES_VAR that go with MODULE (e.g. # arkode, nvecserial). # # The DESTINATION option is the path *within* EXAMPLES_INSTALL_PATH that the @@ -68,39 +67,45 @@ # # The EXTRA_INCLUDES option is a list of additional includes to set with # INCLUDE_DIRECTORIES. -# ------------------------------------------------------------------------------ macro(sundials_install_examples MODULE EXAMPLES_VAR) - set(options ) + set(options) set(oneValueArgs SOLVER_LIBRARY DESTINATION CMAKE_TEMPLATE MAKE_TEMPLATE - TEST_INSTALL) + TEST_INSTALL) set(multiValueArgs SUNDIALS_TARGETS SUNDIALS_COMPONENTS OTHER_TARGETS - EXAMPLES_DEPENDENCIES EXTRA_FILES EXTRA_INCLUDES) + EXAMPLES_DEPENDENCIES EXTRA_FILES EXTRA_INCLUDES) # Parse keyword arguments/options - cmake_parse_arguments(sundials_install_examples - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(sundials_install_examples "${options}" + "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # Install the extra files foreach(file ${sundials_install_examples_EXTRA_FILES}) - install(FILES ${file} DESTINATION ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION}) + install( + FILES ${file} + DESTINATION + ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION}) endforeach() # Install the examples foreach(example_tuple ${${EXAMPLES_VAR}}) - list(GET example_tuple 0 example) # filename always has to be the first item in the example tuple + list(GET example_tuple 0 example) # filename always has to be the first item + # in the example tuple get_filename_component(example_noext ${example} NAME_WE) file(GLOB example_header ${example_noext}.h*) file(GLOB example_out ${example_noext}*.out) - install(FILES ${example} ${example_header} ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION}) + install( + FILES ${example} ${example_header} ${example_out} + DESTINATION + ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION}) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates string(TOUPPER "${MODULE}" SOLVER) set(SOLVER_LIB "${sundials_install_examples_SOLVER_LIBRARY}") - set(EXAMPLES_DEPENDENCIES "${sundials_install_examples_EXAMPLES_DEPENDENCIES}") + set(EXAMPLES_DEPENDENCIES + "${sundials_install_examples_EXAMPLES_DEPENDENCIES}") set(EXTRA_INCLUDES "${sundials_install_examples_EXTRA_INCLUDES}") examples2string(${EXAMPLES_VAR} EXAMPLES) @@ -129,43 +134,44 @@ macro(sundials_install_examples MODULE EXAMPLES_VAR) list2string(libs_list EXAMPLES_MAKEFILE_LIBS) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used as + # a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/${sundials_install_examples_CMAKE_TEMPLATE} ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( - FILES ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION} - ) + FILES + ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/CMakeLists.txt + DESTINATION + ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION}) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX AND (DEFINED sundials_install_examples_MAKE_TEMPLATE)) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/${sundials_install_examples_MAKE_TEMPLATE} ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/Makefile_ex - @ONLY - ) + @ONLY) # install the configured Makefile_ex as Makefile install( - FILES ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION} - RENAME Makefile - ) + FILES + ${PROJECT_BINARY_DIR}/examples/${sundials_install_examples_DESTINATION}/Makefile_ex + DESTINATION + ${EXAMPLES_INSTALL_PATH}/${sundials_install_examples_DESTINATION} + RENAME Makefile) endif() # Add test_install target if(DEFINED sundials_install_examples_TEST_INSTALL) - sundials_add_test_install(${MODULE} ${sundials_install_examples_TEST_INSTALL}) + sundials_add_test_install(${MODULE} + ${sundials_install_examples_TEST_INSTALL}) endif() endmacro() diff --git a/cmake/macros/SundialsInstallExamplesGinkgo.cmake b/cmake/macros/SundialsInstallExamplesGinkgo.cmake index 05427f2051..6d89b13875 100644 --- a/cmake/macros/SundialsInstallExamplesGinkgo.cmake +++ b/cmake/macros/SundialsInstallExamplesGinkgo.cmake @@ -11,20 +11,20 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# The macro: -# -# sundials_install_examples_ginkgo( -# [CPU_EXAMPLES_VAR var] -# [GPU_EXAMPLES_VAR var] -# [CPU_GPU_EXAMPLES_VAR var] -# [DESTINATION path] -# [SUNDIALS_COMPONENTS components] -# [SUNDIALS_TARGETS targets] -# [DEPENDENCIES files] -# [EXTRA_FILES files] -# ) + +# ~~~ +# sundials_install_examples_ginkgo( +# [CPU_EXAMPLES_VAR var] +# [GPU_EXAMPLES_VAR var] +# [CPU_GPU_EXAMPLES_VAR var] +# [DESTINATION path] +# [SUNDIALS_COMPONENTS components] +# [SUNDIALS_TARGETS targets] +# [DEPENDENCIES files] +# [EXTRA_FILES files]) +# ~~~ # -# adds an install target for each example tuple in CPU_EXAMPLES_VAR, +# Adds an install target for each example tuple in CPU_EXAMPLES_VAR, # GPU_EXAMPLES_VAR, and CPU_GPU_EXAMPLES_VAR that go with MODULE (e.g. cvode, # sunlinsol). # @@ -39,23 +39,28 @@ # namespace provided to target_link_libraries. Note this may be the same as or a # subset of SUNDIALS_COMPONENTS depending on the CMakeLists.txt template. # -# The DEPENDENCIES option is a list of additional source files that the -# examples are dependent on. +# The DEPENDENCIES option is a list of additional source files that the examples +# are dependent on. # # The EXTRA_FILES option is a list of files to install that are not example # source code. -# ------------------------------------------------------------------------------ macro(sundials_install_examples_ginkgo MODULE) - set(options ) + set(options) set(oneValueArgs DESTINATION) - set(multiValueArgs CPU_EXAMPLES_VAR GPU_EXAMPLES_VAR CPU_GPU_EXAMPLES_VAR - SUNDIALS_COMPONENTS SUNDIALS_TARGETS EXTRA_FILES DEPENDENCIES) + set(multiValueArgs + CPU_EXAMPLES_VAR + GPU_EXAMPLES_VAR + CPU_GPU_EXAMPLES_VAR + SUNDIALS_COMPONENTS + SUNDIALS_TARGETS + EXTRA_FILES + DEPENDENCIES) # Parse keyword arguments/options - cmake_parse_arguments(arg - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN}) # Install the example source, header, and output file foreach(example_type CPU GPU CPU_GPU) @@ -73,7 +78,7 @@ macro(sundials_install_examples_ginkgo MODULE) # install files install(FILES ${example} ${example_header} ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION}) + DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION}) endforeach() endforeach() @@ -81,7 +86,7 @@ macro(sundials_install_examples_ginkgo MODULE) # Install the extra files and dependencies if(arg_EXTRA_FILES OR arg_DEPENDENCIES) install(FILES ${arg_EXTRA_FILES} ${arg_DEPENDENCIES} - DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION}) + DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION}) endif() # Prepare substitution variables for CMakeLists and/or Makefile templates @@ -115,15 +120,11 @@ macro(sundials_install_examples_ginkgo MODULE) # Generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_CXX_ginkgo_ex.in - ${PROJECT_BINARY_DIR}/examples/${arg_DESTINATION}/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/${arg_DESTINATION}/CMakeLists.txt @ONLY) # Install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/${arg_DESTINATION}/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION} - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/${arg_DESTINATION}/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/${arg_DESTINATION}) # Add test_install target sundials_add_test_install(${MODULE} ginkgo) diff --git a/cmake/macros/SundialsOption.cmake b/cmake/macros/SundialsOption.cmake index e80ed5aac8..0bb5c4d359 100644 --- a/cmake/macros/SundialsOption.cmake +++ b/cmake/macros/SundialsOption.cmake @@ -11,11 +11,12 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------------------- -# Provides the macro: -# -# SUNDIALS_OPTION( -# [DEPENDS_ON dependencies] -# [DEPNDS_ON_THROW_ERROR]) + +# ~~~ +# sundials_option( +# [DEPENDS_ON dependencies] +# [DEPNDS_ON_THROW_ERROR]) +# ~~~ # # Within CMake creates a cache variable and sets it to the value # if is not yet defined and, if provided, all of its @@ -32,7 +33,6 @@ # The OPTIONS option can be used to provide a list of valid values. # # The ADVANCED option can be used to make an advanced CMake option. -# --------------------------------------------------------------------------- macro(sundials_option NAME TYPE DOCSTR DEFAULT_VALUE) @@ -42,7 +42,7 @@ macro(sundials_option NAME TYPE DOCSTR DEFAULT_VALUE) # parse inputs and create variables sundials_option_ cmake_parse_arguments(sundials_option "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN} ) + "${multiValueArgs}" ${ARGN}) # check if dependencies for this option have been met set(all_depends_on_dependencies_met TRUE) @@ -58,9 +58,13 @@ macro(sundials_option NAME TYPE DOCSTR DEFAULT_VALUE) if(all_depends_on_dependencies_met) if(NOT DEFINED ${NAME}) - set(${NAME} "${DEFAULT_VALUE}" CACHE ${TYPE} ${DOCSTR}) + set(${NAME} + "${DEFAULT_VALUE}" + CACHE ${TYPE} ${DOCSTR}) else() - set(${NAME} "${${NAME}}" CACHE ${TYPE} ${DOCSTR}) + set(${NAME} + "${${NAME}}" + CACHE ${TYPE} ${DOCSTR}) endif() # make the option advanced if necessary @@ -73,10 +77,12 @@ macro(sundials_option NAME TYPE DOCSTR DEFAULT_VALUE) # if necessary, remove the CACHE variable i.e., all the variable # dependencies were previously met but are no longer satisfied if(DEFINED ${NAME}) - string(CONCAT _warn_msg_string - "The variable ${NAME} was set to ${${NAME}} but not all of its " - "dependencies (${depends_on_dependencies_not_met}) evaluate to TRUE. " - "Unsetting ${NAME}.") + string( + CONCAT + _warn_msg_string + "The variable ${NAME} was set to ${${NAME}} but not all of its " + "dependencies (${depends_on_dependencies_not_met}) evaluate to TRUE. " + "Unsetting ${NAME}.") unset(${NAME} CACHE) if(sundials_option_DEPENDS_ON_THROW_ERROR) message(FATAL_ERROR "${_warn_msg_string}") @@ -95,7 +101,10 @@ macro(sundials_option NAME TYPE DOCSTR DEFAULT_VALUE) message(FATAL_ERROR "Value of ${NAME} must be one of ${_options_msg}") endif() endforeach() - get_property(is_in_cache CACHE ${NAME} PROPERTY TYPE) + get_property( + is_in_cache + CACHE ${NAME} + PROPERTY TYPE) if(is_in_cache) set_property(CACHE ${NAME} PROPERTY STRINGS ${sundials_option_OPTIONS}) endif() diff --git a/cmake/macros/SundialsTryCompileExecute.cmake b/cmake/macros/SundialsTryCompileExecute.cmake index 81e972b92d..da4f88b535 100644 --- a/cmake/macros/SundialsTryCompileExecute.cmake +++ b/cmake/macros/SundialsTryCompileExecute.cmake @@ -11,44 +11,53 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ----------------------------------------------------------------------------- -# Defines the macro: -# -# sundials_trycompile_execute( -# [COMPILE_OUTPUT variable] -# [RUN_OUTPUT variable]) + +# ~~~ +# sundials_trycompile_execute( +# [COMPILE_OUTPUT variable] +# [RUN_OUTPUT variable]) +# ~~~ # -# This macro attempts to compile and then execute /. -# The variable COMPILE_OK is TRUE if the source code compiles successfully. +# This macro attempts to compile and then execute /. The +# variable COMPILE_OK is TRUE if the source code compiles successfully. # Otherwise COMPILE_OK is FALSE. The variable RUN_OK is TRUE if -# / runs and returns zero. Otherwise it is FALSE. -# The optional COMPILE_OUTPUT variable is set to the generated output during -# compilation. It is useful for debugging compile failures. The option -# RUN_OUTPUT is set to the generated output during runtime. +# / runs and returns zero. Otherwise it is FALSE. The optional +# COMPILE_OUTPUT variable is set to the generated output during compilation. It +# is useful for debugging compile failures. The option RUN_OUTPUT is set to the +# generated output during runtime. # ----------------------------------------------------------------------------- macro(sundials_trycompile_execute EXECUTABLE CWD COMPILE_OK RUN_OK) - set(options ) + set(options) set(oneValueArgs COMPILE_OUTPUT RUN_OUTPUT) - set(multiValueArgs ) + set(multiValueArgs) set(COMPILE_OK FALSE) set(RUN_OK FALSE) - set(COMPILE_OUTPUT ) - set(RUN_OUTPUT ) + set(COMPILE_OUTPUT) + set(RUN_OUTPUT) - cmake_parse_arguments(sundials_trycompile_execute "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(sundials_trycompile_execute "${options}" + "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # compile the code and then try to run it - try_compile(COMPILE_OK ${CWD} ${CWD} ${EXECUTABLE} OUTPUT_VARIABLE COMPILE_OUTPUT) + try_compile( + COMPILE_OK ${CWD} + ${CWD} ${EXECUTABLE} + OUTPUT_VARIABLE COMPILE_OUTPUT) if(COMPILE_OK) - execute_process(COMMAND "./${EXECUTABLE}" WORKING_DIRECTORY ${CWD} RESULT_VARIABLE RUN_OK OUTPUT_VARIABLE RUN_OUTPUT) + execute_process( + COMMAND "./${EXECUTABLE}" + WORKING_DIRECTORY ${CWD} + RESULT_VARIABLE RUN_OK + OUTPUT_VARIABLE RUN_OUTPUT) if(RUN_OK MATCHES "0") set(RUN_OK TRUE) endif() endif() - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${CWD}/CMakeFiles) # set the optional outputs if used diff --git a/cmake/tpl/FindHYPRE.cmake b/cmake/tpl/FindHYPRE.cmake index 691647544a..156356b24e 100644 --- a/cmake/tpl/FindHYPRE.cmake +++ b/cmake/tpl/FindHYPRE.cmake @@ -32,53 +32,58 @@ # HYPRE_LIBRARIES - all of the libraries needed for HYPRE # --------------------------------------------------------------- -### Find include dir -find_path(temp_HYPRE_INCLUDE_DIR - NAMES HYPRE.h hypre.h - HINTS "${HYPRE_DIR}" "${HYPRE_DIR}/include" "${HYPRE_INCLUDE_DIR}") -if (temp_HYPRE_INCLUDE_DIR) - set(HYPRE_INCLUDE_DIR "${temp_HYPRE_INCLUDE_DIR}" CACHE PATH "" FORCE) +# Find include dir +find_path( + temp_HYPRE_INCLUDE_DIR + NAMES HYPRE.h hypre.h + HINTS "${HYPRE_DIR}" "${HYPRE_DIR}/include" "${HYPRE_INCLUDE_DIR}") +if(temp_HYPRE_INCLUDE_DIR) + set(HYPRE_INCLUDE_DIR + "${temp_HYPRE_INCLUDE_DIR}" + CACHE PATH "" FORCE) endif() unset(temp_HYPRE_INCLUDE_DIR CACHE) -if (HYPRE_LIBRARY) - # We have (or were given) HYPRE_LIBRARY - get path to use for any related libs - get_filename_component(HYPRE_LIBRARY_DIR ${HYPRE_LIBRARY} PATH) +if(HYPRE_LIBRARY) + # We have (or were given) HYPRE_LIBRARY - get path to use for any related libs + get_filename_component(HYPRE_LIBRARY_DIR ${HYPRE_LIBRARY} PATH) - # force CACHE update to show user DIR that will be used - set(HYPRE_LIBRARY_DIR ${HYPRE_LIBRARY_DIR} CACHE PATH "" FORCE) -else () - # find library with user provided directory path - set(HYPRE_LIBRARY_NAMES hypre HYPRE) - find_library(HYPRE_LIBRARY - NAMES ${HYPRE_LIBRARY_NAMES} - HINTS "${HYPRE_DIR}" "${HYPRE_DIR}/lib" "${HYPRE_DIR}/lib64" "${HYPRE_LIBRARY_DIR}" - NO_DEFAULT_PATH - ) -endif () + # force CACHE update to show user DIR that will be used + set(HYPRE_LIBRARY_DIR + ${HYPRE_LIBRARY_DIR} + CACHE PATH "" FORCE) +else() + # find library with user provided directory path + set(HYPRE_LIBRARY_NAMES hypre HYPRE) + find_library( + HYPRE_LIBRARY + NAMES ${HYPRE_LIBRARY_NAMES} + HINTS "${HYPRE_DIR}" "${HYPRE_DIR}/lib" "${HYPRE_DIR}/lib64" + "${HYPRE_LIBRARY_DIR}" + NO_DEFAULT_PATH) +endif() mark_as_advanced(HYPRE_LIBRARY) list(FIND HYPRE_LIBRARIES ${HYPRE_LIBRARY} _idx) -if (_idx EQUAL -1) - set(HYPRE_LIBRARIES "${HYPRE_LIBRARY};${HYPRE_LIBRARIES}" CACHE STRING "" FORCE) -endif () +if(_idx EQUAL -1) + set(HYPRE_LIBRARIES + "${HYPRE_LIBRARY};${HYPRE_LIBRARIES}" + CACHE STRING "" FORCE) +endif() # set a more informative error message in case the library was not found -set(HYPRE_NOT_FOUND_MESSAGE "\ +set(HYPRE_NOT_FOUND_MESSAGE + "\ ************************************************************************\n\ ERROR: Could not find HYPRE. Please check the variables:\n\ HYPRE_INCLUDE_DIR and HYPRE_LIBRARY_DIR\n\ ************************************************************************") # set package variables including HYPRE_FOUND -find_package_handle_standard_args(HYPRE - REQUIRED_VARS - HYPRE_LIBRARY - HYPRE_LIBRARIES - HYPRE_INCLUDE_DIR - FAIL_MESSAGE - "${HYPRE_NOT_FOUND_MESSAGE}" - ) +find_package_handle_standard_args( + HYPRE + REQUIRED_VARS HYPRE_LIBRARY HYPRE_LIBRARIES HYPRE_INCLUDE_DIR + FAIL_MESSAGE "${HYPRE_NOT_FOUND_MESSAGE}") # Create target for HYPRE if(HYPRE_FOUND) @@ -87,9 +92,10 @@ if(HYPRE_FOUND) add_library(SUNDIALS::HYPRE UNKNOWN IMPORTED) endif() - set_target_properties(SUNDIALS::HYPRE PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${HYPRE_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${HYPRE_LIBRARIES}" - IMPORTED_LOCATION "${HYPRE_LIBRARY}") + set_target_properties( + SUNDIALS::HYPRE + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HYPRE_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${HYPRE_LIBRARIES}" + IMPORTED_LOCATION "${HYPRE_LIBRARY}") endif() diff --git a/cmake/tpl/FindKLU.cmake b/cmake/tpl/FindKLU.cmake index a3d817d037..08b77d3773 100644 --- a/cmake/tpl/FindKLU.cmake +++ b/cmake/tpl/FindKLU.cmake @@ -30,9 +30,12 @@ # KLU_LIBRARIES - all of the libraries needed for KLU # --------------------------------------------------------------- -if (NOT (KLU_INCLUDE_DIR OR KLU_LIBRARY_DIR OR KLU_LIBRARY)) - # Prefer the import target from upstream SuiteSparse if it is available - # and the user didn't point to a specific (different) version. +if(NOT + (KLU_INCLUDE_DIR + OR KLU_LIBRARY_DIR + OR KLU_LIBRARY)) + # Prefer the import target from upstream SuiteSparse if it is available and + # the user didn't point to a specific (different) version. find_package(KLU CONFIG) if(TARGET SuiteSparse::KLU) @@ -53,63 +56,69 @@ elseif(APPLE) set(CMAKE_FIND_LIBRARY_SUFFIXES d.a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif() -### Find include dir +# Find include dir find_path(temp_KLU_INCLUDE_DIR klu.h ${KLU_INCLUDE_DIR}) -if (temp_KLU_INCLUDE_DIR) - set(KLU_INCLUDE_DIR ${temp_KLU_INCLUDE_DIR}) +if(temp_KLU_INCLUDE_DIR) + set(KLU_INCLUDE_DIR ${temp_KLU_INCLUDE_DIR}) endif() unset(temp_KLU_INCLUDE_DIR CACHE) -if (KLU_LIBRARY) - # We have (or were given) KLU_LIBRARY - get path to use for other Suitesparse libs - get_filename_component(KLU_LIBRARY_DIR ${KLU_LIBRARY} PATH) +if(KLU_LIBRARY) + # We have (or were given) KLU_LIBRARY - get path to use for other Suitesparse + # libs + get_filename_component(KLU_LIBRARY_DIR ${KLU_LIBRARY} PATH) + + # force CACHE update to show user DIR that will be used + set(KLU_LIBRARY_DIR + ${KLU_LIBRARY_DIR} + CACHE PATH "" FORCE) + +else() + # find library with user provided directory path + set(KLU_LIBRARY_NAME klu) + find_library(KLU_LIBRARY ${KLU_LIBRARY_NAME} ${KLU_LIBRARY_DIR} + NO_DEFAULT_PATH) +endif() +mark_as_advanced(KLU_LIBRARY) - # force CACHE update to show user DIR that will be used - set(KLU_LIBRARY_DIR ${KLU_LIBRARY_DIR} CACHE PATH "" FORCE) +if(NOT AMD_LIBRARY) + set(AMD_LIBRARY_NAME amd) + find_library(AMD_LIBRARY ${AMD_LIBRARY_NAME} ${KLU_LIBRARY_DIR} + NO_DEFAULT_PATH) + mark_as_advanced(AMD_LIBRARY) +endif() -else () - # find library with user provided directory path - set(KLU_LIBRARY_NAME klu) - find_library(KLU_LIBRARY ${KLU_LIBRARY_NAME} ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) -endif () -mark_as_advanced(KLU_LIBRARY) +if(NOT COLAMD_LIBRARY) + set(COLAMD_LIBRARY_NAME colamd) + find_library(COLAMD_LIBRARY ${COLAMD_LIBRARY_NAME} ${KLU_LIBRARY_DIR} + NO_DEFAULT_PATH) + mark_as_advanced(COLAMD_LIBRARY) +endif() -if (NOT AMD_LIBRARY) - set(AMD_LIBRARY_NAME amd) - find_library(AMD_LIBRARY ${AMD_LIBRARY_NAME} ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) - mark_as_advanced(AMD_LIBRARY) -endif () - -if (NOT COLAMD_LIBRARY) - set(COLAMD_LIBRARY_NAME colamd) - find_library(COLAMD_LIBRARY ${COLAMD_LIBRARY_NAME} ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) - mark_as_advanced(COLAMD_LIBRARY) -endif () - -if (NOT BTF_LIBRARY) - set(BTF_LIBRARY_NAME btf) - find_library( BTF_LIBRARY ${BTF_LIBRARY_NAME} ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) - mark_as_advanced(BTF_LIBRARY) -endif () - -if (NOT SUITESPARSECONFIG_LIBRARY) - set(SUITESPARSECONFIG_LIBRARY_NAME suitesparseconfig) - # NOTE: no prefix for this library on windows - if(MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) - set(CMAKE_FIND_LIBRARY_PREFIXES "") - endif() - find_library( SUITESPARSECONFIG_LIBRARY ${SUITESPARSECONFIG_LIBRARY_NAME} ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) - mark_as_advanced(SUITESPARSECONFIG_LIBRARY) -endif () +if(NOT BTF_LIBRARY) + set(BTF_LIBRARY_NAME btf) + find_library(BTF_LIBRARY ${BTF_LIBRARY_NAME} ${KLU_LIBRARY_DIR} + NO_DEFAULT_PATH) + mark_as_advanced(BTF_LIBRARY) +endif() + +if(NOT SUITESPARSECONFIG_LIBRARY) + set(SUITESPARSECONFIG_LIBRARY_NAME suitesparseconfig) + # NOTE: no prefix for this library on windows + if(MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) + set(CMAKE_FIND_LIBRARY_PREFIXES "") + endif() + find_library(SUITESPARSECONFIG_LIBRARY ${SUITESPARSECONFIG_LIBRARY_NAME} + ${KLU_LIBRARY_DIR} NO_DEFAULT_PATH) + mark_as_advanced(SUITESPARSECONFIG_LIBRARY) +endif() -set(KLU_LIBRARIES ${KLU_LIBRARY} ${AMD_LIBRARY} ${COLAMD_LIBRARY} ${BTF_LIBRARY} ${SUITESPARSECONFIG_LIBRARY}) +set(KLU_LIBRARIES ${KLU_LIBRARY} ${AMD_LIBRARY} ${COLAMD_LIBRARY} + ${BTF_LIBRARY} ${SUITESPARSECONFIG_LIBRARY}) # set package variables including KLU_FOUND -find_package_handle_standard_args(KLU - REQUIRED_VARS - KLU_LIBRARY - KLU_LIBRARIES - KLU_INCLUDE_DIR) +find_package_handle_standard_args(KLU REQUIRED_VARS KLU_LIBRARY KLU_LIBRARIES + KLU_INCLUDE_DIR) # Create target for KLU if(KLU_FOUND) @@ -118,9 +127,10 @@ if(KLU_FOUND) add_library(SUNDIALS::KLU UNKNOWN IMPORTED) endif() - set_target_properties(SUNDIALS::KLU PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${KLU_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${KLU_LIBRARIES}" - IMPORTED_LOCATION "${KLU_LIBRARY}") + set_target_properties( + SUNDIALS::KLU + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${KLU_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${KLU_LIBRARIES}" + IMPORTED_LOCATION "${KLU_LIBRARY}") endif() diff --git a/cmake/tpl/FindMAGMA.cmake b/cmake/tpl/FindMAGMA.cmake index 28b8fa8c7d..0d71560b72 100644 --- a/cmake/tpl/FindMAGMA.cmake +++ b/cmake/tpl/FindMAGMA.cmake @@ -15,16 +15,17 @@ # ----------------------------------------------------------------------------- # find the MAGMA include path -find_path(MAGMA_INCLUDE_DIR magma_v2.h +find_path( + MAGMA_INCLUDE_DIR magma_v2.h NAMES magma_v2.h HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} PATH_SUFFIXES include NO_DEFAULT_PATH - DOC "Directory with MAGMA header" -) + DOC "Directory with MAGMA header") # find the main MAGMA library -find_library(MAGMA_LIBRARY +find_library( + MAGMA_LIBRARY NAMES magma HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} PATH_SUFFIXES lib lib64 @@ -34,14 +35,15 @@ find_library(MAGMA_LIBRARY # Find the optional sparse component if("SPARSE" IN_LIST MAGMA_FIND_COMPONENTS) set(_sparse_required MAGMA_SPARSE_LIBRARY) - find_library(MAGMA_SPARSE_LIBRARY + find_library( + MAGMA_SPARSE_LIBRARY NAMES magma_sparse HINTS ${MAGMA_DIR} $ENV{MAGMA_DIR} PATH_SUFFIXES lib lib64 NO_DEFAULT_PATH DOC "The MAGMA sparse library.") else() - set(_sparse_required ) + set(_sparse_required) endif() # Determine MAGMA version and libraries it depends on @@ -52,7 +54,8 @@ if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR) if(MAGMA_PKG_CONFIG_PATH) - file(STRINGS ${MAGMA_PKG_CONFIG_PATH} _version_string REGEX "Version: [0-9].[0-9].[0-9]") + file(STRINGS ${MAGMA_PKG_CONFIG_PATH} _version_string + REGEX "Version: [0-9].[0-9].[0-9]") string(REGEX MATCHALL "[0-9]" _version_full "${_version_string}") list(GET _version_full 0 _version_major) @@ -65,7 +68,7 @@ if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR) string(REPLACE " " ";" _libraries_list ${_libraries_string}) list(SUBLIST _libraries_list 1 -1 _libraries_list) # remove 'Libs:' part - set(_interface_libraires ) + set(_interface_libraires) if(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") if(NOT TARGET roc::hipblas) @@ -79,20 +82,24 @@ if(MAGMA_LIBRARY AND MAGMA_INCLUDE_DIR) endif() if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") - if (NOT TARGET CUDA::cudart) + if(NOT TARGET CUDA::cudart) find_package(CUDAToolkit REQUIRED) endif() endif() foreach(lib ${_libraries_list}) - if(NOT (lib STREQUAL "-lmagma" OR lib STREQUAL "-lmagma_sparse" - OR lib STREQUAL "-L\${libdir}" OR lib STREQUAL "") ) + if(NOT + (lib STREQUAL "-lmagma" + OR lib STREQUAL "-lmagma_sparse" + OR lib STREQUAL "-L\${libdir}" + OR lib STREQUAL "")) # Check if we need to find cusparse or cublas if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") - # Replace cublas, cusparse with the CMake targets because the library path in - # the magma pkgconfig is not reliable. Sepcifically, the path is wrong on systems - # like Perlmutter where the NVIDIA HPC SDK is used. + # Replace cublas, cusparse with the CMake targets because the library + # path in the magma pkgconfig is not reliable. Sepcifically, the path + # is wrong on systems like Perlmutter where the NVIDIA HPC SDK is + # used. if(lib STREQUAL "-lcublas") set(lib CUDA::cublas) endif() @@ -110,15 +117,11 @@ endif() set(MAGMA_LIBRARIES "${MAGMA_LIBRARY};${_interface_libraires}") -find_package_handle_standard_args(MAGMA - REQUIRED_VARS - MAGMA_LIBRARY - MAGMA_LIBRARIES - MAGMA_INCLUDE_DIR - ${_sparse_required} - VERSION_VAR - MAGMA_VERSION - ) +find_package_handle_standard_args( + MAGMA + REQUIRED_VARS MAGMA_LIBRARY MAGMA_LIBRARIES MAGMA_INCLUDE_DIR + ${_sparse_required} + VERSION_VAR MAGMA_VERSION) # Create target for MAGMA if(MAGMA_FOUND) @@ -127,20 +130,23 @@ if(MAGMA_FOUND) add_library(SUNDIALS::MAGMA UNKNOWN IMPORTED) endif() - set_target_properties(SUNDIALS::MAGMA PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_interface_libraires}" - IMPORTED_LOCATION "${MAGMA_LIBRARY}") + set_target_properties( + SUNDIALS::MAGMA + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_interface_libraires}" + IMPORTED_LOCATION "${MAGMA_LIBRARY}") if(MAGMA_SPARSE_LIBRARY) if(NOT TARGET SUNDIALS::MAGMA_SPARSE) add_library(SUNDIALS::MAGMA_SPARSE UNKNOWN IMPORTED) endif() - set_target_properties(SUNDIALS::MAGMA_SPARSE PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${MAGMA_LIBRARY};${_interface_libraires}" - IMPORTED_LOCATION "${MAGMA_SPARSE_LIBRARY}") + set_target_properties( + SUNDIALS::MAGMA_SPARSE + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES + "${MAGMA_LIBRARY};${_interface_libraires}" + IMPORTED_LOCATION "${MAGMA_SPARSE_LIBRARY}") endif() endif() diff --git a/cmake/tpl/FindPETSC.cmake b/cmake/tpl/FindPETSC.cmake index 80a01f69ad..d85e199f9b 100644 --- a/cmake/tpl/FindPETSC.cmake +++ b/cmake/tpl/FindPETSC.cmake @@ -38,9 +38,12 @@ pkg_check_modules(PKG_PETSC "PETSc${_pkg_version_spec}") unset(_pkg_version_spec) # Find the PETSC libraries -set(_petsc_libs ) +set(_petsc_libs) foreach(_next_lib IN LISTS PKG_PETSC_LIBRARIES) - find_library(_petsc_lib_${_next_lib} NAMES ${_next_lib} HINTS ${PKG_PETSC_LIBRARY_DIRS}) + find_library( + _petsc_lib_${_next_lib} + NAMES ${_next_lib} + HINTS ${PKG_PETSC_LIBRARY_DIRS}) if(_petsc_lib_${_next_lib}) list(APPEND _petsc_libs "${_petsc_lib_${_next_lib}}") endif() @@ -56,17 +59,15 @@ foreach(_next_lib IN LISTS PKG_PETSC_STATIC_LIBRARIES) endif() if(_next_lib MATCHES "kokkoskernels") if(NOT TARGET Kokkos::kokkoskernels) - find_package(KokkosKernels REQUIRED - HINTS "${KokkosKernels_DIR}" "${PKG_PETSC_LIBRARY_DIRS}" - NO_DEFAULT_PATH) + find_package(KokkosKernels REQUIRED HINTS "${KokkosKernels_DIR}" + "${PKG_PETSC_LIBRARY_DIRS}" NO_DEFAULT_PATH) endif() list(APPEND _petsc_libs "Kokkos::kokkoskernels") endif() if(_next_lib MATCHES "kokkos") if(NOT TARGET Kokkos::kokkos) - find_package(Kokkos REQUIRED - HINTS "${Kokkos_DIR}" "${PKG_PETSC_LIBRARY_DIRS}" - NO_DEFAULT_PATH) + find_package(Kokkos REQUIRED HINTS "${Kokkos_DIR}" + "${PKG_PETSC_LIBRARY_DIRS}" NO_DEFAULT_PATH) endif() list(APPEND _petsc_libs "Kokkos::kokkos") endif() @@ -87,10 +88,18 @@ if(PKG_PETSC_VERSION) list(GET _petsc_versions 1 _petsc_version_minor) list(GET _petsc_versions 2 _petsc_version_patch) - set(PETSC_VERSION ${PKG_PETSC_VERSION} CACHE STRING "Full version of PETSC") - set(PETSC_VERSION_MAJOR ${_petsc_version_major} CACHE INTERNAL "Major version of PETSC") - set(PETSC_VERSION_MINOR ${_petsc_version_minor} CACHE INTERNAL "Minor version of PETSC") - set(PETSC_VERSION_PATCH ${_petsc_version_patch} CACHE INTERNAL "Patch version of PETSC") + set(PETSC_VERSION + ${PKG_PETSC_VERSION} + CACHE STRING "Full version of PETSC") + set(PETSC_VERSION_MAJOR + ${_petsc_version_major} + CACHE INTERNAL "Major version of PETSC") + set(PETSC_VERSION_MINOR + ${_petsc_version_minor} + CACHE INTERNAL "Minor version of PETSC") + set(PETSC_VERSION_PATCH + ${_petsc_version_patch} + CACHE INTERNAL "Patch version of PETSC") unset(_petsc_versions) unset(_petsc_version_major) @@ -98,18 +107,19 @@ if(PKG_PETSC_VERSION) unset(_petsc_version_patch) endif() -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (PETSC +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + PETSC REQUIRED_VARS PETSC_FOUND PETSC_INCLUDE_DIRS PETSC_LIBRARIES - VERSION_VAR PETSC_VERSION - ) + VERSION_VAR PETSC_VERSION) if(NOT TARGET SUNDIALS::PETSC) add_library(SUNDIALS::PETSC INTERFACE IMPORTED) - set_target_properties(SUNDIALS::PETSC PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${PETSC_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${PETSC_LIBRARIES}" - ) + set_target_properties( + SUNDIALS::PETSC + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PETSC_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${PETSC_LIBRARIES}") endif() -mark_as_advanced(PETSC_INCLUDE_DIRS PETSC_LIBRARIES PETSC_VERSION_MAJOR PETSC_VERSION_MINOR PETSC_VERSION_PATCH PETSC_VERSION) +mark_as_advanced(PETSC_INCLUDE_DIRS PETSC_LIBRARIES PETSC_VERSION_MAJOR + PETSC_VERSION_MINOR PETSC_VERSION_PATCH PETSC_VERSION) diff --git a/cmake/tpl/FindSUPERLUDIST.cmake b/cmake/tpl/FindSUPERLUDIST.cmake index 016f1c8ecf..1dcaf00c20 100644 --- a/cmake/tpl/FindSUPERLUDIST.cmake +++ b/cmake/tpl/FindSUPERLUDIST.cmake @@ -35,7 +35,9 @@ # --------------------------------------------------------------- if(NOT SUPERLUDIST_LINK_LIBRARIES AND SUPERLUDIST_LIBRARIES) - set(SUPERLUDIST_LINK_LIBRARIES "${SUPERLUDIST_LIBRARIES}" CACHE INTERNAL "") + set(SUPERLUDIST_LINK_LIBRARIES + "${SUPERLUDIST_LIBRARIES}" + CACHE INTERNAL "") elseif(NOT SUPERLUDIST_LINK_LIBRARIES) find_package(PkgConfig REQUIRED) list(APPEND CMAKE_PREFIX_PATH "${SUPERLUDIST_DIR}") @@ -47,39 +49,61 @@ elseif(NOT SUPERLUDIST_LINK_LIBRARIES) endif() endif() pkg_search_module(SUPERLUDIST REQUIRED "superlu_dist${_pkg_version_spec}") - set(SUPERLUDIST_LINK_LIBRARIES "${SUPERLUDIST_LINK_LIBRARIES}" CACHE INTERNAL "") - set(SUPERLUDIST_INCLUDE_DIRS "${SUPERLUDIST_INCLUDE_DIRS}" CACHE INTERNAL "") + set(SUPERLUDIST_LINK_LIBRARIES + "${SUPERLUDIST_LINK_LIBRARIES}" + CACHE INTERNAL "") + set(SUPERLUDIST_INCLUDE_DIRS + "${SUPERLUDIST_INCLUDE_DIRS}" + CACHE INTERNAL "") endif() # find the library configuration file -set(SUPERLUDIST_CUDA FALSE CACHE BOOL "SuperLU DIST was built with CUDA support") -set(SUPERLUDIST_ROCM FALSE CACHE BOOL "SuperLU DIST was built with ROCm support") +set(SUPERLUDIST_CUDA + FALSE + CACHE BOOL "SuperLU DIST was built with CUDA support") +set(SUPERLUDIST_ROCM + FALSE + CACHE BOOL "SuperLU DIST was built with ROCm support") if(SUPERLUDIST_INCLUDE_DIRS) - find_file(SUPERLUDIST_CONFIG_PATH superlu_dist_config.h PATHS "${SUPERLUDIST_INCLUDE_DIRS}") + find_file(SUPERLUDIST_CONFIG_PATH superlu_dist_config.h + PATHS "${SUPERLUDIST_INCLUDE_DIRS}") mark_as_advanced(FORCE SUPERLUDIST_CONFIG_PATH) if(SUPERLUDIST_VERSION VERSION_GREATER_EQUAL "8.0.0") - file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _index_size_64 REGEX "#define XSDK_INDEX_SIZE 64") - file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _index_size_32 REGEX "#undef XSDK_INDEX_SIZE") - if(_index_size_64) - set(SUPERLUDIST_INDEX_SIZE 64 CACHE STRING "SuperLU DIST index size (bit width)" FORCE) - else() - set(SUPERLUDIST_INDEX_SIZE 32 CACHE STRING "SuperLU DIST index size (bit width)" FORCE) - endif() - mark_as_advanced(FORCE SUPERLUDIST_INDEX_SIZE) + file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _index_size_64 + REGEX "#define XSDK_INDEX_SIZE 64") + file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _index_size_32 + REGEX "#undef XSDK_INDEX_SIZE") + if(_index_size_64) + set(SUPERLUDIST_INDEX_SIZE + 64 + CACHE STRING "SuperLU DIST index size (bit width)" FORCE) + else() + set(SUPERLUDIST_INDEX_SIZE + 32 + CACHE STRING "SuperLU DIST index size (bit width)" FORCE) + endif() + mark_as_advanced(FORCE SUPERLUDIST_INDEX_SIZE) else() - file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _strings_with_index_size REGEX "XSDK_INDEX_SIZE") + file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _strings_with_index_size + REGEX "XSDK_INDEX_SIZE") list(GET _strings_with_index_size 0 _index_size_string) - string(REGEX MATCHALL "[0-9][0-9]" SUPERLUDIST_INDEX_SIZE "${_index_size_string}") + string(REGEX MATCHALL "[0-9][0-9]" SUPERLUDIST_INDEX_SIZE + "${_index_size_string}") endif() - file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _strings_have_cuda REGEX "HAVE_CUDA") + file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _strings_have_cuda + REGEX "HAVE_CUDA") string(REGEX MATCH "TRUE|FALSE" _has_cuda "${_strings_have_cuda}") file(STRINGS "${SUPERLUDIST_CONFIG_PATH}" _strings_have_rocm REGEX "HAVE_HIP") string(REGEX MATCH "TRUE|FALSE" _has_rocm "${_strings_have_rocm}") if(_has_cuda) - set(SUPERLUDIST_CUDA TRUE CACHE BOOL "SuperLU DIST was built with CUDA support" FORCE) + set(SUPERLUDIST_CUDA + TRUE + CACHE BOOL "SuperLU DIST was built with CUDA support" FORCE) endif() if(_has_rocm) - set(SUPERLUDIST_ROCM TRUE CACHE BOOL "SuperLU DIST was built with ROCm support" FORCE) + set(SUPERLUDIST_ROCM + TRUE + CACHE BOOL "SuperLU DIST was built with ROCm support" FORCE) endif() unset(_has_cuda) unset(_has_rocm) @@ -87,21 +111,26 @@ endif() # find the library version file if(NOT SUPERLUDIST_VERSION AND SUPERLUDIST_INCLUDE_DIRS) - find_file(SUPERLUDIST_VERSION_PATH superlu_defs.h PATHS "${SUPERLUDIST_INCLUDE_DIRS}") + find_file(SUPERLUDIST_VERSION_PATH superlu_defs.h + PATHS "${SUPERLUDIST_INCLUDE_DIRS}") - file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_major REGEX "SUPERLU_DIST_MAJOR_VERSION") + file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_major + REGEX "SUPERLU_DIST_MAJOR_VERSION") list(GET _version_major 0 _version_string) string(REGEX MATCHALL "[0-9]" _version_major "${_version_string}") - file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_minor REGEX "SUPERLU_DIST_MINOR_VERSION") + file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_minor + REGEX "SUPERLU_DIST_MINOR_VERSION") list(GET _version_minor 0 _version_string) string(REGEX MATCHALL "[0-9]" _version_minor "${_version_string}") - file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_patch REGEX "SUPERLU_DIST_PATCH_VERSION") + file(STRINGS "${SUPERLUDIST_VERSION_PATH}" _version_patch + REGEX "SUPERLU_DIST_PATCH_VERSION") list(GET _version_patch 0 _version_string) string(REGEX MATCHALL "[0-9]" _version_patch "${_version_string}") - set(SUPERLUDIST_VERSION "${_version_major}.${_version_minor}.${_version_patch}") + set(SUPERLUDIST_VERSION + "${_version_major}.${_version_minor}.${_version_patch}") mark_as_advanced(FORCE SUPERLUDIST_VERSION_PATH) endif() @@ -117,18 +146,16 @@ if(SUPERLUDIST_ROCM) find_package(hipblas REQUIRED) find_package(rocsolver REQUIRED) find_package(rocblas REQUIRED) - list(APPEND SUPERLUDIST_LINK_LIBRARIES hip::device roc::hipblas roc::rocblas roc::rocsolver) + list(APPEND SUPERLUDIST_LINK_LIBRARIES hip::device roc::hipblas roc::rocblas + roc::rocsolver) endif() # set package variables including SUPERLUDIST_FOUND -find_package_handle_standard_args(SUPERLUDIST - REQUIRED_VARS - SUPERLUDIST_LINK_LIBRARIES - SUPERLUDIST_INCLUDE_DIRS - SUPERLUDIST_INDEX_SIZE - VERSION_VAR - SUPERLUDIST_VERSION - ) +find_package_handle_standard_args( + SUPERLUDIST + REQUIRED_VARS SUPERLUDIST_LINK_LIBRARIES SUPERLUDIST_INCLUDE_DIRS + SUPERLUDIST_INDEX_SIZE + VERSION_VAR SUPERLUDIST_VERSION) # Create target for SuperLU_DIST if(SUPERLUDIST_FOUND) @@ -137,8 +164,9 @@ if(SUPERLUDIST_FOUND) add_library(SUNDIALS::SUPERLUDIST INTERFACE IMPORTED) endif() - set_target_properties(SUNDIALS::SUPERLUDIST PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SUPERLUDIST_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${SUPERLUDIST_LINK_LIBRARIES}") + set_target_properties( + SUNDIALS::SUPERLUDIST + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SUPERLUDIST_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${SUPERLUDIST_LINK_LIBRARIES}") endif() diff --git a/cmake/tpl/FindSUPERLUMT.cmake b/cmake/tpl/FindSUPERLUMT.cmake index 4e1acb30b0..b9fb949549 100644 --- a/cmake/tpl/FindSUPERLUMT.cmake +++ b/cmake/tpl/FindSUPERLUMT.cmake @@ -33,13 +33,15 @@ # check for valid thread type string(TOUPPER ${SUPERLUMT_THREAD_TYPE} _upper_SUPERLUMT_THREAD_TYPE) -force_variable(SUPERLUMT_THREAD_TYPE STRING "SuperLU_MT threading type: OPENMP or PTHREAD" ${_upper_SUPERLUMT_THREAD_TYPE}) +force_variable( + SUPERLUMT_THREAD_TYPE STRING "SuperLU_MT threading type: OPENMP or PTHREAD" + ${_upper_SUPERLUMT_THREAD_TYPE}) -if(SUPERLUMT_THREAD_TYPE AND - NOT SUPERLUMT_THREAD_TYPE STREQUAL "OPENMP" AND - NOT SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") +if(SUPERLUMT_THREAD_TYPE + AND NOT SUPERLUMT_THREAD_TYPE STREQUAL "OPENMP" + AND NOT SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") message(FATAL_ERROR "Unknown thread type: ${SUPERLUMT_THREAD_TYPE} " - "Please enter PTHREAD or OPENMP") + "Please enter PTHREAD or OPENMP") endif() # check if the threading library has been found @@ -69,9 +71,8 @@ if(MSVC) set(CMAKE_FIND_LIBRARY_PREFIXES lib ${CMAKE_FIND_LIBRARY_PREFIXES}) endif() -# Check if SUPERLUMT_LIBRARIES contains the superlu_mt -# library as well as TPLs. If so, extract it into the -# SUPERLUMT_LIBRARY variable. +# Check if SUPERLUMT_LIBRARIES contains the superlu_mt library as well as TPLs. +# If so, extract it into the SUPERLUMT_LIBRARY variable. if(SUPERLUMT_LIBRARIES MATCHES "${SUPERLUMT_LIBRARY_NAME}") foreach(lib ${SUPERLUMT_LIBRARIES}) if(lib MATCHES "${SUPERLUMT_LIBRARY_NAME}") @@ -83,8 +84,10 @@ endif() # find library if(NOT SUPERLUMT_LIBRARY) # search user provided directory path - find_library(SUPERLUMT_LIBRARY ${SUPERLUMT_LIBRARY_NAME} - PATHS ${SUPERLUMT_LIBRARY_DIR} NO_DEFAULT_PATH) + find_library( + SUPERLUMT_LIBRARY ${SUPERLUMT_LIBRARY_NAME} + PATHS ${SUPERLUMT_LIBRARY_DIR} + NO_DEFAULT_PATH) # if user didn't provide a path, search anywhere if(NOT (SUPERLUMT_LIBRARY_DIR OR SUPERLUMT_LIBRARY)) find_library(SUPERLUMT_LIBRARY ${SUPERLUMT_LIBRARY_NAME}) @@ -94,38 +97,42 @@ endif() # set the libraries, stripping out 'NOTFOUND' from previous attempts if(NOT (SUPERLUMT_LIBRARIES MATCHES "${SUPERLUMT_LIBRARY_NAME}")) - set(SUPERLUMT_LIBRARIES "${SUPERLUMT_LIBRARY};${SUPERLUMT_LIBRARIES}" CACHE STRING "" FORCE) + set(SUPERLUMT_LIBRARIES + "${SUPERLUMT_LIBRARY};${SUPERLUMT_LIBRARIES}" + CACHE STRING "" FORCE) endif() # set the library dir option if it wasn't preset if(SUPERLUMT_LIBRARY AND (NOT SUPERLUMT_LIBRARY_DIR)) get_filename_component(SUPERLUMT_LIBRARY_DIR ${SUPERLUMT_LIBRARY} DIRECTORY) - set(SUPERLUMT_LIBRARY_DIR ${SUPERLUMT_LIBRARY_DIR} CACHE PATH "" FORCE) + set(SUPERLUMT_LIBRARY_DIR + ${SUPERLUMT_LIBRARY_DIR} + CACHE PATH "" FORCE) endif() # set the include dir option if it wasn't preset if(SUPERLUMT_LIBRARY AND (NOT SUPERLUMT_INCLUDE_DIR)) - get_filename_component(SUPERLUMT_INCLUDE_DIR ${SUPERLUMT_LIBRARY_DIR} DIRECTORY) - set(SUPERLUMT_INCLUDE_DIR "${SUPERLUMT_INCLUDE_DIR}/include" CACHE PATH "" FORCE) + get_filename_component(SUPERLUMT_INCLUDE_DIR ${SUPERLUMT_LIBRARY_DIR} + DIRECTORY) + set(SUPERLUMT_INCLUDE_DIR + "${SUPERLUMT_INCLUDE_DIR}/include" + CACHE PATH "" FORCE) endif() # set a more informative error message in case the library was not found -set(SUPERLUMT_NOT_FOUND_MESSAGE "\ +set(SUPERLUMT_NOT_FOUND_MESSAGE + "\ ************************************************************************\n\ ERROR: Could not find SuperLU_MT. Please check the variables:\n\ SUPERLUMT_INCLUDE_DIR and SUPERLUMT_LIBRARY_DIR\n\ ************************************************************************") # set package variables including SUPERLUMT_FOUND -find_package_handle_standard_args(SUPERLUMT - REQUIRED_VARS - SUPERLUMT_LIBRARY - SUPERLUMT_LIBRARIES - SUPERLUMT_INCLUDE_DIR - SUPERLUMT_THREAD_TYPE - FAIL_MESSAGE - "${SUPERLUMT_NOT_FOUND_MESSAGE}" - ) +find_package_handle_standard_args( + SUPERLUMT + REQUIRED_VARS SUPERLUMT_LIBRARY SUPERLUMT_LIBRARIES SUPERLUMT_INCLUDE_DIR + SUPERLUMT_THREAD_TYPE + FAIL_MESSAGE "${SUPERLUMT_NOT_FOUND_MESSAGE}") # Create target for SuperLU_MT if(SUPERLUMT_FOUND) @@ -134,10 +141,11 @@ if(SUPERLUMT_FOUND) add_library(SUNDIALS::SUPERLUMT UNKNOWN IMPORTED) endif() - set_target_properties(SUNDIALS::SUPERLUMT PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SUPERLUMT_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${SUPERLUMT_LIBRARIES}" - IMPORTED_LOCATION "${SUPERLUMT_LIBRARY}") + set_target_properties( + SUNDIALS::SUPERLUMT + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SUPERLUMT_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SUPERLUMT_LIBRARIES}" + IMPORTED_LOCATION "${SUPERLUMT_LIBRARY}") list2string(SUPERLUMT_LIBRARIES EXAMPLES_SUPERLUMT_LIBRARIES) diff --git a/cmake/tpl/FindTrilinos.cmake b/cmake/tpl/FindTrilinos.cmake index af4dff69b3..42be691041 100644 --- a/cmake/tpl/FindTrilinos.cmake +++ b/cmake/tpl/FindTrilinos.cmake @@ -16,20 +16,23 @@ # ----------------------------------------------------------------------------- # First try and find Trilinos using Trilinos_DIR only. -find_package(Trilinos - NAMES Trilinos TRILINOS +find_package( + Trilinos + NAMES + Trilinos + TRILINOS PATHS - ${Trilinos_DIR}/lib/cmake/Trilinos - ${Trilinos_DIR} + ${Trilinos_DIR}/lib/cmake/Trilinos + ${Trilinos_DIR} NO_DEFAULT_PATH QUIET) # set package variables including Trilinos_FOUND -find_package_handle_standard_args(Trilinos - REQUIRED_VARS - Trilinos_LIBRARIES # defined in TrilinosConfig.cmake - Trilinos_INCLUDE_DIRS # defined in TrilinosConfig.cmake - ) +find_package_handle_standard_args( + Trilinos + REQUIRED_VARS Trilinos_LIBRARIES # defined in TrilinosConfig.cmake + Trilinos_INCLUDE_DIRS # defined in TrilinosConfig.cmake +) # Create Trilinos target if(Trilinos_FOUND) @@ -38,8 +41,9 @@ if(Trilinos_FOUND) add_library(SUNDIALS::TRILINOS IMPORTED INTERFACE) endif() - set_target_properties(SUNDIALS::TRILINOS PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Trilinos_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${Trilinos_LIBRARIES}") + set_target_properties( + SUNDIALS::TRILINOS + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Trilinos_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Trilinos_LIBRARIES}") endif() diff --git a/cmake/tpl/FindXBRAID.cmake b/cmake/tpl/FindXBRAID.cmake index 8b60d4eec6..d46299a337 100644 --- a/cmake/tpl/FindXBRAID.cmake +++ b/cmake/tpl/FindXBRAID.cmake @@ -29,28 +29,36 @@ # Check if we are locating XBraid using the root install directory or a list of # include directories and link libraries -if (XBRAID_INCLUDES OR XBRAID_LIBRARIES) +if(XBRAID_INCLUDES OR XBRAID_LIBRARIES) - if (XBRAID_INCLUDES AND XBRAID_LIBRARIES) + if(XBRAID_INCLUDES AND XBRAID_LIBRARIES) - set(XBRAID_DIR "" CACHE PATH "Path to the root of XBraid installation" FORCE) + set(XBRAID_DIR + "" + CACHE PATH "Path to the root of XBraid installation" FORCE) - else () + else() - string(CONCAT msg - "Both XBRAID_INCLUDES and XBRAID_LIBRARIES must be provided:\n" - " XBRAID_INCLUDES=${XBRAID_INCLUDES}\n" - " XBRAID_LIBRARIES=${XBRAID_LIBRARIES}") + string( + CONCAT msg + "Both XBRAID_INCLUDES and XBRAID_LIBRARIES must be provided:\n" + " XBRAID_INCLUDES=${XBRAID_INCLUDES}\n" + " XBRAID_LIBRARIES=${XBRAID_LIBRARIES}") message(FATAL_ERROR ${msg}) - endif () + endif() -else () +else() - set(XBRAID_INCLUDES "" CACHE STRING "Semi-colon separated list of XBraid include directories" FORCE) - set(XBRAID_LIBRARIES "" CACHE STRING "Semi-colon separated list of XBraid link libraries" FORCE) + set(XBRAID_INCLUDES + "" + CACHE STRING "Semi-colon separated list of XBraid include directories" + FORCE) + set(XBRAID_LIBRARIES + "" + CACHE STRING "Semi-colon separated list of XBraid link libraries" FORCE) -endif () +endif() # unset cache values for multiple passes unset(XBRAID_INCLUDE_DIR CACHE) @@ -59,138 +67,140 @@ unset(XBRAID_LIBRARY CACHE) unset(XBRAID_INCS CACHE) unset(XBRAID_LIBS CACHE) -if (XBRAID_INCLUDES AND XBRAID_LIBRARIES) +if(XBRAID_INCLUDES AND XBRAID_LIBRARIES) message(STATUS "Finding XBraid using XBRAID_INCLUDES and XBRAID_LIBRARIES") # extract path from XBRAID_INCLUDES - foreach (include_dir ${XBRAID_INCLUDES}) - if (EXISTS "${include_dir}/braid.h") - set(XBRAID_INCLUDE_DIR "${include_dir}" CACHE "XBraid include directory") + foreach(include_dir ${XBRAID_INCLUDES}) + if(EXISTS "${include_dir}/braid.h") + set(XBRAID_INCLUDE_DIR + "${include_dir}" + CACHE "XBraid include directory") break() - endif () - endforeach () + endif() + endforeach() # check if the include directory was found - if (NOT XBRAID_INCLUDE_DIR) - string(CONCAT msg - "Could not determine XBraid include directory from XBRAID_INCLUDES:\n" - " XBRAID_INCLUDES=${XBRAID_INCLUDES}\n") + if(NOT XBRAID_INCLUDE_DIR) + string( + CONCAT + msg + "Could not determine XBraid include directory from XBRAID_INCLUDES:\n" + " XBRAID_INCLUDES=${XBRAID_INCLUDES}\n") message(FATAL_ERROR ${msg}) - endif () + endif() # extract library from XBRAID_LIBRARIES - foreach (library_path ${XBRAID_LIBRARIES}) + foreach(library_path ${XBRAID_LIBRARIES}) get_filename_component(library_name "${library_path}" NAME) - if (library_name MATCHES "braid") - set(XBRAID_LIBRARY "${library_path}" CACHE "XBraid library") + if(library_name MATCHES "braid") + set(XBRAID_LIBRARY + "${library_path}" + CACHE "XBraid library") break() - endif () - endforeach () + endif() + endforeach() # check if the library directory was found - if (NOT XBRAID_LIBRARY) + if(NOT XBRAID_LIBRARY) string(CONCAT msg - "Could not determine XBraid library from XBRAID_LIBRARIES:\n" - " XBRAID_LIBRARIES=${XBRAID_LIBRARIES}") + "Could not determine XBraid library from XBRAID_LIBRARIES:\n" + " XBRAID_LIBRARIES=${XBRAID_LIBRARIES}") message(FATAL_ERROR ${msg}) - endif () + endif() -else () +else() message(STATUS "Finding XBraid using XBRAID_DIR") # find XBRAID_DIR - if (NOT XBRAID_DIR) + if(NOT XBRAID_DIR) message(STATUS "Looking for XBraid in common install locations") find_path(XBRAID_DIR include/braid.h braid/braid.h) - endif () + endif() # check if XBRAID_DIR was set/found - if (NOT XBRAID_DIR) + if(NOT XBRAID_DIR) - string(CONCAT msg - "Could not locate XBraid install directory please set:\n" - " - XBRAID_DIR\n" - "or used the advanced options\n" - " - XBRAID_INCLUDES and XBRAID_LIBRARIES.") + string(CONCAT msg "Could not locate XBraid install directory please set:\n" + " - XBRAID_DIR\n" "or used the advanced options\n" + " - XBRAID_INCLUDES and XBRAID_LIBRARIES.") message(FATAL_ERROR ${msg}) - endif () + endif() # Find the include dir - find_path(XBRAID_INCLUDE_DIR braid.h - PATHS - ${XBRAID_DIR} - PATH_SUFFIXES - include braid - DOC - "XBraid include directory" + find_path( + XBRAID_INCLUDE_DIR braid.h + PATHS ${XBRAID_DIR} + PATH_SUFFIXES include braid + DOC "XBraid include directory" NO_DEFAULT_PATH) # check if the include directory was found - if (NOT XBRAID_INCLUDE_DIR) - string(CONCAT msg - "Could not determine XBraid include directory from XBRAID_DIR:\n" - " XBRAID_DIR=${XBRAID_DIR}\n") + if(NOT XBRAID_INCLUDE_DIR) + string( + CONCAT msg + "Could not determine XBraid include directory from XBRAID_DIR:\n" + " XBRAID_DIR=${XBRAID_DIR}\n") message(FATAL_ERROR ${msg}) - endif () + endif() # Find the library - find_library(XBRAID_LIBRARY braid - PATHS - ${XBRAID_DIR} - PATH_SUFFIXES - lib braid - DOC - "XBraid library" + find_library( + XBRAID_LIBRARY braid + PATHS ${XBRAID_DIR} + PATH_SUFFIXES lib braid + DOC "XBraid library" NO_DEFAULT_PATH) # check if the library was found - if (NOT XBRAID_LIBRARY) - string(CONCAT msg - "Could not determine XBraid library from XBRAID_DIR:\n" - " XBRAID_DIR=${XBRAID_DIR}\n") + if(NOT XBRAID_LIBRARY) + string(CONCAT msg "Could not determine XBraid library from XBRAID_DIR:\n" + " XBRAID_DIR=${XBRAID_DIR}\n") message(FATAL_ERROR ${msg}) - endif () + endif() -endif () +endif() # set package variables including XBRAID_FOUND -find_package_handle_standard_args(XBRAID - REQUIRED_VARS - XBRAID_INCLUDE_DIR - XBRAID_LIBRARY - ) +find_package_handle_standard_args(XBRAID REQUIRED_VARS XBRAID_INCLUDE_DIR + XBRAID_LIBRARY) # XBraid target -if (XBRAID_FOUND) +if(XBRAID_FOUND) # create target if necessary - if (NOT TARGET SUNDIALS::XBRAID) + if(NOT TARGET SUNDIALS::XBRAID) add_library(SUNDIALS::XBRAID UNKNOWN IMPORTED) - endif () + endif() # update target properties (for multiple passes) - set_target_properties(SUNDIALS::XBRAID PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${XBRAID_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${XBRAID_LIBRARIES}" - IMPORTED_LOCATION "${XBRAID_LIBRARY}") - - # set variables for output message, compile tests, and - # CMake/Makefile templates - if (XBRAID_INCLUDES AND XBRAID_LIBRARIES) - set(XBRAID_INCS "${XBRAID_INCLUDES}" CACHE INTERNAL - "Internal XBraid includes") - set(XBRAID_LIBS "${XBRAID_LIBRARIES}" CACHE INTERNAL - "Internal XBraid libraries") - else () - set(XBRAID_INCS "${XBRAID_INCLUDE_DIR}" CACHE INTERNAL - "Internal XBraid includes") - set(XBRAID_LIBS "${XBRAID_LIBRARY}" CACHE INTERNAL - "Internal XBraid libraries") - endif () - -endif () + set_target_properties( + SUNDIALS::XBRAID + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${XBRAID_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${XBRAID_LIBRARIES}" + IMPORTED_LOCATION "${XBRAID_LIBRARY}") + + # set variables for output message, compile tests, and CMake/Makefile + # templates + if(XBRAID_INCLUDES AND XBRAID_LIBRARIES) + set(XBRAID_INCS + "${XBRAID_INCLUDES}" + CACHE INTERNAL "Internal XBraid includes") + set(XBRAID_LIBS + "${XBRAID_LIBRARIES}" + CACHE INTERNAL "Internal XBraid libraries") + else() + set(XBRAID_INCS + "${XBRAID_INCLUDE_DIR}" + CACHE INTERNAL "Internal XBraid includes") + set(XBRAID_LIBS + "${XBRAID_LIBRARY}" + CACHE INTERNAL "Internal XBraid libraries") + endif() + +endif() diff --git a/cmake/tpl/SundialsAdiak.cmake b/cmake/tpl/SundialsAdiak.cmake index b5342a7216..8a6483e308 100644 --- a/cmake/tpl/SundialsAdiak.cmake +++ b/cmake/tpl/SundialsAdiak.cmake @@ -44,7 +44,6 @@ find_package(adiak REQUIRED) message(STATUS "ADIAK_LIBRARIES: ${adiak_LIBRARIES}") message(STATUS "ADIAK_INCLUDE_DIR: ${adiak_INCLUDE_DIR}") - # ----------------------------------------------------------------------------- # Section 4: Test the TPL # ----------------------------------------------------------------------------- @@ -57,28 +56,33 @@ if(adiak_FOUND AND (NOT adiak_WORKS)) file(MAKE_DIRECTORY ${adiak_TEST_DIR}) # Create a C source file - file(WRITE ${adiak_TEST_DIR}/ltest.c - "\#include \n" - "int main(void)\n" - "{\n" - " adiak_init(NULL);\n" - " adiak_fini();\n" - " return 0;\n" - "}\n") + file( + WRITE ${adiak_TEST_DIR}/ltest.c + "\#include \n" + "int main(void)\n" + "{\n" + " adiak_init(NULL);\n" + " adiak_fini();\n" + " return 0;\n" + "}\n") - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${adiak_TEST_DIR}/CMakeFiles) # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${adiak_TEST_DIR} ${adiak_TEST_DIR}/ltest.c + try_compile( + COMPILE_OK ${adiak_TEST_DIR} + ${adiak_TEST_DIR}/ltest.c OUTPUT_VARIABLE COMPILE_OUTPUT LINK_LIBRARIES adiak::adiak ${CMAKE_DL_LIBS}) # Process test result if(COMPILE_OK) message(STATUS "Checking if adiak works with SUNDIALS... OK") - set(adiak_WORKS TRUE CACHE BOOL "adiak works with SUNDIALS as configured" FORCE) + set(adiak_WORKS + TRUE + CACHE BOOL "adiak works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if adiak works with SUNDIALS... FAILED") message(STATUS "Check output: ") diff --git a/cmake/tpl/SundialsCaliper.cmake b/cmake/tpl/SundialsCaliper.cmake index 998376266d..a07ad39556 100644 --- a/cmake/tpl/SundialsCaliper.cmake +++ b/cmake/tpl/SundialsCaliper.cmake @@ -40,9 +40,7 @@ endif() # Section 3: Find the TPL # ----------------------------------------------------------------------------- -find_package(CALIPER - PATHS "${CALIPER_DIR}" - REQUIRED) +find_package(CALIPER PATHS "${CALIPER_DIR}" REQUIRED) message(STATUS "CALIPER_LIB_DIR: ${caliper_LIB_DIR}") message(STATUS "CALIPER_INCLUDE_DIR: ${caliper_INCLUDE_DIR}") @@ -59,7 +57,8 @@ if(CALIPER_FOUND AND (NOT CALIPER_WORKS)) file(MAKE_DIRECTORY ${CALIPER_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${CALIPER_TEST_DIR}/CMakeLists.txt + file( + WRITE ${CALIPER_TEST_DIR}/CMakeLists.txt "cmake_minimum_required(VERSION ${CMAKE_VERSION})\n" "project(ltest C)\n" "set(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -77,27 +76,32 @@ if(CALIPER_FOUND AND (NOT CALIPER_WORKS)) "target_link_libraries(ltest caliper)\n") # Create a C source file - file(WRITE ${CALIPER_TEST_DIR}/ltest.c - "\#include \n" - "int main(void)\n" - "{\n" - " CALI_MARK_FUNCTION_BEGIN;\n" - " CALI_MARK_FUNCTION_END;\n" - " return 0;\n" - "}\n") + file( + WRITE ${CALIPER_TEST_DIR}/ltest.c + "\#include \n" + "int main(void)\n" + "{\n" + " CALI_MARK_FUNCTION_BEGIN;\n" + " CALI_MARK_FUNCTION_END;\n" + " return 0;\n" + "}\n") - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${CALIPER_TEST_DIR}/CMakeFiles) # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${CALIPER_TEST_DIR} ${CALIPER_TEST_DIR} ltest + try_compile( + COMPILE_OK ${CALIPER_TEST_DIR} + ${CALIPER_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) # Process test result if(COMPILE_OK) message(STATUS "Checking if CALIPER works with SUNDIALS... OK") - set(CALIPER_WORKS TRUE CACHE BOOL "CALIPER works with SUNDIALS as configured" FORCE) + set(CALIPER_WORKS + TRUE + CACHE BOOL "CALIPER works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if CALIPER works with SUNDIALS... FAILED") message(STATUS "Check output: ") diff --git a/cmake/tpl/SundialsGinkgo.cmake b/cmake/tpl/SundialsGinkgo.cmake index 37dd821a2b..715f30e6bd 100644 --- a/cmake/tpl/SundialsGinkgo.cmake +++ b/cmake/tpl/SundialsGinkgo.cmake @@ -36,13 +36,10 @@ endif() # Section 2: Check to make sure options are compatible # ----------------------------------------------------------------------------- - # ----------------------------------------------------------------------------- # Section 3: Find the TPL # ----------------------------------------------------------------------------- -find_package(Ginkgo REQUIRED - HINTS "${Ginkgo_DIR}" - NO_DEFAULT_PATH) +find_package(Ginkgo REQUIRED HINTS "${Ginkgo_DIR}" NO_DEFAULT_PATH) message(STATUS "GINKGO VERSION: ${GINKGO_PROJECT_VERSION}") message(STATUS "GINKGO BUILD TYPE: ${GINKGO_BUILD_TYPE}") @@ -55,27 +52,43 @@ message(STATUS "GINKGO CXX FLAGS: ${GINKGO_INTERFACE_CXX_FLAGS}") # ----------------------------------------------------------------------------- if(Ginkgo_FOUND AND (NOT GINKGO_WORKS)) if(SUNDIALS_PRECISION MATCHES "extended|EXTENDED") - message(FATAL_ERROR "SUNDIALS GINKGO interface is not compatible with extended precision") + message( + FATAL_ERROR + "SUNDIALS GINKGO interface is not compatible with extended precision") endif() if(SUNDIALS_GINKGO_BACKENDS MATCHES "CUDA" AND NOT ENABLE_CUDA) - message(FATAL_ERROR "SUNDIALS_GINKGO_BACKENDS includes CUDA but CUDA is not enabled. Set ENABLE_CUDA=ON or change the backend.") + message( + FATAL_ERROR + "SUNDIALS_GINKGO_BACKENDS includes CUDA but CUDA is not enabled. Set ENABLE_CUDA=ON or change the backend." + ) endif() if(SUNDIALS_GINKGO_BACKENDS MATCHES "HIP" AND NOT ENABLE_HIP) - message(FATAL_ERROR "SUNDIALS_GINKGO_BACKENDS includes HIP but HIP is not enabled. Set ENABLE_HIP=ON or change the backend.") + message( + FATAL_ERROR + "SUNDIALS_GINKGO_BACKENDS includes HIP but HIP is not enabled. Set ENABLE_HIP=ON or change the backend." + ) endif() - if(SUNDIALS_GINKGO_BACKENDS MATCHES "SYCL" AND NOT ENABLE_SYCL) - message(FATAL_ERROR "SUNDIALS_GINKGO_BACKENDS includes SYCL but SYCL is not enabled. Set ENABLE_SYCL=ON or change the backend.") + if(SUNDIALS_GINKGO_BACKENDS MATCHES "SYCL" AND NOT ENABLE_SYCL) + message( + FATAL_ERROR + "SUNDIALS_GINKGO_BACKENDS includes SYCL but SYCL is not enabled. Set ENABLE_SYCL=ON or change the backend." + ) endif() if(SUNDIALS_GINKGO_BACKENDS MATCHES "OMP" AND NOT ENABLE_OPENMP) - message(FATAL_ERROR "SUNDIALS_GINKGO_BACKENDS includes OMP but OpenMP is not enabled. Set ENABLE_OPENMP=ON or change the backend.") + message( + FATAL_ERROR + "SUNDIALS_GINKGO_BACKENDS includes OMP but OpenMP is not enabled. Set ENABLE_OPENMP=ON or change the backend." + ) endif() message(STATUS "Checking if GINKGO works... OK") - set(GINKGO_WORKS TRUE CACHE BOOL "GINKGO works with SUNDIALS as configured" FORCE) + set(GINKGO_WORKS + TRUE + CACHE BOOL "GINKGO works with SUNDIALS as configured" FORCE) elseif(Ginkgo_FOUND AND GINKGO_WORKS) message(STATUS "Skipped GINKGO tests, assuming GINKGO works with SUNDIALS.") endif() diff --git a/cmake/tpl/SundialsHypre.cmake b/cmake/tpl/SundialsHypre.cmake index ea27e32973..9d880d2562 100644 --- a/cmake/tpl/SundialsHypre.cmake +++ b/cmake/tpl/SundialsHypre.cmake @@ -39,7 +39,8 @@ endif() if(ENABLE_HYPRE) # Using hypre requres building with MPI enabled if(NOT ENABLE_MPI) - message(FATAL_ERROR "MPI is required for hypre support. Set ENABLE_MPI to ON.") + message( + FATAL_ERROR "MPI is required for hypre support. Set ENABLE_MPI to ON.") endif() # Using hypre requres C99 or newer if(CMAKE_C_STANDARD STREQUAL "90") @@ -68,46 +69,52 @@ if(HYPRE_FOUND AND (NOT HYPRE_WORKS)) file(MAKE_DIRECTORY ${HYPRE_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${HYPRE_TEST_DIR}/CMakeLists.txt - "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" - "PROJECT(ltest C)\n" - "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" - "SET(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")\n" - "SET(CMAKE_C_COMPILER ${MPI_C_COMPILER})\n" - "SET(CMAKE_C_STANDARD \"${CMAKE_C_STANDARD}\")\n" - "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\")\n" - "SET(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE}\")\n" - "SET(CMAKE_C_FLAGS_DEBUG \"${CMAKE_C_FLAGS_DEBUG}\")\n" - "SET(CMAKE_C_FLAGS_RELWITHDEBUGINFO \"${CMAKE_C_FLAGS_RELWITHDEBUGINFO}\")\n" - "SET(CMAKE_C_FLAGS_MINSIZE \"${CMAKE_C_FLAGS_MINSIZE}\")\n" - "SET(CMAKE_EXE_LINKER_FLAGS \"${LINK_MATH_LIB}\")\n" - "INCLUDE_DIRECTORIES(${HYPRE_INCLUDE_DIR})\n" - "ADD_EXECUTABLE(ltest ltest.c)\n" - "TARGET_LINK_LIBRARIES(ltest ${HYPRE_LIBRARIES})\n") - - file(WRITE ${HYPRE_TEST_DIR}/ltest.c - "\#include \"HYPRE_parcsr_ls.h\"\n" - "int main(void) {\n" - "HYPRE_ParVector par_b;\n" - "HYPRE_IJVector b;\n" - "par_b = 0;\n" - "b = 0;\n" - "if (par_b != 0 || b != 0) return(1);\n" - "else return(0);\n" - "}\n") - - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + file( + WRITE ${HYPRE_TEST_DIR}/CMakeLists.txt + "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" + "PROJECT(ltest C)\n" + "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" + "SET(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")\n" + "SET(CMAKE_C_COMPILER ${MPI_C_COMPILER})\n" + "SET(CMAKE_C_STANDARD \"${CMAKE_C_STANDARD}\")\n" + "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\")\n" + "SET(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE}\")\n" + "SET(CMAKE_C_FLAGS_DEBUG \"${CMAKE_C_FLAGS_DEBUG}\")\n" + "SET(CMAKE_C_FLAGS_RELWITHDEBUGINFO \"${CMAKE_C_FLAGS_RELWITHDEBUGINFO}\")\n" + "SET(CMAKE_C_FLAGS_MINSIZE \"${CMAKE_C_FLAGS_MINSIZE}\")\n" + "SET(CMAKE_EXE_LINKER_FLAGS \"${LINK_MATH_LIB}\")\n" + "INCLUDE_DIRECTORIES(${HYPRE_INCLUDE_DIR})\n" + "ADD_EXECUTABLE(ltest ltest.c)\n" + "TARGET_LINK_LIBRARIES(ltest ${HYPRE_LIBRARIES})\n") + + file( + WRITE ${HYPRE_TEST_DIR}/ltest.c + "\#include \"HYPRE_parcsr_ls.h\"\n" + "int main(void) {\n" + "HYPRE_ParVector par_b;\n" + "HYPRE_IJVector b;\n" + "par_b = 0;\n" + "b = 0;\n" + "if (par_b != 0 || b != 0) return(1);\n" + "else return(0);\n" + "}\n") + + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${HYPRE_TEST_DIR}/CMakeFiles) # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${HYPRE_TEST_DIR} ${HYPRE_TEST_DIR} ltest + try_compile( + COMPILE_OK ${HYPRE_TEST_DIR} + ${HYPRE_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) # Process test result if(COMPILE_OK) message(STATUS "Checking if HYPRE works... OK") - set(HYPRE_WORKS TRUE CACHE BOOL "HYPRE works with SUNDIALS as configured" FORCE) + set(HYPRE_WORKS + TRUE + CACHE BOOL "HYPRE works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if HYPRE works... FAILED") message(STATUS "Check output: ") @@ -116,5 +123,8 @@ if(HYPRE_FOUND AND (NOT HYPRE_WORKS)) endif() elseif(HYPRE_FOUND AND HYPRE_WORKS) - message(STATUS "Skipped HYPRE tests, assuming HYPRE works with SUNDIALS. Set HYPRE_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped HYPRE tests, assuming HYPRE works with SUNDIALS. Set HYPRE_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsKLU.cmake b/cmake/tpl/SundialsKLU.cmake index f3c006608c..3f56e809a8 100644 --- a/cmake/tpl/SundialsKLU.cmake +++ b/cmake/tpl/SundialsKLU.cmake @@ -38,7 +38,8 @@ endif() # KLU does not support single or extended precision if(SUNDIALS_PRECISION MATCHES "SINGLE" OR SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR "KLU is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR "KLU is not compatible with ${SUNDIALS_PRECISION} precision") endif() # ----------------------------------------------------------------------------- @@ -69,7 +70,10 @@ if(KLU_FOUND AND (NOT KLU_WORKS)) set(CMAKE_REQUIRED_INCLUDES ${save_CMAKE_REQUIRED_INCLUDES}) message(STATUS "Size of SuiteSparse_long is ${SIZEOF_SUITESPARSE_LONG}") if(NOT SIZEOF_SUITESPARSE_LONG EQUAL "8") - message(FATAL_ERROR "Size of 'sunindextype' is 8 but size of 'SuiteSparse_long' is ${SIZEOF_SUITESPARSE_LONG}. KLU cannot be used.") + message( + FATAL_ERROR + "Size of 'sunindextype' is 8 but size of 'SuiteSparse_long' is ${SIZEOF_SUITESPARSE_LONG}. KLU cannot be used." + ) endif() endif() @@ -78,43 +82,44 @@ if(KLU_FOUND AND (NOT KLU_WORKS)) file(MAKE_DIRECTORY ${KLU_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${KLU_TEST_DIR}/CMakeLists.txt - "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" - "PROJECT(ltest C)\n" - "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" - "SET(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")\n" - "SET(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n" - "SET(CMAKE_C_STANDARD \"${CMAKE_C_STANDARD}\")\n" - "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\")\n" - "SET(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE}\")\n" - "SET(CMAKE_C_FLAGS_DEBUG \"${CMAKE_C_FLAGS_DEBUG}\")\n" - "SET(CMAKE_C_FLAGS_RELWITHDEBUGINFO \"${CMAKE_C_FLAGS_RELWITHDEBUGINFO}\")\n" - "SET(CMAKE_C_FLAGS_MINSIZE \"${CMAKE_C_FLAGS_MINSIZE}\")\n" - "INCLUDE_DIRECTORIES(${KLU_INCLUDE_DIR})\n" - "ADD_EXECUTABLE(ltest ltest.c)\n" - "TARGET_LINK_LIBRARIES(ltest ${KLU_LIBRARIES})\n") + file( + WRITE ${KLU_TEST_DIR}/CMakeLists.txt + "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" + "PROJECT(ltest C)\n" + "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" + "SET(CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\")\n" + "SET(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n" + "SET(CMAKE_C_STANDARD \"${CMAKE_C_STANDARD}\")\n" + "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}\")\n" + "SET(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE}\")\n" + "SET(CMAKE_C_FLAGS_DEBUG \"${CMAKE_C_FLAGS_DEBUG}\")\n" + "SET(CMAKE_C_FLAGS_RELWITHDEBUGINFO \"${CMAKE_C_FLAGS_RELWITHDEBUGINFO}\")\n" + "SET(CMAKE_C_FLAGS_MINSIZE \"${CMAKE_C_FLAGS_MINSIZE}\")\n" + "INCLUDE_DIRECTORIES(${KLU_INCLUDE_DIR})\n" + "ADD_EXECUTABLE(ltest ltest.c)\n" + "TARGET_LINK_LIBRARIES(ltest ${KLU_LIBRARIES})\n") # Create a C source file which calls a KLU function file(WRITE ${KLU_TEST_DIR}/ltest.c - "\#include \"klu.h\"\n" - "int main(void) {\n" - "klu_common Common;\n" - "klu_defaults (&Common);\n" - "return(0);\n" - "}\n") - - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + "\#include \"klu.h\"\n" "int main(void) {\n" "klu_common Common;\n" + "klu_defaults (&Common);\n" "return(0);\n" "}\n") + + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${KLU_TEST_DIR}/CMakeFiles) # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${KLU_TEST_DIR} ${KLU_TEST_DIR} ltest + try_compile( + COMPILE_OK ${KLU_TEST_DIR} + ${KLU_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) # Process test result if(COMPILE_OK) message(STATUS "Checking if KLU works... OK") - set(KLU_WORKS TRUE CACHE BOOL "KLU works with SUNDIALS as configured" FORCE) + set(KLU_WORKS + TRUE + CACHE BOOL "KLU works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if KLU works... FAILED") message(STATUS "Check output: ") @@ -123,5 +128,8 @@ if(KLU_FOUND AND (NOT KLU_WORKS)) endif() elseif(KLU_FOUND AND KLU_WORKS) - message(STATUS "Skipped KLU tests, assuming KLU works with SUNDIALS. Set KLU_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped KLU tests, assuming KLU works with SUNDIALS. Set KLU_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsKokkos.cmake b/cmake/tpl/SundialsKokkos.cmake index c082a14e87..ad13181b30 100644 --- a/cmake/tpl/SundialsKokkos.cmake +++ b/cmake/tpl/SundialsKokkos.cmake @@ -36,18 +36,16 @@ endif() # Section 2: Check to make sure options are compatible # ----------------------------------------------------------------------------- - # ----------------------------------------------------------------------------- # Section 3: Find the TPL # ----------------------------------------------------------------------------- -find_package(Kokkos REQUIRED - HINTS "${Kokkos_DIR}" - NO_DEFAULT_PATH) +find_package(Kokkos REQUIRED HINTS "${Kokkos_DIR}" NO_DEFAULT_PATH) -# We should be able to use Kokkos_DEVICES directly but it seems to get -# removed or unset in some CMake versions -set(KOKKOS_EXAMPLES_BACKENDS "${Kokkos_DEVICES}" CACHE STRING - "Kokkos backends to build examples with") +# We should be able to use Kokkos_DEVICES directly but it seems to get removed +# or unset in some CMake versions +set(KOKKOS_EXAMPLES_BACKENDS + "${Kokkos_DEVICES}" + CACHE STRING "Kokkos backends to build examples with") mark_as_advanced(FORCE KOKKOS_EXAMPLES_BACKENDS) message(STATUS "Kokkos VERSION: ${Kokkos_VERSION}") @@ -57,8 +55,9 @@ message(STATUS "Kokkos VERSION: ${Kokkos_VERSION}") if(Kokkos_FOUND AND (NOT KOKKOS_WORKS)) message(STATUS "Checking if Kokkos works... OK") - set(KOKKOS_WORKS TRUE CACHE BOOL "Kokkos works with SUNDIALS as configured" - FORCE) + set(KOKKOS_WORKS + TRUE + CACHE BOOL "Kokkos works with SUNDIALS as configured" FORCE) elseif(Kokkos_FOUND AND KOKKOS_WORKS) message(STATUS "Skipped Kokkos tests, assuming Kokkos works with SUNDIALS.") endif() diff --git a/cmake/tpl/SundialsKokkosKernels.cmake b/cmake/tpl/SundialsKokkosKernels.cmake index 93d68152bf..4f495725ee 100644 --- a/cmake/tpl/SundialsKokkosKernels.cmake +++ b/cmake/tpl/SundialsKokkosKernels.cmake @@ -36,13 +36,11 @@ endif() # Section 2: Check to make sure options are compatible # ----------------------------------------------------------------------------- - # ----------------------------------------------------------------------------- # Section 3: Find the TPL # ----------------------------------------------------------------------------- -find_package(KokkosKernels REQUIRED - HINTS "${KokkosKernels_DIR}" - NO_DEFAULT_PATH) +find_package(KokkosKernels REQUIRED HINTS "${KokkosKernels_DIR}" + NO_DEFAULT_PATH) message(STATUS "Kokkos Kernels VERSION: ${KokkosKernels_VERSION}") @@ -52,8 +50,12 @@ message(STATUS "Kokkos Kernels VERSION: ${KokkosKernels_VERSION}") if(KokkosKernels_FOUND AND (NOT KOKKOS_KERNELS_WORKS)) message(STATUS "Checking if Kokkos Kernels works... OK") - set(KOKKOS_KERNELS_WORKS TRUE CACHE BOOL - "Kokkos Kernels works with SUNDIALS as configured" FORCE) + set(KOKKOS_KERNELS_WORKS + TRUE + CACHE BOOL "Kokkos Kernels works with SUNDIALS as configured" FORCE) elseif(KokkosKernels_FOUND AND KOKKOS_WORKS) - message(STATUS "Skipped Kokkos Kernels tests, assuming Kokkos Kernels works with SUNDIALS.") + message( + STATUS + "Skipped Kokkos Kernels tests, assuming Kokkos Kernels works with SUNDIALS." + ) endif() diff --git a/cmake/tpl/SundialsLapack.cmake b/cmake/tpl/SundialsLapack.cmake index 0047d6afd5..74261bb469 100644 --- a/cmake/tpl/SundialsLapack.cmake +++ b/cmake/tpl/SundialsLapack.cmake @@ -69,15 +69,16 @@ message(STATUS "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}") # Determining the name-mangling scheme if needed # --------------------------------------------------------------- # In general, names of symbols with and without underscore may be mangled -# differently (e.g. g77 mangles mysub to mysub_ and my_sub to my_sub__), -# we have to consider both cases. +# differently (e.g. g77 mangles mysub to mysub_ and my_sub to my_sub__), we have +# to consider both cases. # # Method: -# 1) create a library from a Fortran source file which defines a function "mysub" -# 2) attempt to link with this library a C source file which calls the "mysub" -# function using various possible schemes (6 different schemes, corresponding -# to all combinations lower/upper case and none/one/two underscores). -# 3) define the name-mangling scheme based on the test that was successful. +# +# 1. create a library from a Fortran source file which defines a function "mysub" +# 2. attempt to link with this library a C source file which calls the "mysub" +# function using various possible schemes (6 different schemes, corresponding +# to all combinations lower/upper case and none/one/two underscores). +# 3. define the name-mangling scheme based on the test that was successful. # # On exit, if we were able to infer the scheme, the variables # CMAKE_Fortran_SCHEME_NO_UNDERSCORES and CMAKE_Fortran_SCHEME_WITH_UNDERSCORES @@ -92,9 +93,10 @@ if(NEED_FORTRAN_NAME_MANGLING) set(FortranTest_DIR ${PROJECT_BINARY_DIR}/FortranTest) file(MAKE_DIRECTORY ${FortranTest_DIR}) - # Create a CMakeLists.txt file which will generate the "flib" library - # and an executable "ftest" - file(WRITE ${FortranTest_DIR}/CMakeLists.txt + # Create a CMakeLists.txt file which will generate the "flib" library and an + # executable "ftest" + file( + WRITE ${FortranTest_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ftest Fortran)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -109,36 +111,35 @@ if(NEED_FORTRAN_NAME_MANGLING) "ADD_EXECUTABLE(ftest ftest.f)\n" "TARGET_LINK_LIBRARIES(ftest flib)\n") - # Create the Fortran source flib.f which defines two subroutines, "mysub" and "my_sub" + # Create the Fortran source flib.f which defines two subroutines, "mysub" and + # "my_sub" file(WRITE ${FortranTest_DIR}/flib.f - " SUBROUTINE mysub\n" - " RETURN\n" - " END\n" - " SUBROUTINE my_sub\n" - " RETURN\n" - " END\n") + " SUBROUTINE mysub\n" " RETURN\n" " END\n" + " SUBROUTINE my_sub\n" " RETURN\n" " END\n") # Create the Fortran source ftest.f which calls "mysub" and "my_sub" file(WRITE ${FortranTest_DIR}/ftest.f - " PROGRAM ftest\n" - " CALL mysub()\n" - " CALL my_sub()\n" - " END\n") + " PROGRAM ftest\n" " CALL mysub()\n" + " CALL my_sub()\n" " END\n") # Use TRY_COMPILE to make the targets "flib" and "ftest" - try_compile(FTEST_OK ${FortranTest_DIR} ${FortranTest_DIR} - ftest OUTPUT_VARIABLE MY_OUTPUT) + try_compile( + FTEST_OK ${FortranTest_DIR} + ${FortranTest_DIR} ftest + OUTPUT_VARIABLE MY_OUTPUT) - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${FortranTest_DIR}/CMakeFiles) # Proceed based on test results if(FTEST_OK) # Infer Fortran name-mangling scheme for symbols WITHOUT underscores. - # Overwrite CMakeLists.txt with one which will generate the "ctest1" executable - file(WRITE ${FortranTest_DIR}/CMakeLists.txt + # Overwrite CMakeLists.txt with one which will generate the "ctest1" + # executable + file( + WRITE ${FortranTest_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ctest1 C)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -164,23 +165,25 @@ if(NEED_FORTRAN_NAME_MANGLING) while(${iopt} LESS ${imax}) # Get the current list entry (current scheme) list(GET options ${iopt} opt) - # Generate C source which calls the "mysub" function using the current scheme + # Generate C source which calls the "mysub" function using the current + # scheme file(WRITE ${FortranTest_DIR}/ctest1.c - "extern void ${opt}();\n" - "int main(void){${opt}();return(0);}\n") - # Use TRY_COMPILE to make the "ctest1" executable from the current C source - # and linking to the previously created "flib" library. - try_compile(CTEST_OK ${FortranTest_DIR} ${FortranTest_DIR} - ctest1 OUTPUT_VARIABLE MY_OUTPUT) + "extern void ${opt}();\n" "int main(void){${opt}();return(0);}\n") + # Use TRY_COMPILE to make the "ctest1" executable from the current C + # source and linking to the previously created "flib" library. + try_compile( + CTEST_OK ${FortranTest_DIR} + ${FortranTest_DIR} ctest1 + OUTPUT_VARIABLE MY_OUTPUT) # Write output compiling the test code file(WRITE ${FortranTest_DIR}/ctest1_${opt}.out "${MY_OUTPUT}") - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove + # the CMakeFiles directory. file(REMOVE_RECURSE ${FortranTest_DIR}/CMakeFiles) - # Test if we successfully created the "ctest" executable. - # If yes, save the current scheme, and set the counter "iopt" to "imax" - # so that we exit the while loop. - # Otherwise, increment the counter "iopt" and go back in the while loop. + # Test if we successfully created the "ctest" executable. If yes, save the + # current scheme, and set the counter "iopt" to "imax" so that we exit the + # while loop. Otherwise, increment the counter "iopt" and go back in the + # while loop. if(CTEST_OK) set(CMAKE_Fortran_SCHEME_NO_UNDERSCORES ${opt}) set(iopt ${imax}) @@ -191,7 +194,8 @@ if(NEED_FORTRAN_NAME_MANGLING) # Infer Fortran name-mangling scheme for symbols WITH underscores. # Practically a duplicate of the previous steps. - file(WRITE ${FortranTest_DIR}/CMakeLists.txt + file( + WRITE ${FortranTest_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ctest2 C)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -212,10 +216,11 @@ if(NEED_FORTRAN_NAME_MANGLING) while(${iopt} LESS ${imax}) list(GET options ${iopt} opt) file(WRITE ${FortranTest_DIR}/ctest2.c - "extern void ${opt}();\n" - "int main(void){${opt}();return(0);}\n") - try_compile(CTEST_OK ${FortranTest_DIR} ${FortranTest_DIR} - ctest2 OUTPUT_VARIABLE MY_OUTPUT) + "extern void ${opt}();\n" "int main(void){${opt}();return(0);}\n") + try_compile( + CTEST_OK ${FortranTest_DIR} + ${FortranTest_DIR} ctest2 + OUTPUT_VARIABLE MY_OUTPUT) file(WRITE ${FortranTest_DIR}/ctest2_${opt}.out "${MY_OUTPUT}") file(REMOVE_RECURSE ${FortranTest_DIR}/CMakeFiles) if(CTEST_OK) @@ -228,7 +233,8 @@ if(NEED_FORTRAN_NAME_MANGLING) # If a name-mangling scheme was found set the C preprocessor macros to use # that scheme. Otherwise default to lower case with one underscore. - if(CMAKE_Fortran_SCHEME_NO_UNDERSCORES AND CMAKE_Fortran_SCHEME_WITH_UNDERSCORES) + if(CMAKE_Fortran_SCHEME_NO_UNDERSCORES + AND CMAKE_Fortran_SCHEME_WITH_UNDERSCORES) message(STATUS "Determining Fortran name-mangling scheme... OK") else() message(STATUS "Determining Fortran name-mangling scheme... DEFAULT") @@ -241,19 +247,23 @@ if(NEED_FORTRAN_NAME_MANGLING) set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name") endif() if(${CMAKE_Fortran_SCHEME_NO_UNDERSCORES} MATCHES "mysub_") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## _") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## _") endif() if(${CMAKE_Fortran_SCHEME_NO_UNDERSCORES} MATCHES "mysub__") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## __") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) name ## __") endif() if(${CMAKE_Fortran_SCHEME_NO_UNDERSCORES} MATCHES "MYSUB") set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME") endif() if(${CMAKE_Fortran_SCHEME_NO_UNDERSCORES} MATCHES "MYSUB_") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## _") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## _") endif() if(${CMAKE_Fortran_SCHEME_NO_UNDERSCORES} MATCHES "MYSUB__") - set(LAPACK_MANGLE_MACRO1 "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## __") + set(LAPACK_MANGLE_MACRO1 + "#define SUNDIALS_LAPACK_FUNC(name,NAME) NAME ## __") endif() # Symbols WITH underscores @@ -261,28 +271,30 @@ if(NEED_FORTRAN_NAME_MANGLING) set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name") endif() if(${CMAKE_Fortran_SCHEME_WITH_UNDERSCORES} MATCHES "my_sub_") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## _") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## _") endif() if(${CMAKE_Fortran_SCHEME_WITH_UNDERSCORES} MATCHES "my_sub__") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## __") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) name ## __") endif() if(${CMAKE_Fortran_SCHEME_WITH_UNDERSCORES} MATCHES "MY_SUB") set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME") endif() if(${CMAKE_Fortran_SCHEME_WITH_UNDERSCORES} MATCHES "MY_SUB_") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## _") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## _") endif() if(${CMAKE_Fortran_SCHEME_WITH_UNDERSCORES} MATCHES "MY_SUB__") - set(LAPACK_MANGLE_MACRO2 "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## __") + set(LAPACK_MANGLE_MACRO2 + "#define SUNDIALS_LAPACK_FUNC_(name,NAME) NAME ## __") endif() # name-mangling scheme has been set set(NEED_FORTRAN_NAME_MANGLING FALSE) - configure_file( - ${PROJECT_SOURCE_DIR}/src/sundials/sundials_lapack_defs.h.in - ${PROJECT_BINARY_DIR}/src/sundials/sundials_lapack_defs.h - ) + configure_file(${PROJECT_SOURCE_DIR}/src/sundials/sundials_lapack_defs.h.in + ${PROJECT_BINARY_DIR}/src/sundials/sundials_lapack_defs.h) else(FTEST_OK) message(STATUS "Determining Fortran name-mangling scheme... FAILED") @@ -297,7 +309,8 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS)) file(MAKE_DIRECTORY ${LapackTest_DIR}) # Create a CMakeLists.txt file - file(WRITE ${LapackTest_DIR}/CMakeLists.txt + file( + WRITE ${LapackTest_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ltest C)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -312,8 +325,10 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS)) "ADD_EXECUTABLE(ltest ltest.c)\n" "TARGET_LINK_LIBRARIES(ltest ${LAPACK_LIBRARIES})\n") - # Create a C source file which calls a Blas function (dcopy) and an Lapack function (dgetrf) - file(WRITE ${LapackTest_DIR}/ltest.c + # Create a C source file which calls a Blas function (dcopy) and an Lapack + # function (dgetrf) + file( + WRITE ${LapackTest_DIR}/ltest.c "${LAPACK_MANGLE_MACRO1}\n" "#define dcopy_f77 SUNDIALS_LAPACK_FUNC(dcopy, DCOPY)\n" "#define dgetrf_f77 SUNDIALS_LAPACK_FUNC(dgetrf, DGETRF)\n" @@ -329,20 +344,25 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS)) "}\n") # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${LapackTest_DIR} ${LapackTest_DIR} - ltest OUTPUT_VARIABLE COMPILE_OUTPUT) + try_compile( + COMPILE_OK ${LapackTest_DIR} + ${LapackTest_DIR} ltest + OUTPUT_VARIABLE COMPILE_OUTPUT) - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${LapackTest_DIR}/CMakeFiles) # Process test result if(COMPILE_OK) message(STATUS "Checking if LAPACK works with SUNDIALS... OK") - set(LAPACK_WORKS TRUE CACHE BOOL "LAPACK works with SUNDIALS as configured" FORCE) + set(LAPACK_WORKS + TRUE + CACHE BOOL "LAPACK works with SUNDIALS as configured" FORCE) # get path to LAPACK library to use in generated makefiles for examples, if - # LAPACK_LIBRARIES contains multiple items only use the path of the first entry + # LAPACK_LIBRARIES contains multiple items only use the path of the first + # entry list(LENGTH LAPACK_LIBRARIES len) if(len EQUAL 1) get_filename_component(LAPACK_LIBRARY_DIR ${LAPACK_LIBRARIES} PATH) @@ -351,7 +371,9 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS)) get_filename_component(LAPACK_LIBRARY_DIR ${TMP_LAPACK_LIBRARIES} PATH) endif() else(COMPILE_OK) - set(LAPACK_WORKS FALSE CACHE BOOL "LAPACK does not work with SUNDIALS as configured" FORCE) + set(LAPACK_WORKS + FALSE + CACHE BOOL "LAPACK does not work with SUNDIALS as configured" FORCE) message(STATUS "Checking if LAPACK works with SUNDIALS... FAILED") message(STATUS "Check output: ") message("${COMPILE_OUTPUT}") @@ -359,5 +381,8 @@ if(LAPACK_LIBRARIES AND (NOT LAPACK_WORKS)) endif() elseif(LAPACK_LIBRARIES AND LAPACK_WORKS) - message(STATUS "Skipped LAPACK tests, assuming LAPACK works with SUNDIALS. Set LAPACK_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped LAPACK tests, assuming LAPACK works with SUNDIALS. Set LAPACK_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsMAGMA.cmake b/cmake/tpl/SundialsMAGMA.cmake index 6b11a92b8d..6fb0284713 100644 --- a/cmake/tpl/SundialsMAGMA.cmake +++ b/cmake/tpl/SundialsMAGMA.cmake @@ -37,7 +37,9 @@ endif() # ----------------------------------------------------------------------------- if(SUNDIALS_PRECISION MATCHES "extended") - message(FATAL_ERROR "SUNDIALS MAGMA interface is not compatible with extended precision") + message( + FATAL_ERROR + "SUNDIALS MAGMA interface is not compatible with extended precision") endif() # ----------------------------------------------------------------------------- @@ -57,13 +59,21 @@ message(STATUS "SUNDIALS_MAGMA_BACKENDS: ${SUNDIALS_MAGMA_BACKENDS}") if(MAGMA_FOUND AND (NOT MAGMA_WORKS)) if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA" AND NOT ENABLE_CUDA) - message(FATAL_ERROR "SUNDIALS_MAGMA_BACKENDS includes CUDA but CUDA is not enabled. Set ENABLE_CUDA=ON or change the backend.") + message( + FATAL_ERROR + "SUNDIALS_MAGMA_BACKENDS includes CUDA but CUDA is not enabled. Set ENABLE_CUDA=ON or change the backend." + ) endif() if(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP" AND NOT ENABLE_HIP) - message(FATAL_ERROR "SUNDIALS_MAGMA_BACKENDS includes HIP but HIP is not enabled. Set ENABLE_HIP=ON or change the backend.") + message( + FATAL_ERROR + "SUNDIALS_MAGMA_BACKENDS includes HIP but HIP is not enabled. Set ENABLE_HIP=ON or change the backend." + ) endif() - set(MAGMA_WORKS TRUE CACHE BOOL "MAGMA works with SUNDIALS as configured" FORCE) + set(MAGMA_WORKS + TRUE + CACHE BOOL "MAGMA works with SUNDIALS as configured" FORCE) elseif(MAGMA_FOUND AND MAGMA_WORKS) message(STATUS "Skipped MAGMA tests, assuming MAGMA works with SUNDIALS.") endif() diff --git a/cmake/tpl/SundialsMPI.cmake b/cmake/tpl/SundialsMPI.cmake index 63beb052c3..1905c66d5d 100644 --- a/cmake/tpl/SundialsMPI.cmake +++ b/cmake/tpl/SundialsMPI.cmake @@ -13,15 +13,11 @@ # --------------------------------------------------------------------------- # Setup MPI for SUNDIALS CMake-based configuration. # --------------------------------------------------------------------------- -# Prior to CMake 3.10 the CMake FindMPI module considers: -# 1. Inspect MPI wrappers (MPI__COMPILER) -# 2. Try guesses -# 3. Try the compiler (CMAKE__COMPILER) -# # Starting with CMake 3.10 the CMake FindMPI module considers: -# 1. Try the compiler (CMAKE__COMPILER) -# 2. Inspect MPI wrappers (MPI__COMPILER) -# 3. Try guesses +# +# 1. Try the compiler (CMAKE__COMPILER) +# 2. Inspect MPI wrappers (MPI__COMPILER) +# 3. Try guesses # --------------------------------------------------------------------------- # ----------------------------------------------------------------------------- @@ -35,25 +31,22 @@ else() endif() # --------------------------------------------------------------------------- -# If MPI__COMPILER is set, FindMPI will try to set the below variables -# for the given compiler wrapper. If MPI__COMPILER is unset FindMPI -# will attempt to locate an installed MPI library and set the below -# variables. -# -# MPI__FOUND TRUE if FindMPI found MPI flags for -# MPI__COMPILER MPI Compiler wrapper for -# MPI__COMPILE_FLAGS Compilation flags for MPI programs -# MPI__INCLUDE_PATH Include path(s) for MPI header -# MPI__LINK_FLAGS Linking flags for MPI programs -# MPI__LIBRARIES All libraries to link MPI programs against +# If MPI__COMPILER is set, FindMPI will try to set the below variables for +# the given compiler wrapper. If MPI__COMPILER is unset FindMPI will +# attempt to locate an installed MPI library and set the below variables. # -# MPIEXEC_EXECUTABLE Executable for running MPI programs -# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC_EXECUTABLE before -# giving it the number of processors to run on -# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC_EXECUTABLE directly -# before the executable to run. -# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC_EXECUTABLE after -# other flags +# * MPI__FOUND -- TRUE if FindMPI found MPI flags for +# * MPI__COMPILER -- MPI Compiler wrapper for +# * MPI__COMPILE_FLAGS -- Compilation flags for MPI programs +# * MPI__INCLUDE_PATH -- Include path(s) for MPI header +# * MPI__LINK_FLAGS -- Linking flags for MPI programs +# * MPI__LIBRARIES -- All libraries to link MPI programs against +# * MPIEXEC_EXECUTABLE -- Executable for running MPI programs +# * MPIEXEC_NUMPROC_FLAG -- Flag to pass to MPIEXEC_EXECUTABLE before giving it +# the number of processors to run on +# * MPIEXEC_PREFLAGS -- Flags to pass to MPIEXEC_EXECUTABLE directly before the +# executable to run. +# * MPIEXEC_POSTFLAGS -- Flags to pass to MPIEXEC_EXECUTABLE after other flags # --------------------------------------------------------------------------- mark_as_advanced(MPI_EXTRA_LIBRARY) diff --git a/cmake/tpl/SundialsONEMKL.cmake b/cmake/tpl/SundialsONEMKL.cmake index 693474e523..8fe11a2207 100644 --- a/cmake/tpl/SundialsONEMKL.cmake +++ b/cmake/tpl/SundialsONEMKL.cmake @@ -38,14 +38,15 @@ endif() # oneMKL does not support extended precision if(SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR - "oneMKL is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR "oneMKL is not compatible with ${SUNDIALS_PRECISION} precision") endif() # oneMKL does not support 32-bit index sizes if(SUNDIALS_INDEX_SIZE MATCHES "32") - message(FATAL_ERROR - "oneMKL is not compatible with ${SUNDIALS_INDEX_SIZE}-bit indices") + message( + FATAL_ERROR + "oneMKL is not compatible with ${SUNDIALS_INDEX_SIZE}-bit indices") endif() # ----------------------------------------------------------------------------- @@ -59,10 +60,14 @@ if(ENABLE_SYCL) endif() # Look for CMake configuration file in oneMKL installation -find_package(MKL CONFIG - PATHS "${ONEMKL_DIR}" "${ONEMKL_DIR}/lib/cmake/mkl" - NO_DEFAULT_PATH - REQUIRED) +find_package( + MKL + CONFIG + PATHS + "${ONEMKL_DIR}" + "${ONEMKL_DIR}/lib/cmake/mkl" + NO_DEFAULT_PATH + REQUIRED) message(STATUS "MKL Version: ${MKL_VERSION}") message(STATUS "MKL Targets: ${MKL_IMPORTED_TARGETS}") @@ -73,7 +78,9 @@ message(STATUS "MKL Targets: ${MKL_IMPORTED_TARGETS}") if(MKL_FOUND AND (NOT ONEMKL_WORKS)) message(STATUS "Checking if oneMKL works... OK") - set(ONEMKL_WORKS TRUE CACHE BOOL "oneMKL works with SUNDIALS as configured" FORCE) + set(ONEMKL_WORKS + TRUE + CACHE BOOL "oneMKL works with SUNDIALS as configured" FORCE) else() message(STATUS "Skipped oneMKL tests, assuming oneMKL works with SUNDIALS.") endif() diff --git a/cmake/tpl/SundialsOpenMP.cmake b/cmake/tpl/SundialsOpenMP.cmake index d845a27888..e59b47b670 100644 --- a/cmake/tpl/SundialsOpenMP.cmake +++ b/cmake/tpl/SundialsOpenMP.cmake @@ -54,37 +54,52 @@ find_package(OpenMP REQUIRED) # ----------------------------------------------------------------------------- # Work around a bug in setting OpenMP version variables in CMake >= 3.9. The -# OpenMP version information is not stored in cache variables and is not set -# on repeated calls to find OpenMP (i.e., when using ccmake). To ensure these +# OpenMP version information is not stored in cache variables and is not set on +# repeated calls to find OpenMP (i.e., when using ccmake). To ensure these # variables exist store copies of the values. -set(OpenMP_C_VERSION "${OpenMP_C_VERSION}" CACHE INTERNAL "" FORCE) -set(OpenMP_CXX_VERSION "${OpenMP_CXX_VERSION}" CACHE INTERNAL "" FORCE) -set(OpenMP_Fortran_VERSION "${OpenMP_Fortran_VERSION}" CACHE INTERNAL "" FORCE) +set(OpenMP_C_VERSION + "${OpenMP_C_VERSION}" + CACHE INTERNAL "" FORCE) +set(OpenMP_CXX_VERSION + "${OpenMP_CXX_VERSION}" + CACHE INTERNAL "" FORCE) +set(OpenMP_Fortran_VERSION + "${OpenMP_Fortran_VERSION}" + CACHE INTERNAL "" FORCE) # Check for OpenMP offloading support if(OPENMP_FOUND AND (ENABLE_OPENMP_DEVICE OR SUPERLUDIST_OpenMP)) if(OPENMP_DEVICE_WORKS) - # The user has asked for checks to be skipped, assume offloading is supported + # The user has asked for checks to be skipped, assume offloading is + # supported set(OPENMP45_FOUND TRUE) set(OPENMP_SUPPORTS_DEVICE_OFFLOADING TRUE) - message(WARNING "Skipping OpenMP device/version check." "SUNDIALS OpenMP functionality dependent on OpenMP 4.5+ is not guaranteed.") + message( + WARNING + "Skipping OpenMP device/version check." + "SUNDIALS OpenMP functionality dependent on OpenMP 4.5+ is not guaranteed." + ) else() # Check the OpenMP version message(STATUS "Checking whether OpenMP supports device offloading") - if((OpenMP_C_VERSION VERSION_EQUAL 4.5) OR (OpenMP_C_VERSION VERSION_GREATER 4.5)) - message(STATUS "Checking whether OpenMP supports device offloading -- yes") + if((OpenMP_C_VERSION VERSION_EQUAL 4.5) OR (OpenMP_C_VERSION VERSION_GREATER + 4.5)) + message( + STATUS "Checking whether OpenMP supports device offloading -- yes") set(OPENMP45_FOUND TRUE) set(OPENMP_SUPPORTS_DEVICE_OFFLOADING TRUE) else() message(STATUS "Checking whether OpenMP supports device offloading -- no") set(OPENMP45_FOUND FALSE) set(OPENMP_SUPPORTS_DEVICE_OFFLOADING FALSE) - message(FATAL_ERROR "The found OpenMP version does not support device offloading.") + message( + FATAL_ERROR + "The found OpenMP version does not support device offloading.") endif() endif() diff --git a/cmake/tpl/SundialsPETSC.cmake b/cmake/tpl/SundialsPETSC.cmake index dddcf47180..e31b46c397 100644 --- a/cmake/tpl/SundialsPETSC.cmake +++ b/cmake/tpl/SundialsPETSC.cmake @@ -38,11 +38,15 @@ endif() # Using PETSc requires building with MPI enabled if(ENABLE_PETSC AND NOT ENABLE_MPI) - message(FATAL_ERROR "MPI is required for PETSc support. Set ENABLE_MPI to ON.") + message( + FATAL_ERROR "MPI is required for PETSc support. Set ENABLE_MPI to ON.") endif() if(SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR "SUNDIALS is not compatible with PETSc when using ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR + "SUNDIALS is not compatible with PETSc when using ${SUNDIALS_PRECISION} precision" + ) endif() # ----------------------------------------------------------------------------- @@ -63,30 +67,37 @@ message(STATUS "PETSC_PRECISION: ${PETSC_PRECISION}") # ----------------------------------------------------------------------------- if(PETSC_FOUND AND (NOT PETSC_WORKS)) - # No need for any compile tests because the FindPETSC module - # does compile tests already. + # No need for any compile tests because the FindPETSC module does compile + # tests already. if(NOT ("${SUNDIALS_INDEX_SIZE}" MATCHES "${PETSC_INDEX_SIZE}")) - string(CONCAT _err_msg_string - "PETSc not functional due to index size mismatch:\n" - "SUNDIALS_INDEX_SIZE=${SUNDIALS_INDEX_SIZE}, " - "but PETSc was built with ${PETSC_INDEX_SIZE}-bit indices\n" - "PETSC_DIR: ${PETSC_DIR}\n") + string( + CONCAT _err_msg_string + "PETSc not functional due to index size mismatch:\n" + "SUNDIALS_INDEX_SIZE=${SUNDIALS_INDEX_SIZE}, " + "but PETSc was built with ${PETSC_INDEX_SIZE}-bit indices\n" + "PETSC_DIR: ${PETSC_DIR}\n") message(FATAL_ERROR "${_err_msg_string}") endif() string(TOUPPER "${PETSC_PRECISION}" _petsc_precision) string(TOUPPER "${SUNDIALS_PRECISION}" _sundials_precision) if(NOT ("${_sundials_precision}" MATCHES "${_petsc_precision}")) - string(CONCAT _err_msg_string - "PETSc not functional due to real type precision mismatch:\n" - "SUNDIALS_PRECISION=${_sundials_precision}, " - "but PETSc was built with ${_petsc_precision} precision\n" - "PETSC_DIR: ${PETSC_DIR}\n") + string( + CONCAT _err_msg_string + "PETSc not functional due to real type precision mismatch:\n" + "SUNDIALS_PRECISION=${_sundials_precision}, " + "but PETSc was built with ${_petsc_precision} precision\n" + "PETSC_DIR: ${PETSC_DIR}\n") message(FATAL_ERROR "${_err_msg_string}") endif() - set(PETSC_WORKS TRUE CACHE BOOL "PETSC works with SUNDIALS as configured" FORCE) + set(PETSC_WORKS + TRUE + CACHE BOOL "PETSC works with SUNDIALS as configured" FORCE) elseif(PETSC_FOUND AND PETSC_WORKS) - message(STATUS "Skipped PETSC tests, assuming PETSC works with SUNDIALS. Set PETSC_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped PETSC tests, assuming PETSC works with SUNDIALS. Set PETSC_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsPOSIXTimers.cmake b/cmake/tpl/SundialsPOSIXTimers.cmake index 4670849ac5..edf9e4cf29 100644 --- a/cmake/tpl/SundialsPOSIXTimers.cmake +++ b/cmake/tpl/SundialsPOSIXTimers.cmake @@ -17,20 +17,21 @@ macro(posix_timers_test) - set(options ) + set(options) set(oneValueArgs POSIX RT_LIB) - set(multiValueArgs ) + set(multiValueArgs) # parse keyword arguments/options - cmake_parse_arguments(posix_timers_test - "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(posix_timers_test "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) # Test timers with a simple program set(POSIX_TIMER_TEST_DIR ${PROJECT_BINARY_DIR}/POSIX_TIMER_TEST) file(MAKE_DIRECTORY ${POSIX_TIMER_TEST_DIR}) # Create a CMakeLists.txt file which will generate the test executable - file(WRITE ${POSIX_TIMER_TEST_DIR}/CMakeLists.txt + file( + WRITE ${POSIX_TIMER_TEST_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ltest C)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -48,7 +49,8 @@ macro(posix_timers_test) "TARGET_LINK_LIBRARIES(ltest \"${posix_timers_test_RT_LIB}\")\n") # Create a simple C source for testing - file(WRITE ${POSIX_TIMER_TEST_DIR}/ltest.c + file( + WRITE ${POSIX_TIMER_TEST_DIR}/ltest.c "#include \n" "#include \n" "int main(void) {\n" @@ -58,18 +60,19 @@ macro(posix_timers_test) "return(0);\n" "}\n") - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${POSIX_TIMER_TEST_DIR}/CMakeFiles) # Use TRY_COMPILE to make the target - try_compile(COMPILE_OK ${POSIX_TIMER_TEST_DIR} ${POSIX_TIMER_TEST_DIR} ltest + try_compile( + COMPILE_OK ${POSIX_TIMER_TEST_DIR} + ${POSIX_TIMER_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) endmacro() - -if (NOT SUNDIALS_POSIX_TIMERS) +if(NOT SUNDIALS_POSIX_TIMERS) # Test for timers without any modifications posix_timers_test() @@ -81,7 +84,8 @@ if (NOT SUNDIALS_POSIX_TIMERS) if(NOT COMPILE_OK) posix_timers_test(POSIX "_POSIX_C_SOURCE=200112L") if(COMPILE_OK) - message(STATUS "Looking for POSIX timers (setting _POSIX_C_SOURCE)... found") + message( + STATUS "Looking for POSIX timers (setting _POSIX_C_SOURCE)... found") set(POSIX_TIMERS_NEED_POSIX_C_SOURCE TRUE) endif() endif() @@ -109,9 +113,13 @@ if (NOT SUNDIALS_POSIX_TIMERS) # Test failed, try again linking to rt and with -D_POSIX_C_SOURCE=200112L if((NOT COMPILE_OK) AND SUNDIALS_RT_LIBRARY) - posix_timers_test(POSIX "_POSIX_C_SOURCE=200112L" RT_LIB "${SUNDIALS_RT_LIBRARY}") + posix_timers_test(POSIX "_POSIX_C_SOURCE=200112L" RT_LIB + "${SUNDIALS_RT_LIBRARY}") if(COMPILE_OK) - message(STATUS "Looking for POSIX timers (setting _POSIX_C_SOURCE and linking to rt)... found") + message( + STATUS + "Looking for POSIX timers (setting _POSIX_C_SOURCE and linking to rt)... found" + ) set(POSIX_TIMERS_NEED_POSIX_C_SOURCE TRUE) set(POSIX_TIMERS_NEED_RT_LIBRARY TRUE) set(EXE_EXTRA_LINK_LIBS ${EXE_EXTRA_LINK_LIBS} ${SUNDIALS_RT_LIBRARY}) diff --git a/cmake/tpl/SundialsRAJA.cmake b/cmake/tpl/SundialsRAJA.cmake index 1084eb9f6f..64404801b0 100644 --- a/cmake/tpl/SundialsRAJA.cmake +++ b/cmake/tpl/SundialsRAJA.cmake @@ -53,27 +53,36 @@ endif() # ----------------------------------------------------------------------------- # find the library configuration file -find_file(RAJA_CONFIGHPP_PATH config.hpp - HINTS "${RAJA_DIR}" - PATH_SUFFIXES include include/RAJA - NO_DEFAULT_PATH) +find_file( + RAJA_CONFIGHPP_PATH config.hpp + HINTS "${RAJA_DIR}" + PATH_SUFFIXES include include/RAJA + NO_DEFAULT_PATH) mark_as_advanced(FORCE RAJA_CONFIGHPP_PATH) # Look for CMake configuration file in RAJA installation -find_package(RAJA CONFIG - PATHS "${RAJA_DIR}" "${RAJA_DIR}/share/raja/cmake" - NO_DEFAULT_PATH - REQUIRED) +find_package( + RAJA + CONFIG + PATHS + "${RAJA_DIR}" + "${RAJA_DIR}/share/raja/cmake" + NO_DEFAULT_PATH + REQUIRED) # determine the backends foreach(_backend CUDA HIP OPENMP TARGET_OPENMP SYCL) - file(STRINGS "${RAJA_CONFIGHPP_PATH}" _raja_has_backend REGEX "^#define RAJA_ENABLE_${_backend}\$") + file(STRINGS "${RAJA_CONFIGHPP_PATH}" _raja_has_backend + REGEX "^#define RAJA_ENABLE_${_backend}\$") if(_raja_has_backend) set(RAJA_BACKENDS "${_backend};${RAJA_BACKENDS}") endif() endforeach() -message(STATUS "RAJA Version: ${RAJA_VERSION_MAJOR}.${RAJA_VERSION_MINOR}.${RAJA_VERSION_PATCHLEVEL}") +message( + STATUS + "RAJA Version: ${RAJA_VERSION_MAJOR}.${RAJA_VERSION_MINOR}.${RAJA_VERSION_PATCHLEVEL}" +) message(STATUS "RAJA Backends: ${RAJA_BACKENDS}") set(RAJA_NEEDS_THREADS OFF) @@ -82,9 +91,9 @@ if("${RAJA_BACKENDS}" MATCHES "CUDA") if(NOT TARGET Threads::Threads) find_package(Threads) endif() - # The RAJA target links to camp which links to a target 'cuda_runtime' - # which is normally provided by BLT. Since we do not use BLT, we instead - # create the target here and tell it to link to CUDA::cudart. + # The RAJA target links to camp which links to a target 'cuda_runtime' which + # is normally provided by BLT. Since we do not use BLT, we instead create the + # target here and tell it to link to CUDA::cudart. if(NOT TARGET cuda_runtime) add_library(cuda_runtime INTERFACE IMPORTED) target_link_libraries(cuda_runtime INTERFACE CUDA::cudart) @@ -94,25 +103,39 @@ endif() # Section 4: Test the TPL # ----------------------------------------------------------------------------- -if((SUNDIALS_RAJA_BACKENDS MATCHES "CUDA") AND - (NOT RAJA_BACKENDS MATCHES "CUDA")) - message(FATAL_ERROR "Requested that SUNDIALS uses the CUDA RAJA backend, but RAJA was not built with the CUDA backend.") +if((SUNDIALS_RAJA_BACKENDS MATCHES "CUDA") AND (NOT RAJA_BACKENDS MATCHES "CUDA" + )) + message( + FATAL_ERROR + "Requested that SUNDIALS uses the CUDA RAJA backend, but RAJA was not built with the CUDA backend." + ) endif() -if((SUNDIALS_RAJA_BACKENDS MATCHES "HIP") AND - (NOT RAJA_BACKENDS MATCHES "HIP")) - message(FATAL_ERROR "Requested that SUNDIALS uses the HIP RAJA backend, but RAJA was not built with the HIP backend.") +if((SUNDIALS_RAJA_BACKENDS MATCHES "HIP") AND (NOT RAJA_BACKENDS MATCHES "HIP")) + message( + FATAL_ERROR + "Requested that SUNDIALS uses the HIP RAJA backend, but RAJA was not built with the HIP backend." + ) endif() if(NOT ENABLE_OPENMP AND RAJA_BACKENDS MATCHES "OPENMP") - message(FATAL_ERROR "RAJA was built with OpenMP, but OpenMP is not enabled. Set ENABLE_OPENMP to ON.") + message( + FATAL_ERROR + "RAJA was built with OpenMP, but OpenMP is not enabled. Set ENABLE_OPENMP to ON." + ) endif() if(NOT ENABLE_OPENMP_DEVICE AND RAJA_BACKENDS MATCHES "TARGET_OPENMP") - message(FATAL_ERROR "RAJA was built with OpenMP device offloading, but OpenMP with device offloading is not enabled. Set ENABLE_OPENMP_DEVICE to ON.") + message( + FATAL_ERROR + "RAJA was built with OpenMP device offloading, but OpenMP with device offloading is not enabled. Set ENABLE_OPENMP_DEVICE to ON." + ) endif() -if((SUNDIALS_RAJA_BACKENDS MATCHES "SYCL") AND - (NOT RAJA_BACKENDS MATCHES "SYCL")) - message(FATAL_ERROR "Requested that SUNDIALS uses the SYCL RAJA backend, but RAJA was not built with the SYCL backend.") +if((SUNDIALS_RAJA_BACKENDS MATCHES "SYCL") AND (NOT RAJA_BACKENDS MATCHES "SYCL" + )) + message( + FATAL_ERROR + "Requested that SUNDIALS uses the SYCL RAJA backend, but RAJA was not built with the SYCL backend." + ) endif() diff --git a/cmake/tpl/SundialsSuperLUDIST.cmake b/cmake/tpl/SundialsSuperLUDIST.cmake index 2dfc84a565..cd5d63421f 100644 --- a/cmake/tpl/SundialsSuperLUDIST.cmake +++ b/cmake/tpl/SundialsSuperLUDIST.cmake @@ -38,17 +38,25 @@ endif() # SuperLU_DIST only supports double precision if(SUNDIALS_PRECISION MATCHES "SINGLE" OR SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR "SuperLU_DIST is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR + "SuperLU_DIST is not compatible with ${SUNDIALS_PRECISION} precision") endif() # Using SUPERLUDIST requires building with MPI enabled if(ENABLE_SUPERLUDIST AND NOT ENABLE_MPI) - message(FATAL_ERROR "MPI is required for SuperLU DIST support. Set ENABLE_MPI to ON.") + message( + FATAL_ERROR + "MPI is required for SuperLU DIST support. Set ENABLE_MPI to ON.") endif() # Using SUPERLUDIST with OpenMP requires building with OpenMP enabled -if(ENABLE_SUPERLUDIST AND SUPERLUDIST_OpenMP AND NOT ENABLE_OPENMP) - message(FATAL_ERROR "OpenMP is required for SuperLU DIST support. Set ENABLE_OPENMP to ON.") +if(ENABLE_SUPERLUDIST + AND SUPERLUDIST_OpenMP + AND NOT ENABLE_OPENMP) + message( + FATAL_ERROR + "OpenMP is required for SuperLU DIST support. Set ENABLE_OPENMP to ON.") endif() # ----------------------------------------------------------------------------- @@ -77,25 +85,41 @@ message(STATUS "SUPERLUDIST_ROCM: ${SUPERLUDIST_ROCM}") if(SUPERLUDIST_FOUND AND (NOT SUPERLUDIST_WORKS)) if(SUPERLUDIST_CUDA AND (NOT ENABLE_CUDA)) - message(FATAL_ERROR "SuperLU_DIST was built with CUDA but SUNDIALS does not have CUDA enabled. Set ENABLE_CUDA=TRUE.") + message( + FATAL_ERROR + "SuperLU_DIST was built with CUDA but SUNDIALS does not have CUDA enabled. Set ENABLE_CUDA=TRUE." + ) endif() if(SUPERLUDIST_HIP AND (NOT ENABLE_HIP)) - message(FATAL_ERROR "SuperLU_DIST was built with HIP but SUNDIALS does not have HIP enabled. Set ENABLE_HIP=TRUE.") + message( + FATAL_ERROR + "SuperLU_DIST was built with HIP but SUNDIALS does not have HIP enabled. Set ENABLE_HIP=TRUE." + ) endif() # Check index size if(NOT (SUNDIALS_INDEX_SIZE STREQUAL SUPERLUDIST_INDEX_SIZE)) - set(_err_msg_string "SuperLU_DIST not functional due to index size mismatch:\n") - string(APPEND _err_msg_string "SUNDIALS_INDEX_SIZE=${SUNDIALS_INDEX_SIZE}, but SuperLU_DIST was built with ${SUPERLUDIST_INDEX_SIZE}-bit indices\n") - string(APPEND _err_msg_string "SUPERLUDIST_INCLUDE_DIRS: ${SUPERLUDIST_INCLUDE_DIRS}\n") + set(_err_msg_string + "SuperLU_DIST not functional due to index size mismatch:\n") + string( + APPEND + _err_msg_string + "SUNDIALS_INDEX_SIZE=${SUNDIALS_INDEX_SIZE}, but SuperLU_DIST was built with ${SUPERLUDIST_INDEX_SIZE}-bit indices\n" + ) + string(APPEND _err_msg_string + "SUPERLUDIST_INCLUDE_DIRS: ${SUPERLUDIST_INCLUDE_DIRS}\n") message(FATAL_ERROR "${_err_msg_string}") endif() - message(STATUS "Checking if SuperLU_DIST works with SUNDIALS... OK") - set(SUPERLUDIST_WORKS TRUE CACHE BOOL "SuperLU_DIST works with SUNDIALS as configured" FORCE) + set(SUPERLUDIST_WORKS + TRUE + CACHE BOOL "SuperLU_DIST works with SUNDIALS as configured" FORCE) elseif(SUPERLUDIST_FOUND AND SUPERLUDIST_WORKS) - message(STATUS "Skipped SuperLU_DIST tests, assuming SuperLU_DIST works with SUNDIALS. Set SUPERLUDIST_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped SuperLU_DIST tests, assuming SuperLU_DIST works with SUNDIALS. Set SUPERLUDIST_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsSuperLUMT.cmake b/cmake/tpl/SundialsSuperLUMT.cmake index a7b6bf863a..a6c62d8649 100644 --- a/cmake/tpl/SundialsSuperLUMT.cmake +++ b/cmake/tpl/SundialsSuperLUMT.cmake @@ -38,7 +38,9 @@ endif() # SUPERLUMT does not support extended precision if(SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR "SUPERLUMT is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR + "SUPERLUMT is not compatible with ${SUNDIALS_PRECISION} precision") endif() # ----------------------------------------------------------------------------- @@ -61,7 +63,8 @@ if(SUPERLUMT_FOUND AND (NOT SUPERLUMT_WORKS)) file(MAKE_DIRECTORY ${SUPERLUMT_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${SUPERLUMT_TEST_DIR}/CMakeLists.txt + file( + WRITE ${SUPERLUMT_TEST_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ltest C)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -78,7 +81,8 @@ if(SUPERLUMT_FOUND AND (NOT SUPERLUMT_WORKS)) "TARGET_LINK_LIBRARIES(ltest ${SUPERLUMT_LIBRARIES})\n") # Create a C source file which calls a SUPERLUMT function - file(WRITE ${SUPERLUMT_TEST_DIR}/ltest.c + file( + WRITE ${SUPERLUMT_TEST_DIR}/ltest.c "\#include \"slu_mt_ddefs.h\"\n" "int main(void) {\n" "SuperMatrix *A;\n" @@ -89,19 +93,22 @@ if(SUPERLUMT_FOUND AND (NOT SUPERLUMT_WORKS)) "else return(0);\n" "}\n") - # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${SUPERLUMT_TEST_DIR} ${SUPERLUMT_TEST_DIR} ltest + try_compile( + COMPILE_OK ${SUPERLUMT_TEST_DIR} + ${SUPERLUMT_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${SUPERLUMT_TEST_DIR}/CMakeFiles) - # Process test result + # Process test result if(COMPILE_OK) message(STATUS "Checking if SuperLU_MT works with SUNDIALS... OK") - set(SUPERLUMT_WORKS TRUE CACHE BOOL "SuperLU_MT works with SUNDIALS as configured" FORCE) + set(SUPERLUMT_WORKS + TRUE + CACHE BOOL "SuperLU_MT works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if SuperLU_MT works with SUNDIALS... FAILED") message(STATUS "Check output: ") @@ -110,5 +117,8 @@ if(SUPERLUMT_FOUND AND (NOT SUPERLUMT_WORKS)) endif() elseif(SUPERLUMT_FOUND AND SUPERLUMT_WORKS) - message(STATUS "Skipped SuperLU_MT tests, assuming SuperLU_MT works with SUNDIALS. Set SUPERLUMT_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped SuperLU_MT tests, assuming SuperLU_MT works with SUNDIALS. Set SUPERLUMT_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsTrilinos.cmake b/cmake/tpl/SundialsTrilinos.cmake index 849eef6319..7f8940ef90 100644 --- a/cmake/tpl/SundialsTrilinos.cmake +++ b/cmake/tpl/SundialsTrilinos.cmake @@ -43,9 +43,8 @@ endif() # Find Trilinos find_package(Trilinos REQUIRED) -# Check if Trilinos was built with MPI -# Starting with TriBITS 2022-10-16 is no longer defined so we -# base MPI support on ENABLE_MPI +# Check if Trilinos was built with MPI Starting with TriBITS 2022-10-16 +# is no longer defined so we base MPI support on ENABLE_MPI if(Trilinos_TPL_LIST) if(";${Trilinos_TPL_LIST};" MATCHES ";MPI;") set(Trilinos_MPI TRUE) @@ -60,37 +59,66 @@ else() endif() endif() -# For XSDK compatibility, only use the user/spack provided compiler and flags to build -# SUNDIALS modules that use Trilinos. If we are not in XSDK mode, we can use the imported -# Trilinos compiler and flags by default, but allow the user to change it through CMake -# the Trilinos_INTERFACE_* options. +# For XSDK compatibility, only use the user/spack provided compiler and flags to +# build SUNDIALS modules that use Trilinos. If we are not in XSDK mode, we can +# use the imported Trilinos compiler and flags by default, but allow the user to +# change it through CMake the Trilinos_INTERFACE_* options. if(USE_XSDK_DEFAULTS) if(Trilinos_MPI AND MPI_CXX_FOUND) - force_variable(Trilinos_INTERFACE_CXX_COMPILER STRING "C++ compiler for Trilinos interface" "${MPI_CXX_COMPILER}") - set(Trilinos_INTERFACE_MPI_CXX_FOUND ${Trilinos_MPI} CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") + force_variable(Trilinos_INTERFACE_CXX_COMPILER STRING + "C++ compiler for Trilinos interface" "${MPI_CXX_COMPILER}") + set(Trilinos_INTERFACE_MPI_CXX_FOUND + ${Trilinos_MPI} + CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") else() - force_variable(Trilinos_INTERFACE_CXX_COMPILER STRING "C compiler for Trilinos interface" "${CMAKE_CXX_COMPILER}") - set(Trilinos_INTERFACE_MPI_CXX_FOUND FALSE CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") + force_variable(Trilinos_INTERFACE_CXX_COMPILER STRING + "C compiler for Trilinos interface" "${CMAKE_CXX_COMPILER}") + set(Trilinos_INTERFACE_MPI_CXX_FOUND + FALSE + CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") endif() if(Trilinos_MPI AND MPI_C_FOUND) - force_variable(Trilinos_INTERFACE_C_COMPILER STRING "C compiler for Trilinos interface" "${MPI_C_COMPILER}") - set(Trilinos_INTERFACE_MPI_C_FOUND ${Trilinos_MPI} CACHE INTERNAL "Is Trilinos interface C compiler MPI") + force_variable(Trilinos_INTERFACE_C_COMPILER STRING + "C compiler for Trilinos interface" "${MPI_C_COMPILER}") + set(Trilinos_INTERFACE_MPI_C_FOUND + ${Trilinos_MPI} + CACHE INTERNAL "Is Trilinos interface C compiler MPI") else() - force_variable(Trilinos_INTERFACE_C_COMPILER STRING "C compiler for Trilinos interface" "${CMAKE_C_COMPILER}") - set(Trilinos_INTERFACE_MPI_C_FOUND FALSE CACHE INTERNAL "Is Trilinos interface C compiler MPI") + force_variable(Trilinos_INTERFACE_C_COMPILER STRING + "C compiler for Trilinos interface" "${CMAKE_C_COMPILER}") + set(Trilinos_INTERFACE_MPI_C_FOUND + FALSE + CACHE INTERNAL "Is Trilinos interface C compiler MPI") endif() - force_variable(Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING "C++ compiler flags specific to Trilinos interface" "") - force_variable(Trilinos_INTERFACE_C_COMPILER_FLAGS STRING "C compiler flags specific to Trilinos interface" "") - force_variable(Trilinos_INTERFACE_MPIEXEC STRING "MPI executable for Trilinos interface" "${MPIEXEC_EXECUTABLE}") + force_variable(Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING + "C++ compiler flags specific to Trilinos interface" "") + force_variable(Trilinos_INTERFACE_C_COMPILER_FLAGS STRING + "C compiler flags specific to Trilinos interface" "") + force_variable( + Trilinos_INTERFACE_MPIEXEC STRING "MPI executable for Trilinos interface" + "${MPIEXEC_EXECUTABLE}") else() - force_variable(Trilinos_INTERFACE_CXX_COMPILER STRING "C++ compiler for Trilinos interface" "${Trilinos_CXX_COMPILER}") - force_variable(Trilinos_INTERFACE_C_COMPILER STRING "C compiler for Trilinos interface" "${Trilinos_C_COMPILER}") - force_variable(Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING "C++ compiler flags for Trilinos interface" "${Trilinos_CXX_COMPILER_FLAGS}") - force_variable(Trilinos_INTERFACE_C_COMPILER_FLAGS STRING "C compiler flags for Trilinos interface" "${Trilinos_C_COMPILER_FLAGS}") - force_variable(Trilinos_INTERFACE_MPIEXEC STRING "MPI executable for Trilinos interface" "${Trilinos_MPI_EXEC}") - set(Trilinos_INTERFACE_MPI_CXX_FOUND ${Trilinos_MPI} CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") - set(Trilinos_INTERFACE_MPI_C_FOUND ${Trilinos_MPI} CACHE INTERNAL "Is Trilinos interface C compiler MPI") + force_variable( + Trilinos_INTERFACE_CXX_COMPILER STRING + "C++ compiler for Trilinos interface" "${Trilinos_CXX_COMPILER}") + force_variable(Trilinos_INTERFACE_C_COMPILER STRING + "C compiler for Trilinos interface" "${Trilinos_C_COMPILER}") + force_variable( + Trilinos_INTERFACE_CXX_COMPILER_FLAGS STRING + "C++ compiler flags for Trilinos interface" + "${Trilinos_CXX_COMPILER_FLAGS}") + force_variable( + Trilinos_INTERFACE_C_COMPILER_FLAGS STRING + "C compiler flags for Trilinos interface" "${Trilinos_C_COMPILER_FLAGS}") + force_variable(Trilinos_INTERFACE_MPIEXEC STRING + "MPI executable for Trilinos interface" "${Trilinos_MPI_EXEC}") + set(Trilinos_INTERFACE_MPI_CXX_FOUND + ${Trilinos_MPI} + CACHE INTERNAL "Is Trilinos interface C++ compiler MPI") + set(Trilinos_INTERFACE_MPI_C_FOUND + ${Trilinos_MPI} + CACHE INTERNAL "Is Trilinos interface C compiler MPI") endif() message(STATUS "Trilinos_MPI: ${Trilinos_MPI}") @@ -109,7 +137,8 @@ if(Trilinos_FOUND AND (NOT Trilinos_WORKS)) file(MAKE_DIRECTORY ${Trilinos_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${Trilinos_TEST_DIR}/CMakeLists.txt + file( + WRITE ${Trilinos_TEST_DIR}/CMakeLists.txt "CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION})\n" "PROJECT(ltest CXX)\n" "SET(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -125,20 +154,21 @@ if(Trilinos_FOUND AND (NOT Trilinos_WORKS)) # Create a C++ source file which calls a Trilinos function file(WRITE ${Trilinos_TEST_DIR}/ltest.cpp - "#include \n" - "int main(void) {\n" - "std::cout << Tpetra::version() << std::endl;\n" - "return(0);\n" - "}\n") + "#include \n" "int main(void) {\n" + "std::cout << Tpetra::version() << std::endl;\n" "return(0);\n" "}\n") # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${Trilinos_TEST_DIR} ${Trilinos_TEST_DIR} ltest + try_compile( + COMPILE_OK ${Trilinos_TEST_DIR} + ${Trilinos_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) # Process test result if(COMPILE_OK) message(STATUS "Checking if Trilinos works with SUNDIALS... OK") - set(Trilinos_WORKS TRUE CACHE BOOL "Trilinos works with SUNDIALS as configured" FORCE) + set(Trilinos_WORKS + TRUE + CACHE BOOL "Trilinos works with SUNDIALS as configured" FORCE) else() message(STATUS "Checking if Trilinos works with SUNDIALS... FAILED") message(STATUS "Check output: ") @@ -147,5 +177,8 @@ if(Trilinos_FOUND AND (NOT Trilinos_WORKS)) endif() elseif(Trilinos_FOUND AND Trilinos_WORKS) - message(STATUS "Skipped Trilinos tests, assuming Trilinos works with SUNDIALS. Set Trilinos_WORKS=FALSE to (re)run compatibility test.") + message( + STATUS + "Skipped Trilinos tests, assuming Trilinos works with SUNDIALS. Set Trilinos_WORKS=FALSE to (re)run compatibility test." + ) endif() diff --git a/cmake/tpl/SundialsXBRAID.cmake b/cmake/tpl/SundialsXBRAID.cmake index e8e8ceb941..ede169ade0 100644 --- a/cmake/tpl/SundialsXBRAID.cmake +++ b/cmake/tpl/SundialsXBRAID.cmake @@ -38,20 +38,21 @@ endif() # Using XBRAID requires building with MPI enabled if(NOT ENABLE_MPI) - message(FATAL_ERROR - "MPI is required for XBraid support. Set ENABLE_MPI to ON.") + message( + FATAL_ERROR "MPI is required for XBraid support. Set ENABLE_MPI to ON.") endif() # XBraid does not support single or extended precision if(SUNDIALS_PRECISION MATCHES "SINGLE" OR SUNDIALS_PRECISION MATCHES "EXTENDED") - message(FATAL_ERROR - "XBraid is not compatible with ${SUNDIALS_PRECISION} precision") + message( + FATAL_ERROR "XBraid is not compatible with ${SUNDIALS_PRECISION} precision") endif() # XBraid does not support 64-bit index sizes if(SUNDIALS_INDEX_SIZE MATCHES "64") - message(FATAL_ERROR - "XBraid is not compatible with ${SUNDIALS_INDEX_SIZE}-bit indices") + message( + FATAL_ERROR + "XBraid is not compatible with ${SUNDIALS_INDEX_SIZE}-bit indices") endif() # ----------------------------------------------------------------------------- @@ -76,7 +77,8 @@ if(XBRAID_FOUND AND (NOT XBRAID_WORKS)) file(MAKE_DIRECTORY ${XBRAID_TEST_DIR}) # Create a CMakeLists.txt file - file(WRITE ${XBRAID_TEST_DIR}/CMakeLists.txt + file( + WRITE ${XBRAID_TEST_DIR}/CMakeLists.txt "cmake_minimum_required(VERSION ${CMAKE_VERSION})\n" "project(ltest C)\n" "set(CMAKE_VERBOSE_MAKEFILE ON)\n" @@ -94,7 +96,8 @@ if(XBRAID_FOUND AND (NOT XBRAID_WORKS)) "target_link_libraries(ltest m)\n") # Create a C source file - file(WRITE ${XBRAID_TEST_DIR}/ltest.c + file( + WRITE ${XBRAID_TEST_DIR}/ltest.c "\#include \n" "\#include \"braid.h\"\n" "int main(void) {\n" @@ -104,18 +107,22 @@ if(XBRAID_FOUND AND (NOT XBRAID_WORKS)) "return 0;\n" "}\n") - # To ensure we do not use stuff from the previous attempts, - # we must remove the CMakeFiles directory. + # To ensure we do not use stuff from the previous attempts, we must remove the + # CMakeFiles directory. file(REMOVE_RECURSE ${XBRAID_TEST_DIR}/CMakeFiles) # Attempt to build and link the "ltest" executable - try_compile(COMPILE_OK ${XBRAID_TEST_DIR} ${XBRAID_TEST_DIR} ltest + try_compile( + COMPILE_OK ${XBRAID_TEST_DIR} + ${XBRAID_TEST_DIR} ltest OUTPUT_VARIABLE COMPILE_OUTPUT) # Process test result if(COMPILE_OK) message(STATUS "Checking if XBRAID works... OK") - set(XBRAID_WORKS TRUE CACHE BOOL "XBRAID works as configured" FORCE) + set(XBRAID_WORKS + TRUE + CACHE BOOL "XBRAID works as configured" FORCE) else() message(STATUS "Checking if XBRAID works... FAILED") message(STATUS "Check output: ") diff --git a/doc/superbuild/source/developers/style_guide/SourceCode.rst b/doc/superbuild/source/developers/style_guide/SourceCode.rst index a01897bdf2..5a05602867 100644 --- a/doc/superbuild/source/developers/style_guide/SourceCode.rst +++ b/doc/superbuild/source/developers/style_guide/SourceCode.rst @@ -186,7 +186,8 @@ not adhere to all of these rules. #. All new code added to SUNDIALS should be formatted with `clang-format `_ for C/C++, `fprettify - `_ for Fortran, and `black + `_ for Fortran, `cmake-format + `_ for CMake, and `black `_ for Python. See :ref:`Style.Formatting` for details. @@ -380,18 +381,21 @@ Formatting All new code added to SUNDIALS should be formatted with `clang-format `_ for C/C++, `fprettify -`_ for Fortran, and `black +`_ for Fortran, `cmake-format +`_ for CMake, and `black `_ for Python. The ``.clang-format`` file in the root of the project defines our configuration for clang-format. We use the -default fprettify settings, except we use 2-space indentation. We also use the -default black settings. +default fprettify settings, except we use 2-space indentation. The +``.cmake-format.py`` file in the root of the project defines our configuration +for cmake-format. We also use the default black settings. -To apply ``clang-format``, ``fprettify``, and ``black`` you can run: -.. code-block:: shell +To apply ``clang-format``, ``fprettify``, ``cmake-format``, and ``black`` you +can run: - ./scripts/format.sh +.. code-block:: shell + ./scripts/format.sh .. warning:: @@ -401,7 +405,6 @@ To apply ``clang-format``, ``fprettify``, and ``black`` you can run: formatting is required, the action will fail and produce a git patch artifact that you can download (from the job artifacts section) and apply with ``git apply``. - If clang-format breaks lines in a way that is unreadable, use ``//`` to break the line. For example, sometimes (mostly in C++ code) you may have code like this: @@ -457,4 +460,3 @@ There are other scenarios (e.g., a function call with a lot of parameters) where .. }; .. See the clang-tidy documentation for more details. - diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 55b1e52db4..45990b05da 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,7 +15,8 @@ # --------------------------------------------------------------- # We need this to ensure the installed templates have MPI when ENABLE_MPI=TRUE, -# at least until we convert all of the templates to use the SUNDIALS CMake target. +# at least until we convert all of the templates to use the SUNDIALS CMake +# target. # =================================================================== # Configure compilers for installed examples @@ -24,10 +25,14 @@ foreach(lang ${_SUNDIALS_ENABLED_LANGS}) if(ENABLE_MPI) if(DEFINED MPI_${lang}_COMPILER) - set(_EXAMPLES_${lang}_COMPILER "${MPI_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_${lang}_COMPILER + "${MPI_${lang}_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") endif() else() - set(_EXAMPLES_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE INTERNAL "${lang} compiler for installed examples") + set(_EXAMPLES_${lang}_COMPILER + "${CMAKE_${lang}_COMPILER}" + CACHE INTERNAL "${lang} compiler for installed examples") endif() endforeach() @@ -62,7 +67,9 @@ if(EXAMPLES_INSTALL) if(CXX_FOUND) set(CXX "${_EXAMPLES_CXX_COMPILER}") set(CXX_LNKR "${_EXAMPLES_CXX_COMPILER}") - set(CXXFLAGS "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") + set(CXXFLAGS + "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}" + ) set(CXX_LDFLAGS "${CMAKE_CXX_FLAGS_RELEASE}") list2string(EXE_EXTRA_LINK_LIBS CXX_LIBS) endif() diff --git a/examples/arkode/CMakeLists.txt b/examples/arkode/CMakeLists.txt index defe97ed7c..bfcbe267fd 100644 --- a/examples/arkode/CMakeLists.txt +++ b/examples/arkode/CMakeLists.txt @@ -23,7 +23,9 @@ if(EXAMPLES_ENABLE_C) if(ENABLE_OPENMP AND OPENMP_FOUND) add_subdirectory(C_openmp) endif() - if(ENABLE_OPENMP_DEVICE AND OPENMP_FOUND AND OPENMP_SUPPORTS_DEVICE_OFFLOADING) + if(ENABLE_OPENMP_DEVICE + AND OPENMP_FOUND + AND OPENMP_SUPPORTS_DEVICE_OFFLOADING) add_subdirectory(C_openmpdev) endif() if(ENABLE_MPI AND MPI_C_FOUND) @@ -43,7 +45,10 @@ if(EXAMPLES_ENABLE_CXX) if(ENABLE_MPI AND MPI_CXX_FOUND) add_subdirectory(CXX_parallel) endif() - if(ENABLE_MPI AND MPI_CXX_FOUND AND ENABLE_HYPRE AND HYPRE_FOUND) + if(ENABLE_MPI + AND MPI_CXX_FOUND + AND ENABLE_HYPRE + AND HYPRE_FOUND) add_subdirectory(CXX_parhyp) endif() if(MPI_CXX_FOUND AND ENABLE_SUPERLUDIST) diff --git a/examples/arkode/CXX_parallel/CMakeLists.txt b/examples/arkode/CXX_parallel/CMakeLists.txt index 9e11a5cfe5..2ebc00df7e 100644 --- a/examples/arkode/CXX_parallel/CMakeLists.txt +++ b/examples/arkode/CXX_parallel/CMakeLists.txt @@ -37,8 +37,8 @@ macro(build_examples examples_to_build lang) set(example_target "${example_target}.${example_defines}") endif() - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) set_source_files_properties(${example} PROPERTIES LANGUAGE ${lang}) @@ -54,10 +54,11 @@ macro(build_examples examples_to_build lang) # libraries to link against target_include_directories(${example_target} - PRIVATE ${MPI_CXX_INCLUDE_DIRS}) + PRIVATE ${MPI_CXX_INCLUDE_DIRS}) - target_link_libraries(${example_target} - PRIVATE ${OTHER_LIBS} ${SUNDIALS_LIBS} ${MPI_CXX_LIBRARIES}) + target_link_libraries( + ${example_target} PRIVATE ${OTHER_LIBS} ${SUNDIALS_LIBS} + ${MPI_CXX_LIBRARIES}) # compile definitions if(example_defines) @@ -74,7 +75,8 @@ macro(build_examples examples_to_build lang) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -91,7 +93,7 @@ macro(build_examples examples_to_build lang) # Install example source and out files install(FILES ${example} ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parallel) endif() @@ -102,11 +104,12 @@ endmacro() # Examples to build and install # ----------------------------- -# Example lists are tuples "name\;compile defs\;args\;nodes\;tasks\;type\;float precision" -# where the type develop is for examples excluded from 'make test' in releases. +# Example lists are tuples "name\;compile defs\;args\;nodes\;tasks\;type\;float +# precision" where the type develop is for examples excluded from 'make test' in +# releases. # List of headers to install (appended to below) -set(ARKODE_headers ) +set(ARKODE_headers) # List of additional files to install (appended to below) set(ARKODE_extras) @@ -118,8 +121,7 @@ set(OTHER_LIBS ${EXE_EXTRA_LINK_LIBS}) # MPI examples # ------------ -set(serial_examples - "ark_heat2D_p.cpp\;\;--np 2 2\;1\;4\;develop\;default") +set(serial_examples "ark_heat2D_p.cpp\;\;--np 2 2\;1\;4\;develop\;default") set(SUNDIALS_LIBS sundials_arkode sundials_nvecparallel) build_examples(serial_examples CXX) @@ -132,11 +134,13 @@ list(APPEND ARKODE_extras plot_heat2D_p.py) if(BUILD_CVODE) set(examples_cvode - "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --imex\;1\;4\;exclude-single\;default" - "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-arkstep\;1\;4\;exclude-single\;default" - "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-cvode-global\;1\;4\;exclude-single\;default" - "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-cvode-local\;1\;4\;exclude-single\;default") - set(SUNDIALS_LIBS sundials_arkode sundials_cvode sundials_nvecparallel sundials_nvecmpiplusx) + "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --imex\;1\;4\;exclude-single\;default" + "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-arkstep\;1\;4\;exclude-single\;default" + "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-cvode-global\;1\;4\;exclude-single\;default" + "ark_diffusion_reaction_p.cpp\;\;--np 2 2 --mri-cvode-local\;1\;4\;exclude-single\;default" + ) + set(SUNDIALS_LIBS sundials_arkode sundials_cvode sundials_nvecparallel + sundials_nvecmpiplusx) build_examples(examples_cvode CXX) endif() @@ -144,8 +148,9 @@ endif() # RAJA Examples # ------------- -if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND - (SUNDIALS_INDEX_SIZE MATCHES "32")) +if(ENABLE_RAJA + AND (SUNDIALS_PRECISION MATCHES "DOUBLE") + AND (SUNDIALS_INDEX_SIZE MATCHES "32")) # Header files to install list(APPEND ARKODE_headers ark_brusselator1D.h) @@ -160,7 +165,8 @@ if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND endif() # If RAJA has OpenMP enabled, we have to link to OpenMP even if we dont use it - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(OTHER_LIBS OpenMP::OpenMP_CXX ${OTHER_LIBS}) endif() @@ -169,9 +175,10 @@ if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND # ------------- set(serial_raja_examples - "ark_brusselator1D_task_local_nls.cpp\;\;--monitor\;1\;4\;develop\;2" - "ark_brusselator1D_task_local_nls.cpp\;\;--monitor --global-nls\;1\;4\;develop\;2" - "ark_brusselator1D_task_local_nls.cpp\;\;--monitor --explicit --tf 1\;1\;4\;develop\;2") + "ark_brusselator1D_task_local_nls.cpp\;\;--monitor\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls.cpp\;\;--monitor --global-nls\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls.cpp\;\;--monitor --explicit --tf 1\;1\;4\;develop\;2" + ) set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx) build_examples(serial_raja_examples CXX) @@ -183,16 +190,18 @@ if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND if(BUILD_NVECTOR_CUDA) set(cuda_raja_examples - "ark_brusselator1D_task_local_nls.cpp\;USE_CUDA_NVEC\;--monitor\;1\;4\;develop\;2" - "ark_brusselator1D_task_local_nls.cpp\;USE_CUDAUVM_NVEC\;--monitor\;1\;4\;exclude\;2" - "ark_brusselator1D_task_local_nls.cpp\;USE_CUDA_NVEC\;--monitor --global-nls\;1\;4\;develop\;2") + "ark_brusselator1D_task_local_nls.cpp\;USE_CUDA_NVEC\;--monitor\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls.cpp\;USE_CUDAUVM_NVEC\;--monitor\;1\;4\;exclude\;2" + "ark_brusselator1D_task_local_nls.cpp\;USE_CUDA_NVEC\;--monitor --global-nls\;1\;4\;develop\;2" + ) set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx sundials_nveccuda) build_examples(cuda_raja_examples CUDA) endif() if(BUILD_NVECTOR_RAJA AND (SUNDIALS_RAJA_BACKENDS MATCHES "CUDA")) set(raja_raja_examples - "ark_brusselator1D_task_local_nls.cpp\;USE_RAJA_NVEC\;--monitor\;1\;4\;exclude\;2") + "ark_brusselator1D_task_local_nls.cpp\;USE_RAJA_NVEC\;--monitor\;1\;4\;exclude\;2" + ) set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx sundials_nvecraja) build_examples(raja_raja_examples CUDA) endif() @@ -203,7 +212,8 @@ if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND if(BUILD_NVECTOR_HIP AND (RAJA_BACKENDS MATCHES "HIP")) set(hip_raja_examples - "ark_brusselator1D_task_local_nls.cpp\;USE_HIP_NVEC\;--monitor\;1\;4\;exclude\;2") + "ark_brusselator1D_task_local_nls.cpp\;USE_HIP_NVEC\;--monitor\;1\;4\;exclude\;2" + ) set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx sundials_nvechip) build_examples(hip_raja_examples CXX) endif() @@ -214,16 +224,18 @@ if(ENABLE_RAJA AND (SUNDIALS_PRECISION MATCHES "DOUBLE") AND if(BUILD_NVECTOR_OPENMPDEV AND (RAJA_BACKENDS MATCHES "TARGET_OPENMP")) set(openmpdev_raja_examples - "ark_brusselator1D_task_local_nls.cpp\;USE_OMPDEV_NVEC\;--monitor\;1\;4\;exclude\;2") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") - set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx sundials_nvecopenmpdev) + "ark_brusselator1D_task_local_nls.cpp\;USE_OMPDEV_NVEC\;--monitor\;1\;4\;exclude\;2" + ) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") + set(SUNDIALS_LIBS sundials_arkode sundials_nvecmpiplusx + sundials_nvecopenmpdev) build_examples(openmpdev_raja_examples CXX) endif() endif() endif() - if(EXAMPLES_INSTALL) set(examples_to_install "${serial_examples}") @@ -235,35 +247,24 @@ if(EXAMPLES_INSTALL) endif() # For now do not install the RAJA examples because they need to built as CUDA - # code when RAJA is built with CUDA - # if(serial_raja_examples) - # list(APPEND examples_to_install "${serial_raja_examples}") - # list(APPEND _sundials_targets nvecmpiplusx) - - # if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) - # set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") - # endif() - - # if(RAJA_NEEDS_THREADS) - # set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") - # endif() + # code when RAJA is built with CUDA if(serial_raja_examples) list(APPEND + # examples_to_install "${serial_raja_examples}") list(APPEND _sundials_targets + # nvecmpiplusx) + + # if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES + # "OPENMP")) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") # endif() - sundials_install_examples(arkode examples_to_install - CMAKE_TEMPLATE - cmakelists_CXX_MPI_ex.in - SUNDIALS_TARGETS - ${_sundials_targets} - OTHER_TARGETS - ${EXE_EXTRA_LINK_LIBS} - DESTINATION - arkode/CXX_parallel - EXTRA_FILES - ${ARKODE_headers} - ${ARKODE_extras} - README - TEST_INSTALL - CXX_parallel - ) + # if(RAJA_NEEDS_THREADS) set(EXAMPLES_FIND_PACKAGE + # "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() endif() + + sundials_install_examples( + arkode examples_to_install + CMAKE_TEMPLATE cmakelists_CXX_MPI_ex.in + SUNDIALS_TARGETS ${_sundials_targets} + OTHER_TARGETS ${EXE_EXTRA_LINK_LIBS} + DESTINATION arkode/CXX_parallel + EXTRA_FILES ${ARKODE_headers} ${ARKODE_extras} README + TEST_INSTALL CXX_parallel) endif() diff --git a/examples/arkode/CXX_parhyp/CMakeLists.txt b/examples/arkode/CXX_parhyp/CMakeLists.txt index 40e7fb13d5..a56531b5e1 100644 --- a/examples/arkode/CXX_parhyp/CMakeLists.txt +++ b/examples/arkode/CXX_parhyp/CMakeLists.txt @@ -14,21 +14,18 @@ # CMakeLists.txt file for ARKODE C++ parhyp examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(ARKODE_examples - "ark_heat2D_hypre_ls\;--np 2 2\;1\;4\;develop" - "ark_heat2D_hypre_pfmg\;--np 2 2\;1\;4\;develop" - "ark_heat2D_hypre_pfmg_mri\;--np 2 2\;1\;4\;develop" - "ark_heat2D_hypre_pfmg_imex\;--np 2 2\;1\;4\;develop" - ) + "ark_heat2D_hypre_ls\;--np 2 2\;1\;4\;develop" + "ark_heat2D_hypre_pfmg\;--np 2 2\;1\;4\;develop" + "ark_heat2D_hypre_pfmg_mri\;--np 2 2\;1\;4\;develop" + "ark_heat2D_hypre_pfmg_imex\;--np 2 2\;1\;4\;develop") # Auxiliary files to install -set(ARKODE_extras - plot_heat2D_p.py - ) +set(ARKODE_extras plot_heat2D_p.py) # Specify libraries to link against set(ARKODE_LIB sundials_arkode) @@ -37,7 +34,6 @@ set(NVECP_LIB sundials_nvecparallel) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${ARKODE_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${ARKODE_examples}) @@ -48,8 +44,8 @@ foreach(example_tuple ${ARKODE_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cpp) @@ -58,8 +54,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE - MPI::MPI_CXX ${SUNDIALS_LIBS} SUNDIALS::HYPRE) + target_link_libraries(${example} PRIVATE MPI::MPI_CXX ${SUNDIALS_LIBS} + SUNDIALS::HYPRE) endif() # check if example args are provided and set the test name @@ -70,7 +66,8 @@ foreach(example_tuple ${ARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -83,12 +80,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp) endif() endforeach(example_tuple ${ARKODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -97,7 +93,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -107,39 +104,32 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_parhyp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_parhyp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/CXX_serial/CMakeLists.txt b/examples/arkode/CXX_serial/CMakeLists.txt index 24ca919088..cdd673c777 100644 --- a/examples/arkode/CXX_serial/CMakeLists.txt +++ b/examples/arkode/CXX_serial/CMakeLists.txt @@ -15,42 +15,37 @@ # CMakeLists.txt file for ARKODE serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(ARKODE_examples - "ark_analytic_sys.cpp\;\;develop" - "ark_heat2D.cpp\;\;develop" - "ark_kpr_Mt.cpp\;0 5\;develop" - "ark_kpr_Mt.cpp\;1 4\;develop" - "ark_kpr_Mt.cpp\;2 8 0 -10\;develop" - "ark_kpr_Mt.cpp\;0 4 1\;develop" - "ark_kpr_Mt.cpp\;0 -4\;exclude-single" - "ark_kpr_Mt.cpp\;1 -5\;exclude-single" - "ark_kpr_Mt.cpp\;2 -5 0 -10\;develop" - "ark_kpr_Mt.cpp\;1 -3 0 -10 0\;exclude-single" - "ark_kpr_Mt.cpp\;0 3 0 -10 0\;develop" - "ark_kpr_Mt.cpp\;2 4 0 -10 0\;develop" - "ark_kpr_Mt.cpp\;0 4 0 -10 1 10 1\;develop" - "ark_kpr_Mt.cpp\;0 4 0 -10 0 10 1\;develop" - "ark_pendulum.cpp\;\;develop" - ) + "ark_analytic_sys.cpp\;\;develop" + "ark_heat2D.cpp\;\;develop" + "ark_kpr_Mt.cpp\;0 5\;develop" + "ark_kpr_Mt.cpp\;1 4\;develop" + "ark_kpr_Mt.cpp\;2 8 0 -10\;develop" + "ark_kpr_Mt.cpp\;0 4 1\;develop" + "ark_kpr_Mt.cpp\;0 -4\;exclude-single" + "ark_kpr_Mt.cpp\;1 -5\;exclude-single" + "ark_kpr_Mt.cpp\;2 -5 0 -10\;develop" + "ark_kpr_Mt.cpp\;1 -3 0 -10 0\;exclude-single" + "ark_kpr_Mt.cpp\;0 3 0 -10 0\;develop" + "ark_kpr_Mt.cpp\;2 4 0 -10 0\;develop" + "ark_kpr_Mt.cpp\;0 4 0 -10 1 10 1\;develop" + "ark_kpr_Mt.cpp\;0 4 0 -10 0 10 1\;develop" + "ark_pendulum.cpp\;\;develop") # Header files to install set(ARKODE_headers) if(BUILD_CVODE) - list(APPEND ARKODE_examples - "ark_advection_diffusion_reaction.cpp\;\;develop") - list(APPEND ARKODE_headers - "ark_advection_diffusion_reaction.hpp") + list(APPEND ARKODE_examples "ark_advection_diffusion_reaction.cpp\;\;develop") + list(APPEND ARKODE_headers "ark_advection_diffusion_reaction.hpp") endif() # Auxiliary files to install -set(ARKODE_extras - plot_heat2D.py - plot_sol.py) +set(ARKODE_extras plot_heat2D.py plot_sol.py) # Add the build and install targets for each example foreach(example_tuple ${ARKODE_examples}) @@ -71,14 +66,11 @@ foreach(example_tuple ${ARKODE_examples}) # directories to include target_include_directories(${example_target} - PRIVATE - ${PROJECT_SOURCE_DIR}/examples/utilities) + PRIVATE ${PROJECT_SOURCE_DIR}/examples/utilities) # libraries to link against - target_link_libraries(${example_target} - sundials_arkode - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example_target} sundials_arkode sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) if(BUILD_CVODE) target_link_libraries(${example_target} sundials_cvode) @@ -93,7 +85,8 @@ foreach(example_tuple ${ARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -110,25 +103,14 @@ if(EXAMPLES_INSTALL) endif() endif() - sundials_install_examples(arkode ARKODE_examples - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - MAKE_TEMPLATE - makefile_serial_CXX_ex.in - SUNDIALS_TARGETS - nvecserial - arkode - ${_include_cvode} - ${_include_cvode_stubs} - DESTINATION - arkode/CXX_serial - EXTRA_FILES - README - ${ARKODE_extras} - ${ARKODE_headers} - "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" - TEST_INSTALL - CXX_serial - ) + sundials_install_examples( + arkode ARKODE_examples + CMAKE_TEMPLATE cmakelists_CXX_ex.in + MAKE_TEMPLATE makefile_serial_CXX_ex.in + SUNDIALS_TARGETS nvecserial arkode ${_include_cvode} ${_include_cvode_stubs} + DESTINATION arkode/CXX_serial + EXTRA_FILES README ${ARKODE_extras} ${ARKODE_headers} + "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" + TEST_INSTALL CXX_serial) endif() diff --git a/examples/arkode/CXX_superludist/CMakeLists.txt b/examples/arkode/CXX_superludist/CMakeLists.txt index 7d92aaf9ce..b9e286c11c 100644 --- a/examples/arkode/CXX_superludist/CMakeLists.txt +++ b/examples/arkode/CXX_superludist/CMakeLists.txt @@ -14,14 +14,13 @@ # CMakeLists.txt file for ARKODE C++ SuperLU_DIST examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases list(APPEND ARKODE_examples "ark_brusselator1D_FEM_sludist.cpp\;1\;1\;develop") # Auxiliary files to install -set(ARKODE_extras - ) +set(ARKODE_extras) # Add the build and install targets for each example foreach(example_tuple ${ARKODE_examples}) @@ -41,17 +40,16 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out EXAMPLE_TYPE ${example_type}) # libraries to link against - target_link_libraries(${example_target} PRIVATE - MPI::MPI_CXX - sundials_arkode - sundials_sunlinsolsuperludist) + target_link_libraries(${example_target} PRIVATE MPI::MPI_CXX sundials_arkode + sundials_sunlinsolsuperludist) endforeach(example_tuple ${ARKODE_examples}) @@ -66,18 +64,12 @@ endif() # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - sundials_install_examples(arkode_superludist ARKODE_examples - EXTRA_FILES - README - ${ARKODE_extras} - CMAKE_TEMPLATE - cmakelists_${_ex_lang}_MPI_ex.in - SUNDIALS_TARGETS - arkode - sunlinsolsuperludist - DESTINATION - arkode/CXX_superludist - ) + sundials_install_examples( + arkode_superludist ARKODE_examples + EXTRA_FILES README ${ARKODE_extras} + CMAKE_TEMPLATE cmakelists_${_ex_lang}_MPI_ex.in + SUNDIALS_TARGETS arkode sunlinsolsuperludist + DESTINATION arkode/CXX_superludist) # add test_install target sundials_add_test_install(arkode CXX_superludist) diff --git a/examples/arkode/CXX_xbraid/CMakeLists.txt b/examples/arkode/CXX_xbraid/CMakeLists.txt index 302d0f3232..b788cf1016 100644 --- a/examples/arkode/CXX_xbraid/CMakeLists.txt +++ b/examples/arkode/CXX_xbraid/CMakeLists.txt @@ -14,25 +14,22 @@ # CMakeLists.txt file for ARKODE C++ XBraid examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(ARKODE_examples - "ark_heat2D_xbraid\;--x_print_level 0\;1\;4\;develop" - "ark_heat2D_p_xbraid\;--np 2 1 2 --x_print_level 0\;1\;4\;develop" - ) + "ark_heat2D_xbraid\;--x_print_level 0\;1\;4\;develop" + "ark_heat2D_p_xbraid\;--np 2 1 2 --x_print_level 0\;1\;4\;develop") if(ENABLE_HYPRE AND HYPRE_FOUND) set(ARKODE_examples_hypre - "ark_heat2D_hypre_pfmg_xbraid\;--np 2 1 2 --x_print_level 0\;1\;4\;develop" - ) + "ark_heat2D_hypre_pfmg_xbraid\;--np 2 1 2 --x_print_level 0\;1\;4\;develop" + ) endif() # Auxiliary files to install -set(ARKODE_extras - plot_heat2D.py - ) +set(ARKODE_extras plot_heat2D.py) # Specify libraries to link against set(ARKODE_LIB sundials_arkode) @@ -40,7 +37,8 @@ set(ARKODE_XBRAID_LIB sundials_arkode_xbraid) set(NVECP_LIB sundials_nvecparallel) # Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${ARKODE_LIB} ${ARKODE_XBRAID_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) +set(SUNDIALS_LIBS ${ARKODE_LIB} ${ARKODE_XBRAID_LIB} ${NVECP_LIB} + ${EXE_EXTRA_LINK_LIBS}) # Add the build and install targets for each example foreach(example_tuple ${ARKODE_examples}) @@ -52,8 +50,8 @@ foreach(example_tuple ${ARKODE_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files @@ -75,7 +73,8 @@ foreach(example_tuple ${ARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -88,13 +87,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) endif() endforeach(example_tuple ${ARKODE_examples}) - - if(ENABLE_HYPRE AND HYPRE_FOUND) # Add the build and install targets for each example @@ -107,8 +104,8 @@ if(ENABLE_HYPRE AND HYPRE_FOUND) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files @@ -118,8 +115,8 @@ if(ENABLE_HYPRE AND HYPRE_FOUND) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE - MPI::MPI_CXX ${SUNDIALS_LIBS} SUNDIALS::HYPRE SUNDIALS::XBRAID) + target_link_libraries(${example} PRIVATE MPI::MPI_CXX ${SUNDIALS_LIBS} + SUNDIALS::HYPRE SUNDIALS::XBRAID) endif() @@ -131,7 +128,8 @@ if(ENABLE_HYPRE AND HYPRE_FOUND) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -144,23 +142,24 @@ if(ENABLE_HYPRE AND HYPRE_FOUND) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) endif() endforeach(example_tuple ${ARKODE_examples}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the README file - install(FILES README.md DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) + install(FILES README.md + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -172,41 +171,34 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples_hypre EXAMPLES_HYPRE) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_xbraid_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_xbraid_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/CXX_xbraid/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/CXX_xbraid - RENAME Makefile - ) + RENAME Makefile) endif(UNIX) diff --git a/examples/arkode/C_manyvector/CMakeLists.txt b/examples/arkode/C_manyvector/CMakeLists.txt index 380212a16c..25ead792fd 100644 --- a/examples/arkode/C_manyvector/CMakeLists.txt +++ b/examples/arkode/C_manyvector/CMakeLists.txt @@ -14,18 +14,14 @@ # CMakeLists.txt file for ARKODE ManyVector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(ARKODE_examples - "ark_brusselator1D_manyvec\;develop" - ) +set(ARKODE_examples "ark_brusselator1D_manyvec\;develop") # Auxiliary files to install -set(ARKODE_extras - plot_brusselator1D.py - ) +set(ARKODE_extras plot_brusselator1D.py) # Specify libraries to link against set(ARKODE_LIB sundials_arkode) @@ -47,7 +43,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -58,7 +55,7 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector) endif() endforeach(example_tuple ${ARKODE_examples}) @@ -71,7 +68,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector) endforeach(extrafile ${ARKODE_extras}) # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -81,39 +79,33 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_manyvector/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_manyvector - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/C_openmp/CMakeLists.txt b/examples/arkode/C_openmp/CMakeLists.txt index 1415e70ceb..8bd1f15e44 100644 --- a/examples/arkode/C_openmp/CMakeLists.txt +++ b/examples/arkode/C_openmp/CMakeLists.txt @@ -14,20 +14,15 @@ # CMakeLists.txt file for ARKODE OpenMP examples # --------------------------------------------------------------- -# Example lists are tuples -# "name\;args\;type\;float precision\;int precision" where the type -# is 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type\;float precision\;int precision" +# where the type is 'develop' for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(ARKODE_examples - "ark_brusselator1D_omp\;4\;exclude-single\;default\;default" - "ark_heat1D_omp\;4\;develop\;default\;10" - ) +set(ARKODE_examples "ark_brusselator1D_omp\;4\;exclude-single\;default\;default" + "ark_heat1D_omp\;4\;develop\;default\;10") # Auxiliary files to install -set(ARKODE_extras_OMP - plot_brusselator1D.py - ) +set(ARKODE_extras_OMP plot_brusselator1D.py) # Add the build and install targets for each ARKODE example foreach(example_tuple ${ARKODE_examples}) @@ -45,7 +40,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -54,20 +50,17 @@ foreach(example_tuple ${ARKODE_examples}) INTEGER_PRECISION ${example_int_precision}) # libraries to link against - target_link_libraries(${example} - sundials_arkode - sundials_nvecopenmp - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_arkode sundials_nvecopenmp + ${EXE_EXTRA_LINK_LIBS}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp) endif() endforeach(example_tuple ${ARKODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -76,7 +69,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras_OMP}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -86,39 +80,32 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/C_openmpdev/CMakeLists.txt b/examples/arkode/C_openmpdev/CMakeLists.txt index aa1ebdd13f..9c94239a2e 100644 --- a/examples/arkode/C_openmpdev/CMakeLists.txt +++ b/examples/arkode/C_openmpdev/CMakeLists.txt @@ -14,15 +14,13 @@ # CMakeLists.txt file for ARKODE OpenMPDEV examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(ARKODE_examples - "ark_analytic_nonlin_ompdev\;4\;develop" - "ark_heat1D_ompdev\;4\;develop" - "ark_heat1D_adapt_ompdev\;4\;develop" - ) + "ark_analytic_nonlin_ompdev\;4\;develop" "ark_heat1D_ompdev\;4\;develop" + "ark_heat1D_adapt_ompdev\;4\;develop") # Specify libraries to link against set(ARKODE_LIB sundials_arkode) @@ -45,7 +43,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -57,12 +56,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev) endif() endforeach(example_tuple ${ARKODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -71,7 +69,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras_OMP}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -81,39 +80,32 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_openmpdev/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_openmpdev - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/C_parallel/CMakeLists.txt b/examples/arkode/C_parallel/CMakeLists.txt index 1ad69580eb..7ace3f347f 100644 --- a/examples/arkode/C_parallel/CMakeLists.txt +++ b/examples/arkode/C_parallel/CMakeLists.txt @@ -14,26 +14,29 @@ # CMakeLists.txt file for ARKODE parallel C examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(ARKODE_examples - "ark_diurnal_kry_p\;\;1\;4\;exclude-single\;default" - "ark_diurnal_kry_bbd_p\;\;1\;4\;exclude-single\;default" - ) +set(ARKODE_examples "ark_diurnal_kry_p\;\;1\;4\;exclude-single\;default" + "ark_diurnal_kry_bbd_p\;\;1\;4\;exclude-single\;default") -if(SUNDIALS_PRECISION MATCHES "DOUBLE" AND - SUNDIALS_INDEX_SIZE MATCHES "64") +if(SUNDIALS_PRECISION MATCHES "DOUBLE" AND SUNDIALS_INDEX_SIZE MATCHES "64") - list(APPEND ARKODE_examples "ark_brusselator1D_task_local_nls\;--monitor\;1\;4\;develop\;2") - list(APPEND ARKODE_examples "ark_brusselator1D_task_local_nls\;--monitor --global-nls\;1\;4\;develop\;2") - list(APPEND ARKODE_examples "ark_brusselator1D_task_local_nls\;--monitor --explicit --tf 3\;1\;4\;develop\;2") + list(APPEND ARKODE_examples + "ark_brusselator1D_task_local_nls\;--monitor\;1\;4\;develop\;2") + list( + APPEND ARKODE_examples + "ark_brusselator1D_task_local_nls\;--monitor --global-nls\;1\;4\;develop\;2" + ) + list( + APPEND + ARKODE_examples + "ark_brusselator1D_task_local_nls\;--monitor --explicit --tf 3\;1\;4\;develop\;2" + ) # Auxiliary files to install - set(ARKODE_extras - "plot_brusselator1D.py" - ) + set(ARKODE_extras "plot_brusselator1D.py") endif() if(MPI_C_COMPILER) @@ -82,7 +85,8 @@ foreach(example_tuple ${ARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -96,12 +100,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel) endif() endforeach(example_tuple ${ARKODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -110,7 +113,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel) endforeach(extrafile ${ARKODE_extras}) # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -120,39 +124,32 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/C_parhyp/CMakeLists.txt b/examples/arkode/C_parhyp/CMakeLists.txt index 546e17a814..e4d8ebfff2 100644 --- a/examples/arkode/C_parhyp/CMakeLists.txt +++ b/examples/arkode/C_parhyp/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for ARKODE parhyp C examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(ARKODE_examples - "ark_diurnal_kry_ph.c\;1\;4\;develop" - ) +set(ARKODE_examples "ark_diurnal_kry_ph.c\;1\;4\;develop") # Add the build and install targets for each ARKODE example foreach(example_tuple ${ARKODE_examples}) @@ -39,13 +37,12 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - sundials_arkode - sundials_nvecparhyp - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example_target} sundials_arkode sundials_nvecparhyp + ${EXE_EXTRA_LINK_LIBS}) # add to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out @@ -53,25 +50,16 @@ foreach(example_tuple ${ARKODE_examples}) endforeach(example_tuple ${ARKODE_examples}) - if(EXAMPLES_INSTALL) - sundials_install_examples(arkode ARKODE_examples - CMAKE_TEMPLATE - cmakelists_C_MPI_ex.in - MAKE_TEMPLATE - makefile_parhyp_C_ex.in - SOLVER_LIBRARY - sundials_arkode - SUNDIALS_TARGETS - arkode - nvecparhyp - DESTINATION - arkode/C_parhyp - EXTRA_FILES - README - TEST_INSTALL - C_parhyp - ) + sundials_install_examples( + arkode ARKODE_examples + CMAKE_TEMPLATE cmakelists_C_MPI_ex.in + MAKE_TEMPLATE makefile_parhyp_C_ex.in + SOLVER_LIBRARY sundials_arkode + SUNDIALS_TARGETS arkode nvecparhyp + DESTINATION arkode/C_parhyp + EXTRA_FILES README + TEST_INSTALL C_parhyp) endif() diff --git a/examples/arkode/C_petsc/CMakeLists.txt b/examples/arkode/C_petsc/CMakeLists.txt index e62a4d57b6..cf32c23863 100644 --- a/examples/arkode/C_petsc/CMakeLists.txt +++ b/examples/arkode/C_petsc/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for ARKODE PETSc examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers if(BUILD_SUNNONLINSOL_PETSCSNES) - set(ARKODE_examples - "ark_petsc_ex25\;1\;1\;develop" - ) + set(ARKODE_examples "ark_petsc_ex25\;1\;1\;develop") endif() if(MPI_C_COMPILER) @@ -40,7 +38,8 @@ if(BUILD_SUNNONLINSOL_PETSCSNES) endif() # set-up linker flags and link libraries -set(SUNDIALS_LIBS ${ARKODE_LIB} ${NVECP_LIB} ${SUNNLS_LIB} ${EXE_EXTRA_LINK_LIBS}) +set(SUNDIALS_LIBS ${ARKODE_LIB} ${NVECP_LIB} ${SUNNLS_LIB} + ${EXE_EXTRA_LINK_LIBS}) # Add the build and install targets for each example foreach(example_tuple ${ARKODE_examples}) @@ -56,7 +55,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -72,12 +72,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_petsc) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_petsc) endif() endforeach(example_tuple ${ARKODE_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -90,39 +89,32 @@ if(EXAMPLES_INSTALL) examples2string(ARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_petsc - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_petsc) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_petsc/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_petsc - RENAME Makefile - ) + RENAME Makefile) endif() sundials_add_test_install(arkode C_petsc) diff --git a/examples/arkode/C_serial/CMakeLists.txt b/examples/arkode/C_serial/CMakeLists.txt index 5eca809665..86b7633bb4 100644 --- a/examples/arkode/C_serial/CMakeLists.txt +++ b/examples/arkode/C_serial/CMakeLists.txt @@ -15,106 +15,100 @@ # CMakeLists.txt file for ARKODE serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(ARKODE_examples - # tests that are always run - "ark_analytic\;\;" - # develop tests - "ark_analytic_mels\;\;develop" - "ark_analytic_nonlin\;\;develop" - "ark_brusselator_1D_mri\;\;develop" - "ark_brusselator_fp\;\;exclude-single" - "ark_brusselator_mri\;\;develop" - "ark_brusselator\;\;develop" - "ark_brusselator1D_imexmri\;0 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;2 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;3 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;4 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;5 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;6 0.001\;exclude-single" - "ark_brusselator1D_imexmri\;7 0.001\;exclude-single" - "ark_brusselator1D\;\;exclude-single" - "ark_conserved_exp_entropy_ark\;1 0\;develop" - "ark_conserved_exp_entropy_ark\;1 1\;develop" - "ark_conserved_exp_entropy_erk\;1\;develop" - "ark_damped_harmonic_symplectic\;\;exclude-single" - "ark_dissipated_exp_entropy\;1 0\;develop" - "ark_dissipated_exp_entropy\;1 1\;develop" - "ark_harmonic_symplectic\;\;exclude-single" - "ark_heat1D_adapt\;\;develop" - "ark_heat1D\;\;develop" - "ark_kepler\;--stepper ERK --step-mode adapt\;develop" - "ark_kepler\;--stepper ERK --step-mode fixed --count-orbits\;develop" - "ark_kepler\;--stepper SPRK --step-mode fixed --count-orbits --use-compensated-sums\;develop" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_EULER_1_1 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_LEAPFROG_2_2 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_2_2 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_3_3 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_4_4 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_5_6 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_PSEUDO_LEAPFROG_2_2 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_RUTH_3_3 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_YOSHIDA_6_8 --tf 50 --check-order --nout 1\;exclude-single" - "ark_kepler\;\;develop" - "ark_kpr_mri\;\;develop" - "ark_kpr_mri\;0 0.002\;develop" - "ark_kpr_mri\;1 0.002\;develop" - "ark_kpr_mri\;2 0.005\;develop" - "ark_kpr_mri\;3 0.01\;develop" - "ark_kpr_mri\;4 0.002\;develop" - "ark_kpr_mri\;5 0.002\;develop" - "ark_kpr_mri\;6 0.005\;develop" - "ark_kpr_mri\;7 0.001 -100 100 0.5 1\;exclude-single" - "ark_kpr_mri\;7 0.001\;exclude-single" - "ark_kpr_mri\;8 0.001 -100 100 0.5 1\;exclude-single" - "ark_kpr_mri\;8 0.001\;exclude-single" - "ark_kpr_mri\;9 0.001 -100 100 0.5 1\;exclude-single" - "ark_kpr_mri\;9 0.001\;exclude-single" - "ark_KrylovDemo_prec\;\;exclude-single" - "ark_KrylovDemo_prec\;1\;exclude-single" - "ark_KrylovDemo_prec\;2\;exclude-single" - "ark_onewaycouple_mri\;\;develop" - "ark_reaction_diffusion_mri\;\;develop" - "ark_robertson_constraints\;\;exclude-single" - "ark_robertson_root\;\;exclude-single" - "ark_robertson\;\;exclude-single" - "ark_twowaycouple_mri\;\;develop" - ) + # tests that are always run + "ark_analytic\;\;" + # develop tests + "ark_analytic_mels\;\;develop" + "ark_analytic_nonlin\;\;develop" + "ark_brusselator_1D_mri\;\;develop" + "ark_brusselator_fp\;\;exclude-single" + "ark_brusselator_mri\;\;develop" + "ark_brusselator\;\;develop" + "ark_brusselator1D_imexmri\;0 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;2 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;3 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;4 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;5 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;6 0.001\;exclude-single" + "ark_brusselator1D_imexmri\;7 0.001\;exclude-single" + "ark_brusselator1D\;\;exclude-single" + "ark_conserved_exp_entropy_ark\;1 0\;develop" + "ark_conserved_exp_entropy_ark\;1 1\;develop" + "ark_conserved_exp_entropy_erk\;1\;develop" + "ark_damped_harmonic_symplectic\;\;exclude-single" + "ark_dissipated_exp_entropy\;1 0\;develop" + "ark_dissipated_exp_entropy\;1 1\;develop" + "ark_harmonic_symplectic\;\;exclude-single" + "ark_heat1D_adapt\;\;develop" + "ark_heat1D\;\;develop" + "ark_kepler\;--stepper ERK --step-mode adapt\;develop" + "ark_kepler\;--stepper ERK --step-mode fixed --count-orbits\;develop" + "ark_kepler\;--stepper SPRK --step-mode fixed --count-orbits --use-compensated-sums\;develop" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_EULER_1_1 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_LEAPFROG_2_2 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_2_2 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_3_3 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_4_4 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_MCLACHLAN_5_6 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_PSEUDO_LEAPFROG_2_2 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_RUTH_3_3 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;--stepper SPRK --step-mode fixed --method ARKODE_SPRK_YOSHIDA_6_8 --tf 50 --check-order --nout 1\;exclude-single" + "ark_kepler\;\;develop" + "ark_kpr_mri\;\;develop" + "ark_kpr_mri\;0 0.002\;develop" + "ark_kpr_mri\;1 0.002\;develop" + "ark_kpr_mri\;2 0.005\;develop" + "ark_kpr_mri\;3 0.01\;develop" + "ark_kpr_mri\;4 0.002\;develop" + "ark_kpr_mri\;5 0.002\;develop" + "ark_kpr_mri\;6 0.005\;develop" + "ark_kpr_mri\;7 0.001 -100 100 0.5 1\;exclude-single" + "ark_kpr_mri\;7 0.001\;exclude-single" + "ark_kpr_mri\;8 0.001 -100 100 0.5 1\;exclude-single" + "ark_kpr_mri\;8 0.001\;exclude-single" + "ark_kpr_mri\;9 0.001 -100 100 0.5 1\;exclude-single" + "ark_kpr_mri\;9 0.001\;exclude-single" + "ark_KrylovDemo_prec\;\;exclude-single" + "ark_KrylovDemo_prec\;1\;exclude-single" + "ark_KrylovDemo_prec\;2\;exclude-single" + "ark_onewaycouple_mri\;\;develop" + "ark_reaction_diffusion_mri\;\;develop" + "ark_robertson_constraints\;\;exclude-single" + "ark_robertson_root\;\;exclude-single" + "ark_robertson\;\;exclude-single" + "ark_twowaycouple_mri\;\;develop") if(SUNDIALS_BUILD_WITH_MONITORING) list(APPEND ARKODE_examples "ark_brusselator_fp\;1\;exclude-single") endif() # Examples using KLU linear solver -set(ARKODE_examples_KLU - "ark_brusselator1D_klu\;develop" - ) +set(ARKODE_examples_KLU "ark_brusselator1D_klu\;develop") # Examples using SuperLU_MT linear solver -set(ARKODE_examples_SUPERLUMT - "ark_brusselator1D_FEM_slu\;exclude-single" - ) +set(ARKODE_examples_SUPERLUMT "ark_brusselator1D_FEM_slu\;exclude-single") # Auxiliary files to install set(ARKODE_extras - ark_analytic_nonlin_stats.csv - ark_damped_harmonic_symplectic.h - ark_harmonic_symplectic.h - ark_kepler_plot.py - ark_kepler.h - ark_reaction_diffusion_mri_fast_stats.csv - ark_reaction_diffusion_mri_slow_stats.csv - ark_robertson_stats.csv - plot_brusselator1D_FEM.py - plot_brusselator1D.py - plot_heat1D_adapt.py - plot_heat1D.py - plot_sol_log.py - plot_sol.py - ) + ark_analytic_nonlin_stats.csv + ark_damped_harmonic_symplectic.h + ark_harmonic_symplectic.h + ark_kepler_plot.py + ark_kepler.h + ark_reaction_diffusion_mri_fast_stats.csv + ark_reaction_diffusion_mri_slow_stats.csv + ark_robertson_stats.csv + plot_brusselator1D_FEM.py + plot_brusselator1D.py + plot_heat1D_adapt.py + plot_heat1D.py + plot_sol_log.py + plot_sol.py) # Add the build and install targets for each ARKODE example foreach(example_tuple ${ARKODE_examples}) @@ -124,7 +118,7 @@ foreach(example_tuple ${ARKODE_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - if (NOT TARGET ${example}) + if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -132,10 +126,8 @@ foreach(example_tuple ${ARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_arkode - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_arkode sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -146,7 +138,8 @@ foreach(example_tuple ${ARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -155,12 +148,11 @@ foreach(example_tuple ${ARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${test_name}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) endif() endforeach(example_tuple ${ARKODE_examples}) - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -176,29 +168,26 @@ if(BUILD_SUNLINSOL_KLU) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) # libraries to link against - target_link_libraries(${example} - sundials_arkode - sundials_nvecserial - sundials_sunlinsolklu - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_arkode sundials_nvecserial + sundials_sunlinsolklu ${EXE_EXTRA_LINK_LIBS}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) endif() endforeach(example_tuple ${ARKODE_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -214,29 +203,26 @@ if(BUILD_SUNLINSOL_SUPERLUMT) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) # libraries to link against - target_link_libraries(${example} - sundials_arkode - sundials_nvecserial - sundials_sunlinsolsuperlumt - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_arkode sundials_nvecserial + sundials_sunlinsolsuperlumt ${EXE_EXTRA_LINK_LIBS}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) endif() endforeach(example_tuple ${ARKODE_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -245,7 +231,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) endforeach(extrafile ${ARKODE_extras}) # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -262,7 +249,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(ARKODE_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -273,39 +260,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/C_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/C_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/F2003_custom/CMakeLists.txt b/examples/arkode/F2003_custom/CMakeLists.txt index 98abe2d887..e2392396bc 100644 --- a/examples/arkode/F2003_custom/CMakeLists.txt +++ b/examples/arkode/F2003_custom/CMakeLists.txt @@ -14,33 +14,25 @@ # CMakeLists.txt file for the ARKode F2003 custom module examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - set(FARKODE_examples - "ark_brusselator1D_f2003\;develop" - "ark_analytic_complex_f2003\;develop" - ) + set(FARKODE_examples "ark_brusselator1D_f2003\;develop" + "ark_analytic_complex_f2003\;develop") set(FARKODE_tests - "test_fnvector_complex_mod\;develop" - "test_fnvector_fortran_mod\;develop" - "test_fsunmatrix_fortran_mod\;develop" - "test_fsunlinsol_fortran_mod\;develop" - ) + "test_fnvector_complex_mod\;develop" "test_fnvector_fortran_mod\;develop" + "test_fsunmatrix_fortran_mod\;develop" + "test_fsunlinsol_fortran_mod\;develop") endif() # note the order matters when auto-generating the installed Makefile -set(FARKODEsources - fnvector_complex_mod.f90 - fnvector_fortran_mod.f90 - fsunmatrix_fortran_mod.f90 - fsunlinsol_fortran_mod.f90 - ) +set(FARKODEsources fnvector_complex_mod.f90 fnvector_fortran_mod.f90 + fsunmatrix_fortran_mod.f90 fsunlinsol_fortran_mod.f90) # Specify libraries to link against set(ARKODE_LIB sundials_arkode) @@ -57,7 +49,8 @@ foreach(example_tuple ${FARKODE_examples}) list(GET example_tuple 1 example_type) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90 ${FARKODEsources}) @@ -65,7 +58,8 @@ foreach(example_tuple ${FARKODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -73,10 +67,10 @@ foreach(example_tuple ${FARKODE_examples}) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out ${FARKODEsources} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) endif() endforeach(example_tuple ${FARKODE_examples}) @@ -89,7 +83,8 @@ foreach(example_tuple ${FARKODE_tests}) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90 ${FARKODEsources}) @@ -97,7 +92,8 @@ foreach(example_tuple ${FARKODE_tests}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS "" EXAMPLE_TYPE ${example_type} NODIFF) @@ -108,18 +104,18 @@ foreach(example_tuple ${FARKODE_tests}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${FARKODEsources} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) endif() endforeach(example_tuple ${FARKODE_tests}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -135,25 +131,22 @@ if(EXAMPLES_INSTALL) examples2string(FARKODEsources EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # remove file extensions from dependencies for generated Makefile @@ -162,15 +155,12 @@ if(EXAMPLES_INSTALL) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_custom/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_custom - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/F2003_parallel/CMakeLists.txt b/examples/arkode/F2003_parallel/CMakeLists.txt index 63c87909cf..e8065f43c8 100644 --- a/examples/arkode/F2003_parallel/CMakeLists.txt +++ b/examples/arkode/F2003_parallel/CMakeLists.txt @@ -15,31 +15,31 @@ # CMakeLists.txt file for the ARKode F2003 module parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases set(FARKODE_examples - "ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2" - "ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2" - "ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls_f2003\;--monitor\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls_f2003\;--monitor --global-nls\;1\;4\;develop\;2" + "ark_brusselator1D_task_local_nls_f2003\;--monitor --explicit --tf 3\;1\;4\;develop\;2" ) if(SUNDIALS_INDEX_SIZE MATCHES "64") - list(APPEND FARKODE_examples - "ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2" - "ark_diag_non_f2003\;\;1\;4\;develop\;2" - "ark_heat2D_f2003\;\;1\;4\;develop\;2") + list(APPEND FARKODE_examples "ark_diag_kry_bbd_f2003\;\;1\;4\;develop\;2" + "ark_diag_non_f2003\;\;1\;4\;develop\;2" + "ark_heat2D_f2003\;\;1\;4\;develop\;2") endif() # Set-up linker flags and link libraries -set(SUNDIALS_LIBS sundials_arkode - sundials_farkode_mod - sundials_nvecparallel - sundials_fnvecparallel_mod - sundials_nvecmpiplusx - sundials_fnvecmpiplusx_mod - sundials_nvecmpimanyvector - sundials_fnvecmpimanyvector_mod - ${EXE_EXTRA_LINK_LIBS}) +set(SUNDIALS_LIBS + sundials_arkode + sundials_farkode_mod + sundials_nvecparallel + sundials_fnvecparallel_mod + sundials_nvecmpiplusx + sundials_fnvecmpiplusx_mod + sundials_nvecmpimanyvector + sundials_fnvecmpimanyvector_mod + ${EXE_EXTRA_LINK_LIBS}) # Add the build and install targets for each example foreach(example_tuple ${FARKODE_examples}) @@ -54,7 +54,8 @@ foreach(example_tuple ${FARKODE_examples}) if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -73,7 +74,8 @@ foreach(example_tuple ${FARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -87,19 +89,18 @@ foreach(example_tuple ${FARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel) endif() endforeach(example_tuple ${FARKODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) install(FILES ${extrafile} - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -107,60 +108,55 @@ if(EXAMPLES_INSTALL) # Makefile: convert semi-colon separated target list to space separated string set(EXAMPLE_LIBS_LIST - sundials_farkode_mod - sundials_nvecparallel - sundials_fnvecparallel_mod - sundials_arkode - sundials_fnvecmpiplusx_mod - sundials_nvecmpiplusx - sundials_fnvecmpimanyvector_mod - sundials_nvecmpimanyvector - sundials_fcore_mod - sundials_core) + sundials_farkode_mod + sundials_nvecparallel + sundials_fnvecparallel_mod + sundials_arkode + sundials_fnvecmpiplusx_mod + sundials_nvecmpiplusx + sundials_fnvecmpimanyvector_mod + sundials_nvecmpimanyvector + sundials_fcore_mod + sundials_core) list2string(EXAMPLE_LIBS_LIST EXAMPLE_LIBS) # CMakeLists: replace sundials_ prefix and convert to space separted string - list(TRANSFORM EXAMPLE_LIBS_LIST REPLACE "sundials_" "SUNDIALS::" - OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) + list(TRANSFORM EXAMPLE_LIBS_LIST + REPLACE "sundials_" "SUNDIALS::" OUTPUT_VARIABLE + EXAMPLES_CMAKE_TARGETS_tmp) list2string(EXAMPLES_CMAKE_TARGETS_tmp EXAMPLES_CMAKE_TARGETS) examples2string(FARKODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/arkode/F2003_serial/CMakeLists.txt b/examples/arkode/F2003_serial/CMakeLists.txt index f755a4695b..bac936e149 100644 --- a/examples/arkode/F2003_serial/CMakeLists.txt +++ b/examples/arkode/F2003_serial/CMakeLists.txt @@ -15,22 +15,20 @@ # CMakeLists.txt file for the ARKode F2003 module serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases -set(FARKODE_examples - "ark_analytic_f2003\;\;develop" -) +set(FARKODE_examples "ark_analytic_f2003\;\;develop") # Regression tests -set(FARKODE_tests - "test_ark_butcher_f2003\;develop" -) +set(FARKODE_tests "test_ark_butcher_f2003\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - list(APPEND FARKODE_examples + list( + APPEND + FARKODE_examples "ark_bruss_f2003\;\;develop" "ark_diurnal_kry_bp_f2003\;\;develop" "ark_roberts_dns_f2003\;\;develop" @@ -44,16 +42,11 @@ if(SUNDIALS_INDEX_SIZE MATCHES "64") "ark_kpr_mri_f2003\;6 0.005\;develop" "ark_kpr_mri_f2003\;7 0.001\;develop" "ark_kpr_mri_f2003\;8 0.001\;develop" - "ark_kpr_mri_f2003\;9 0.001\;develop" - ) + "ark_kpr_mri_f2003\;9 0.001\;develop") - set(FARKODE_examples_KLU - "ark_bruss1D_FEM_klu_f2003\;develop" - ) + set(FARKODE_examples_KLU "ark_bruss1D_FEM_klu_f2003\;develop") - set(FARKODE_examples_LAPACK - "ark_roberts_dnsL_f2003\;\;develop" - ) + set(FARKODE_examples_LAPACK "ark_roberts_dnsL_f2003\;\;develop") endif() @@ -72,9 +65,10 @@ foreach(example_tuple ${FARKODE_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - if (NOT TARGET ${example}) + if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -94,7 +88,8 @@ foreach(example_tuple ${FARKODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -103,18 +98,15 @@ foreach(example_tuple ${FARKODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${test_name}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) endif() endforeach(example_tuple ${FARKODE_examples}) - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) # Sundials KLU linear solver module - set(SUNLINSOLKLU_LIBS - sundials_sunlinsolklu - sundials_fsunlinsolklu_mod) + set(SUNLINSOLKLU_LIBS sundials_sunlinsolklu sundials_fsunlinsolklu_mod) # KLU libraries list(APPEND SUNLINSOLKLU_LIBS) @@ -126,14 +118,16 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_type) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # create the cmake executable target add_executable(${example} ${example}.f90) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -144,21 +138,19 @@ if(BUILD_SUNLINSOL_KLU) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) endif() endforeach(example_tuple ${FARKODE_examples_KLU}) endif() - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackdense - sundials_fsunlinsollapackdense_mod) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackdense + sundials_fsunlinsollapackdense_mod) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -170,7 +162,8 @@ if(BUILD_SUNLINSOL_LAPACKDENSE) list(GET example_tuple 1 example_type) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -178,7 +171,8 @@ if(BUILD_SUNLINSOL_LAPACKDENSE) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -186,17 +180,16 @@ if(BUILD_SUNLINSOL_LAPACKDENSE) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) endif() endforeach(example_tuple ${FARKODE_examples_LAPACK}) endif() - # Add the build and install targets for regression test foreach(example_tuple ${FARKODE_tests}) @@ -205,7 +198,8 @@ foreach(example_tuple ${FARKODE_tests}) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -213,7 +207,8 @@ foreach(example_tuple ${FARKODE_tests}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS "" EXAMPLE_TYPE ${example_type} NODIFF) @@ -224,18 +219,18 @@ foreach(example_tuple ${FARKODE_tests}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) endif() endforeach(example_tuple ${FARKODE_tests}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -248,39 +243,33 @@ if(EXAMPLES_INSTALL) set(EXAMPLES "${EXAMPLES} ${TESTFILES}") # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/arkode/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/CMakeLists.txt b/examples/cvode/CMakeLists.txt index eab3a925e9..a7e76cef55 100644 --- a/examples/cvode/CMakeLists.txt +++ b/examples/cvode/CMakeLists.txt @@ -21,7 +21,9 @@ if(EXAMPLES_ENABLE_C) if(ENABLE_OPENMP AND OPENMP_FOUND) add_subdirectory(C_openmp) endif() - if(ENABLE_OPENMP_DEVICE AND OPENMP_FOUND AND OPENMP_SUPPORTS_DEVICE_OFFLOADING) + if(ENABLE_OPENMP_DEVICE + AND OPENMP_FOUND + AND OPENMP_SUPPORTS_DEVICE_OFFLOADING) add_subdirectory(C_openmpdev) endif() if(ENABLE_MPI AND MPI_C_FOUND) diff --git a/examples/cvode/CXX_onemkl/CMakeLists.txt b/examples/cvode/CXX_onemkl/CMakeLists.txt index db3d93f5c5..b586e70b06 100644 --- a/examples/cvode/CXX_onemkl/CMakeLists.txt +++ b/examples/cvode/CXX_onemkl/CMakeLists.txt @@ -12,12 +12,10 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases -set(CVODE_examples - "cvRoberts_blockdiag_onemkl.cpp\;\;develop" -) +set(CVODE_examples "cvRoberts_blockdiag_onemkl.cpp\;\;develop") # Add the build targets for each CVODE example foreach(example_tuple ${CVODE_examples}) @@ -30,7 +28,7 @@ foreach(example_tuple ${CVODE_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -39,14 +37,10 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_cvode - sundials_nvecsycl - sundials_sunlinsolonemkldense - MKL::MKL_DPCPP - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE sundials_cvode sundials_nvecsycl sundials_sunlinsolonemkldense + MKL::MKL_DPCPP ${EXE_EXTRA_LINK_LIBS}) endif() @@ -58,7 +52,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -69,17 +64,11 @@ endforeach() # Install the targets if(EXAMPLES_INSTALL) - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_TARGETS - cvode - nvecsycl - sunlinsolonemkldense - OTHER_TARGETS - MKL::MKL_DPCPP - DESTINATION - cvode/CXX_onemkl - ) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_TARGETS cvode nvecsycl sunlinsolonemkldense + OTHER_TARGETS MKL::MKL_DPCPP + DESTINATION cvode/CXX_onemkl) endif() diff --git a/examples/cvode/CXX_parallel/CMakeLists.txt b/examples/cvode/CXX_parallel/CMakeLists.txt index e325cd6d37..59c3419283 100644 --- a/examples/cvode/CXX_parallel/CMakeLists.txt +++ b/examples/cvode/CXX_parallel/CMakeLists.txt @@ -14,18 +14,14 @@ # CMakeLists.txt file for CVODE C++ parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cv_heat2D_p\;--np 2 2\;1\;4\;develop" - ) +set(CVODE_examples "cv_heat2D_p\;--np 2 2\;1\;4\;develop") # Auxiliary files to install -set(CVODE_extras - plot_heat2D_p.py - ) +set(CVODE_extras plot_heat2D_p.py) # Specify libraries to link against set(CVODE_LIB sundials_cvode) @@ -48,8 +44,8 @@ foreach(example_tuple ${CVODE_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cpp) @@ -69,7 +65,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -82,12 +79,11 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -96,7 +92,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -109,39 +106,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parallel - RENAME Makefile - ) + RENAME Makefile) endif(UNIX) # add test_install target diff --git a/examples/cvode/CXX_parhyp/CMakeLists.txt b/examples/cvode/CXX_parhyp/CMakeLists.txt index cef160eeee..5c18f590d1 100644 --- a/examples/cvode/CXX_parhyp/CMakeLists.txt +++ b/examples/cvode/CXX_parhyp/CMakeLists.txt @@ -14,19 +14,15 @@ # CMakeLists.txt file for CVODE C++ parhyp examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cv_heat2D_hypre_ls\;--np 2 2\;1\;4\;develop" - "cv_heat2D_hypre_pfmg\;--np 2 2\;1\;4\;develop" - ) +set(CVODE_examples "cv_heat2D_hypre_ls\;--np 2 2\;1\;4\;develop" + "cv_heat2D_hypre_pfmg\;--np 2 2\;1\;4\;develop") # Auxiliary files to install -set(CVODE_extras - plot_heat2D_p.py - ) +set(CVODE_extras plot_heat2D_p.py) # Specify libraries to link against set(CVODE_LIB sundials_cvode) @@ -49,8 +45,8 @@ foreach(example_tuple ${CVODE_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cpp) @@ -59,8 +55,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE - MPI::MPI_CXX ${SUNDIALS_LIBS} SUNDIALS::HYPRE) + target_link_libraries(${example} PRIVATE MPI::MPI_CXX ${SUNDIALS_LIBS} + SUNDIALS::HYPRE) endif() # check if example args are provided and set the test name @@ -71,7 +67,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -84,12 +81,11 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -98,7 +94,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -111,39 +108,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/CXX_parhyp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/CXX_parhyp - RENAME Makefile - ) + RENAME Makefile) endif(UNIX) # add test_install target diff --git a/examples/cvode/CXX_serial/CMakeLists.txt b/examples/cvode/CXX_serial/CMakeLists.txt index 428b5909fa..d48dd57cec 100644 --- a/examples/cvode/CXX_serial/CMakeLists.txt +++ b/examples/cvode/CXX_serial/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for CVODE C++ serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cv_heat2D.cpp\;\;\;\;exclude-single" - "cv_kpr.cpp\;\;\;\;develop" - ) +set(CVODE_examples "cv_heat2D.cpp\;\;\;\;exclude-single" + "cv_kpr.cpp\;\;\;\;develop") # Add the build and install targets for each example foreach(example_tuple ${CVODE_examples}) @@ -36,8 +34,8 @@ foreach(example_tuple ${CVODE_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -47,19 +45,14 @@ foreach(example_tuple ${CVODE_examples}) # directories to include target_include_directories(${example_target} - PRIVATE - ${PROJECT_SOURCE_DIR}/examples/utilities - ) + PRIVATE ${PROJECT_SOURCE_DIR}/examples/utilities) # libraries to link against - target_link_libraries(${example_target} - sundials_cvode - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example_target} sundials_cvode sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - target_link_libraries(${example_target} - sundials_cvode_fused_stubs) + target_link_libraries(${example_target} sundials_cvode_fused_stubs) endif() endif() @@ -71,7 +64,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -79,7 +73,6 @@ foreach(example_tuple ${CVODE_examples}) endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -87,23 +80,14 @@ if(EXAMPLES_INSTALL) set(_fused_stubs cvode_fused_stubs) endif() - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - MAKE_TEMPLATE - makefile_serial_CXX_ex.in - SUNDIALS_TARGETS - cvode - nvecserial - ${_fused_stubs} - DESTINATION - cvode/CXX_serial - EXTRA_FILES - README - plot_heat2D.py - "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" - TEST_INSTALL - CXX_serial - ) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_CXX_ex.in + MAKE_TEMPLATE makefile_serial_CXX_ex.in + SUNDIALS_TARGETS cvode nvecserial ${_fused_stubs} + DESTINATION cvode/CXX_serial + EXTRA_FILES README plot_heat2D.py + "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" + TEST_INSTALL CXX_serial) endif(EXAMPLES_INSTALL) diff --git a/examples/cvode/CXX_sycl/CMakeLists.txt b/examples/cvode/CXX_sycl/CMakeLists.txt index 67969b8d4d..35fcd18d2a 100644 --- a/examples/cvode/CXX_sycl/CMakeLists.txt +++ b/examples/cvode/CXX_sycl/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODE SYCL examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvAdvDiff_kry_sycl.cpp\;\;develop" - ) +set(CVODE_examples "cvAdvDiff_kry_sycl.cpp\;\;develop") # Add the build and install targets for each CVODE example foreach(example_tuple ${CVODE_examples}) @@ -33,7 +31,7 @@ foreach(example_tuple ${CVODE_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -42,11 +40,9 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} PRIVATE - sundials_cvode - sundials_nvecsycl - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} PRIVATE sundials_cvode sundials_nvecsycl + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -58,7 +54,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -66,17 +63,13 @@ foreach(example_tuple ${CVODE_examples}) endforeach() - # Install the targets if(EXAMPLES_INSTALL) - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_TARGETS - cvode - nvecsycl - DESTINATION - cvode/CXX_sycl) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_TARGETS cvode nvecsycl + DESTINATION cvode/CXX_sycl) endif() diff --git a/examples/cvode/C_mpimanyvector/CMakeLists.txt b/examples/cvode/C_mpimanyvector/CMakeLists.txt index 6ec51d724e..4a2feaf182 100644 --- a/examples/cvode/C_mpimanyvector/CMakeLists.txt +++ b/examples/cvode/C_mpimanyvector/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODE MPIManyVector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvDiurnal_kry_mpimanyvec\;2\;4\;develop" - ) +set(CVODE_examples "cvDiurnal_kry_mpimanyvec\;2\;4\;develop") if(MPI_C_COMPILER) set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) @@ -54,7 +52,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -70,17 +69,17 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector) + install(FILES README + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector) # Prepare substitution variables for Makefile and/or CMakeLists templates set(SOLVER "CVODE") @@ -92,39 +91,33 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_mpimanyvector/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_mpimanyvector - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/C_openmp/CMakeLists.txt b/examples/cvode/C_openmp/CMakeLists.txt index 88e1093b79..004dc50ffe 100644 --- a/examples/cvode/C_openmp/CMakeLists.txt +++ b/examples/cvode/C_openmp/CMakeLists.txt @@ -14,14 +14,13 @@ # CMakeLists.txt file for CVODE OpenMP examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvAdvDiff_bnd_omp\;4\;develop" - #"cvAdvDiffReac_kry_omp\;4\;develop" - ) +set(CVODE_examples "cvAdvDiff_bnd_omp\;4\;develop" + # "cvAdvDiffReac_kry_omp\;4\;develop" +) # Specify libraries to link against set(CVODE_LIB sundials_cvode) @@ -48,7 +47,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -60,12 +60,11 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmp) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -82,39 +81,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/C_openmpdev/CMakeLists.txt b/examples/cvode/C_openmpdev/CMakeLists.txt index 3899750ae4..78bd030836 100644 --- a/examples/cvode/C_openmpdev/CMakeLists.txt +++ b/examples/cvode/C_openmpdev/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODE OpenMPDEV examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvAdvDiff_kry_ompdev\;4\;develop" - ) +set(CVODE_examples "cvAdvDiff_kry_ompdev\;4\;develop") # Specify libraries to link against set(CVODE_LIB sundials_cvode) @@ -47,7 +45,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -59,12 +58,11 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmpdev) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmpdev) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -81,39 +79,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmpdev - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmpdev) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/C_openmpdev/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/C_openmpdev - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/F2003_parallel/CMakeLists.txt b/examples/cvode/F2003_parallel/CMakeLists.txt index e686e97fa3..997a83cbc1 100644 --- a/examples/cvode/F2003_parallel/CMakeLists.txt +++ b/examples/cvode/F2003_parallel/CMakeLists.txt @@ -15,21 +15,18 @@ # CMakeLists.txt file for the CVode F2003 module parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases if(SUNDIALS_INDEX_SIZE MATCHES "64") set(FCVODE_examples - "cv_diag_kry_bbd_f2003\;\;1\;4\;develop\;2" - "cv_diag_kry_f2003\;\;1\;4\;develop\;2" - "cv_diag_non_p_f2003\;\;1\;4\;develop\;2") + "cv_diag_kry_bbd_f2003\;\;1\;4\;develop\;2" + "cv_diag_kry_f2003\;\;1\;4\;develop\;2" + "cv_diag_non_p_f2003\;\;1\;4\;develop\;2") endif() # Specify libraries to link against -set(CVODE_LIBS - sundials_cvode - sundials_fcvode_mod - sundials_nvecparallel - sundials_fnvecparallel_mod) +set(CVODE_LIBS sundials_cvode sundials_fcvode_mod sundials_nvecparallel + sundials_fnvecparallel_mod) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${CVODE_LIBS} ${EXE_EXTRA_LINK_LIBS}) @@ -47,7 +44,8 @@ foreach(example_tuple ${FCVODE_examples}) if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -66,7 +64,8 @@ foreach(example_tuple ${FCVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -80,19 +79,18 @@ foreach(example_tuple ${FCVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel) endif() endforeach(example_tuple ${FCVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODE_extras}) install(FILES ${extrafile} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -103,45 +101,39 @@ if(EXAMPLES_INSTALL) # CMakeLists: replace sundials_ prefix and convert to space separted string list(TRANSFORM CVODE_LIBS REPLACE "sundials_" "SUNDIALS::" - OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) + OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) list2string(EXAMPLES_CMAKE_TARGETS_tmp EXAMPLES_CMAKE_TARGETS) examples2string(FCVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/F2003_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/F2003_serial/CMakeLists.txt b/examples/cvode/F2003_serial/CMakeLists.txt index 1a0458a11e..28d3e9db36 100644 --- a/examples/cvode/F2003_serial/CMakeLists.txt +++ b/examples/cvode/F2003_serial/CMakeLists.txt @@ -15,18 +15,18 @@ # CMakeLists.txt file for the FCVODE serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(FCVODE_examples - "cv_advdiff_bnd_f2003\;develop" - ) +set(FCVODE_examples "cv_advdiff_bnd_f2003\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - list(APPEND FCVODE_examples + list( + APPEND + FCVODE_examples "cv_analytic_fp_f2003\;develop" "cv_analytic_sys_dns_f2003\;develop" "cv_analytic_sys_dns_jac_f2003\;develop" @@ -34,18 +34,13 @@ if(SUNDIALS_INDEX_SIZE MATCHES "64") "cv_diurnal_kry_f2003\;develop" "cv_diurnal_kry_bp_f2003\;develop" "cv_roberts_dns_constraints_f2003\;develop" - "cv_roberts_dns_f2003\;develop" - ) + "cv_roberts_dns_f2003\;develop") - set(FCVODE_examples_LAPACK - "cv_roberts_dnsL_f2003\;develop" - ) + set(FCVODE_examples_LAPACK "cv_roberts_dnsL_f2003\;develop") # Examples using KLU linear solver - set(FCVODE_examples_KLU - "cv_analytic_sys_klu_f2003\;develop" - "cv_roberts_klu_f2003\;develop" - ) + set(FCVODE_examples_KLU "cv_analytic_sys_klu_f2003\;develop" + "cv_roberts_klu_f2003\;develop") endif() @@ -67,7 +62,8 @@ foreach(example_tuple ${FCVODE_examples}) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -75,7 +71,8 @@ foreach(example_tuple ${FCVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -83,10 +80,10 @@ foreach(example_tuple ${FCVODE_examples}) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS} ${EXE_EXTRA_LINK_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) endif() endforeach(example_tuple ${FCVODE_examples}) @@ -103,7 +100,8 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -111,7 +109,8 @@ if(BUILD_SUNLINSOL_KLU) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -119,10 +118,10 @@ if(BUILD_SUNLINSOL_KLU) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) endif() endforeach(example_tuple ${FCVODE_examples_KLU}) @@ -133,9 +132,8 @@ endif() if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackdense - sundials_fsunlinsollapackdense_mod) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackdense + sundials_fsunlinsollapackdense_mod) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -152,7 +150,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -160,10 +159,10 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) endif() endforeach(example_tuple ${FCVODE_examples_LAPACK}) @@ -194,39 +193,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/cuda/CMakeLists.txt b/examples/cvode/cuda/CMakeLists.txt index ecf39d378f..aeb2587f14 100644 --- a/examples/cvode/cuda/CMakeLists.txt +++ b/examples/cvode/cuda/CMakeLists.txt @@ -16,22 +16,17 @@ # CMakeLists.txt file for CVODE CUDA examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(CVODE_examples - "cvAdvDiff_kry_cuda\;\;develop" - "cvAdvDiff_kry_cuda_managed\;\;develop" - "cvAdvDiff_diag_cuda\;0 0\;develop" - "cvAdvDiff_diag_cuda\;0 1\;develop" - "cvAdvDiff_diag_cuda\;1 1\;develop" - ) + "cvAdvDiff_kry_cuda\;\;develop" "cvAdvDiff_kry_cuda_managed\;\;develop" + "cvAdvDiff_diag_cuda\;0 0\;develop" "cvAdvDiff_diag_cuda\;0 1\;develop" + "cvAdvDiff_diag_cuda\;1 1\;develop") # Examples using cuSolverSP linear solvers -set(CVODE_examples_cusolver - "cvRoberts_block_cusolversp_batchqr\;\;develop" -) +set(CVODE_examples_cusolver "cvRoberts_block_cusolversp_batchqr\;\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "32") set(all_examples "${CVODE_examples_cusolver}") @@ -42,9 +37,7 @@ endif() list(APPEND all_examples "${CVODE_examples}") # Specify libraries to link against -set(SUNDIALS_LIBS ${SUNDIALS_LIBS} - sundials_cvode - sundials_nveccuda) +set(SUNDIALS_LIBS ${SUNDIALS_LIBS} sundials_cvode sundials_nveccuda) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) set(SUNDIALS_LIBS ${SUNDIALS_LIBS} sundials_cvode_fused_cuda) @@ -61,9 +54,10 @@ foreach(example_tuple ${all_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - set_source_files_properties(${example}.cu PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) + set_source_files_properties(${example}.cu + PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) - if (NOT TARGET ${example}) + if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cu) @@ -71,7 +65,8 @@ foreach(example_tuple ${all_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE ${SUNDIALS_LIBS} ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} PRIVATE ${SUNDIALS_LIBS} + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -82,7 +77,8 @@ foreach(example_tuple ${all_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -91,11 +87,10 @@ foreach(example_tuple ${all_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cu ${test_name}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/cuda) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/cuda) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -119,39 +114,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/cuda/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/cuda/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/cuda/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/cuda - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/cuda/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/cuda) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/cuda/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/cuda/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/cuda/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/cuda - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/ginkgo/CMakeLists.txt b/examples/cvode/ginkgo/CMakeLists.txt index 5d1e706371..adaebb7b0c 100644 --- a/examples/cvode/ginkgo/CMakeLists.txt +++ b/examples/cvode/ginkgo/CMakeLists.txt @@ -15,18 +15,18 @@ # Example lists are tuples "name\;args\;type" # Examples that support CPU and GPU Ginkgo backends -set(cpu_gpu_examples - "cv_heat2D_ginkgo.cpp\;\;develop") +set(cpu_gpu_examples "cv_heat2D_ginkgo.cpp\;\;develop") -sundials_add_examples_ginkgo(cpu_gpu_examples +sundials_add_examples_ginkgo( + cpu_gpu_examples TARGETS sundials_cvode BACKENDS REF OMP CUDA HIP SYCL) # Examples that only support CPU Ginkgo backends -set(cpu_examples - "cv_kpr_ginkgo.cpp\;\;develop") +set(cpu_examples "cv_kpr_ginkgo.cpp\;\;develop") -sundials_add_examples_ginkgo(cpu_examples +sundials_add_examples_ginkgo( + cpu_examples TARGETS sundials_cvode BACKENDS REF OMP) @@ -42,25 +42,18 @@ if(EXAMPLES_INSTALL) if(SUNDIALS_GINKGO_BACKENDS MATCHES "SYCL") list(APPEND vectors nvecsycl) endif() - if((SUNDIALS_GINKGO_BACKENDS MATCHES "OMP") OR - (SUNDIALS_GINKGO_BACKENDS MATCHES "REF")) + if((SUNDIALS_GINKGO_BACKENDS MATCHES "OMP") OR (SUNDIALS_GINKGO_BACKENDS + MATCHES "REF")) list(APPEND vectors nvecserial) endif() - sundials_install_examples_ginkgo(cvode - CPU_EXAMPLES_VAR - cpu_examples - CPU_GPU_EXAMPLES_VAR - cpu_gpu_examples - SUNDIALS_COMPONENTS - cvode - ${vectors} - SUNDIALS_TARGETS - cvode - EXTRA_FILES - "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" - DESTINATION - cvode/ginkgo - ) + sundials_install_examples_ginkgo( + cvode + CPU_EXAMPLES_VAR cpu_examples + CPU_GPU_EXAMPLES_VAR cpu_gpu_examples + SUNDIALS_COMPONENTS cvode ${vectors} + SUNDIALS_TARGETS cvode + EXTRA_FILES "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" + DESTINATION cvode/ginkgo) endif() diff --git a/examples/cvode/hip/CMakeLists.txt b/examples/cvode/hip/CMakeLists.txt index 8de1bb3721..18427801b1 100644 --- a/examples/cvode/hip/CMakeLists.txt +++ b/examples/cvode/hip/CMakeLists.txt @@ -14,21 +14,17 @@ # CMakeLists.txt file for CVODE HIP examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(all_examples - "cvAdvDiff_kry_hip.cpp\;\;develop" - "cvAdvDiff_diag_hip.cpp\;0 0\;develop" - "cvAdvDiff_diag_hip.cpp\;0 1\;develop" - "cvAdvDiff_diag_hip.cpp\;1 1\;develop" - ) + "cvAdvDiff_kry_hip.cpp\;\;develop" "cvAdvDiff_diag_hip.cpp\;0 0\;develop" + "cvAdvDiff_diag_hip.cpp\;0 1\;develop" + "cvAdvDiff_diag_hip.cpp\;1 1\;develop") # Specify libraries to link against -set(SUNDIALS_LIBS - sundials_cvode - sundials_nvechip) +set(SUNDIALS_LIBS sundials_cvode sundials_nvechip) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) set(SUNDIALS_LIBS ${SUNDIALS_LIBS} sundials_cvode_fused_hip) @@ -48,7 +44,7 @@ foreach(example_tuple ${all_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -56,7 +52,9 @@ foreach(example_tuple ${all_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} PRIVATE hip::device ${SUNDIALS_LIBS} ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} PRIVATE hip::device ${SUNDIALS_LIBS} + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -67,31 +65,27 @@ foreach(example_tuple ${all_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out EXAMPLE_TYPE ${example_type}) endforeach(example_tuple ${all_examples}) - # Install the targets if(EXAMPLES_INSTALL) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) set(_fused_kernels_if_enabled cvode_fused_hip) else() - set(_fused_kernels_if_enabled ) + set(_fused_kernels_if_enabled) endif() - sundials_install_examples(cvode all_examples - CMAKE_TEMPLATE - cmakelists_HIP_ex.in - SUNDIALS_TARGETS - cvode - nvechip - ${_fused_kernels_if_enabled} - DESTINATION - cvode/hip) + sundials_install_examples( + cvode all_examples + CMAKE_TEMPLATE cmakelists_HIP_ex.in + SUNDIALS_TARGETS cvode nvechip ${_fused_kernels_if_enabled} + DESTINATION cvode/hip) endif() diff --git a/examples/cvode/kokkos/CMakeLists.txt b/examples/cvode/kokkos/CMakeLists.txt index c5c1cd4d19..533d3bf630 100644 --- a/examples/cvode/kokkos/CMakeLists.txt +++ b/examples/cvode/kokkos/CMakeLists.txt @@ -12,12 +12,10 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases -set(examples_list - "cv_bruss_batched_kokkos.cpp\;\;develop" - "cv_bruss_batched_kokkos_2D.cpp\;\;develop" -) +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases +set(examples_list "cv_bruss_batched_kokkos.cpp\;\;develop" + "cv_bruss_batched_kokkos_2D.cpp\;\;develop") # Add the build targets for each example foreach(example_tuple ${examples_list}) @@ -32,7 +30,7 @@ foreach(example_tuple ${examples_list}) get_filename_component(example_target ${example} NAME_WE) set(example_target "${example_target}.${backend}") - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -44,23 +42,19 @@ foreach(example_tuple ${examples_list}) target_compile_definitions(${example_target} PRIVATE USE_${backend}) # directories to include - target_include_directories(${example_target} - PRIVATE - "${PROJECT_SOURCE_DIR}/examples/utilities") + target_include_directories( + ${example_target} PRIVATE "${PROJECT_SOURCE_DIR}/examples/utilities") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_cvode - sundials_nveckokkos - sundials_sunmatrixkokkosdense - sundials_sunlinsolkokkosdense - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE sundials_cvode sundials_nveckokkos + sundials_sunmatrixkokkosdense sundials_sunlinsolkokkosdense + ${EXE_EXTRA_LINK_LIBS}) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - target_link_libraries(${example_target} PRIVATE - sundials_cvode_fused_stubs) + target_link_libraries(${example_target} + PRIVATE sundials_cvode_fused_stubs) endif() endif() @@ -72,7 +66,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXTRA_ARGS --kokkos-disable-warnings ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -89,22 +84,12 @@ if(EXAMPLES_INSTALL) set(_fused_stubs cvode_fused_stubs) endif() - sundials_install_examples(cvode examples_list - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_COMPONENTS - nveckokkos - sunmatrixkokkosdense - sunlinsolkokkosdense - SUNDIALS_TARGETS - cvode - ${_fused_stubs} - OTHER_TARGETS - Kokkos::kokkos - Kokkos::kokkoskernels - EXTRA_FILES - "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" - DESTINATION - cvode/kokkos - ) + sundials_install_examples( + cvode examples_list + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_COMPONENTS nveckokkos sunmatrixkokkosdense sunlinsolkokkosdense + SUNDIALS_TARGETS cvode ${_fused_stubs} + OTHER_TARGETS Kokkos::kokkos Kokkos::kokkoskernels + EXTRA_FILES "${PROJECT_SOURCE_DIR}/examples/utilities/example_utilities.hpp" + DESTINATION cvode/kokkos) endif() diff --git a/examples/cvode/magma/CMakeLists.txt b/examples/cvode/magma/CMakeLists.txt index 55e81a8f6b..756205e83c 100644 --- a/examples/cvode/magma/CMakeLists.txt +++ b/examples/cvode/magma/CMakeLists.txt @@ -12,12 +12,10 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases -set(CVODE_examples - "cv_bruss_batched_magma.cpp\;\;develop" -) +set(CVODE_examples "cv_bruss_batched_magma.cpp\;\;develop") if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") set(vector nveccuda) @@ -38,7 +36,7 @@ foreach(example_tuple ${CVODE_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") set_source_files_properties(${example} PROPERTIES LANGUAGE CUDA) @@ -53,13 +51,10 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_cvode - sundials_${vector} - sundials_sunlinsolmagmadense - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE sundials_cvode sundials_${vector} sundials_sunlinsolmagmadense + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -70,7 +65,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -81,15 +77,10 @@ endforeach(example_tuple ${CVODE_examples}) # Install the targets if(EXAMPLES_INSTALL) - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_${cuda_or_hip}_ex.in - SUNDIALS_TARGETS - cvode - ${vector} - sunlinsolmagmadense - DESTINATION - cvode/magma - ) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_${cuda_or_hip}_ex.in + SUNDIALS_TARGETS cvode ${vector} sunlinsolmagmadense + DESTINATION cvode/magma) endif() diff --git a/examples/cvode/parallel/CMakeLists.txt b/examples/cvode/parallel/CMakeLists.txt index 598feb1f8c..1f3239f22f 100644 --- a/examples/cvode/parallel/CMakeLists.txt +++ b/examples/cvode/parallel/CMakeLists.txt @@ -14,16 +14,15 @@ # CMakeLists.txt file for CVODE parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(CVODE_examples - "cvAdvDiff_diag_p\;2\;4\;exclude-single" - "cvAdvDiff_non_p\;2\;2\;exclude-single" - "cvDiurnal_kry_bbd_p\;2\;4\;exclude-sigle" - "cvDiurnal_kry_p\;2\;4\;exclude-single" - ) + "cvAdvDiff_diag_p\;2\;4\;exclude-single" + "cvAdvDiff_non_p\;2\;2\;exclude-single" + "cvDiurnal_kry_bbd_p\;2\;4\;exclude-sigle" + "cvDiurnal_kry_p\;2\;4\;exclude-single") if(MPI_C_COMPILER) set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) @@ -57,7 +56,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -73,12 +73,11 @@ foreach(example_tuple ${CVODE_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/parallel) endif() endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -95,39 +94,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/parhyp/CMakeLists.txt b/examples/cvode/parhyp/CMakeLists.txt index 043133a4ca..9571c36ae5 100644 --- a/examples/cvode/parhyp/CMakeLists.txt +++ b/examples/cvode/parhyp/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODE parhyp examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvAdvDiff_non_ph.c\;2\;2\;develop" - ) +set(CVODE_examples "cvAdvDiff_non_ph.c\;2\;2\;develop") if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) set(_fused_stubs sundials_cvode_fused_stubs) @@ -44,15 +42,13 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_cvode - sundials_nvecparhyp - ${_fused_stubs} - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} PRIVATE sundials_cvode sundials_nvecparhyp + ${_fused_stubs} ${EXE_EXTRA_LINK_LIBS}) # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out @@ -60,7 +56,6 @@ foreach(example_tuple ${CVODE_examples}) endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -69,23 +64,14 @@ if(EXAMPLES_INSTALL) set(LIBS "-lsundials_cvode_fused_stubs ${LIBS}") endif() - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_C_MPI_ex.in - MAKE_TEMPLATE - makefile_parhyp_C_ex.in - SOLVER_LIBRARY - sundials_cvode - SUNDIALS_TARGETS - cvode - nvecparhyp - ${_fused_stubs_target} - DESTINATION - cvode/parhyp - EXTRA_FILES - README - TEST_INSTALL - parhyp - ) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_C_MPI_ex.in + MAKE_TEMPLATE makefile_parhyp_C_ex.in + SOLVER_LIBRARY sundials_cvode + SUNDIALS_TARGETS cvode nvecparhyp ${_fused_stubs_target} + DESTINATION cvode/parhyp + EXTRA_FILES README + TEST_INSTALL parhyp) endif() diff --git a/examples/cvode/petsc/CMakeLists.txt b/examples/cvode/petsc/CMakeLists.txt index 52def46e9e..0525f8f0e4 100644 --- a/examples/cvode/petsc/CMakeLists.txt +++ b/examples/cvode/petsc/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for CVODE PETSc examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cv_petsc_ex7\;1\;1\;develop" - "cvAdvDiff_petsc\;1\;4\;develop" - ) +set(CVODE_examples "cv_petsc_ex7\;1\;1\;develop" + "cvAdvDiff_petsc\;1\;4\;develop") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -57,7 +55,8 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -73,12 +72,11 @@ foreach(example_tuple ${CVODE_examples}) # install example if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/petsc) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/petsc) endif() endforeach(example_tuple ${CVODE_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -94,39 +92,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODE_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/petsc/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/petsc/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/petsc/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/petsc - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/petsc/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/petsc) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/petsc/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/petsc/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/petsc/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/petsc - RENAME Makefile - ) + RENAME Makefile) endif() sundials_add_test_install(cvode petsc) diff --git a/examples/cvode/raja/CMakeLists.txt b/examples/cvode/raja/CMakeLists.txt index 2c2e64319b..1cbc5d13ca 100644 --- a/examples/cvode/raja/CMakeLists.txt +++ b/examples/cvode/raja/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODE RAJA examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODE_examples - "cvAdvDiff_kry_raja.cpp\;develop" - ) +set(CVODE_examples "cvAdvDiff_kry_raja.cpp\;develop") # Add source directory to include directories include_directories(.) @@ -57,23 +55,19 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_cvode - sundials_nvecraja - ${_fused_stubs} - ${EXE_EXTRA_LINK_LIBS} - ${OTHER_LIBS}) + target_link_libraries( + ${example_target} PRIVATE sundials_cvode sundials_nvecraja ${_fused_stubs} + ${EXE_EXTRA_LINK_LIBS} ${OTHER_LIBS}) # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out EXAMPLE_TYPE ${example_type}) endforeach(example_tuple ${CVODE_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -82,34 +76,26 @@ if(EXAMPLES_INSTALL) set(LIBS "-lsundials_cvode_fused_stubs ${LIBS}") endif() - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") set(_openmp_target OpenMP::OpenMP_CXX) endif() if(RAJA_NEEDS_THREADS) - set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") + set(EXAMPLES_FIND_PACKAGE + "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() - sundials_install_examples(cvode CVODE_examples - CMAKE_TEMPLATE - cmakelists_${_lang}_ex.in - MAKE_TEMPLATE - makefile_serial_RAJA_ex.in - SOLVER_LIBRARY - sundials_cvode - SUNDIALS_TARGETS - cvode - nvecraja - ${_fused_stubs_target} - OTHER_TARGETS - ${_openmp_target} - DESTINATION - cvode/raja - EXTRA_FILES - README - TEST_INSTALL - raja - ) + sundials_install_examples( + cvode CVODE_examples + CMAKE_TEMPLATE cmakelists_${_lang}_ex.in + MAKE_TEMPLATE makefile_serial_RAJA_ex.in + SOLVER_LIBRARY sundials_cvode + SUNDIALS_TARGETS cvode nvecraja ${_fused_stubs_target} + OTHER_TARGETS ${_openmp_target} + DESTINATION cvode/raja + EXTRA_FILES README + TEST_INSTALL raja) endif() diff --git a/examples/cvode/serial/CMakeLists.txt b/examples/cvode/serial/CMakeLists.txt index 71abd3cf91..be033dce06 100644 --- a/examples/cvode/serial/CMakeLists.txt +++ b/examples/cvode/serial/CMakeLists.txt @@ -15,57 +15,46 @@ # CMakeLists.txt file for CVODE serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(CVODE_examples - "cvAdvDiff_bnd\;\;develop" - "cvAnalytic_mels\;\;develop" - "cvDirectDemo_ls\;\;develop" - "cvDisc_dns\;\;develop" - "cvDiurnal_kry_bp\;\;develop" - "cvDiurnal_kry\;\;develop" - "cvKrylovDemo_ls\;\;develop" - "cvKrylovDemo_ls\;1\;develop" - "cvKrylovDemo_ls\;2\;develop" - "cvKrylovDemo_prec\;\;develop" - "cvParticle_dns\;\;develop" - "cvPendulum_dns\;\;exclude-single" - "cvRoberts_dns\;\;" - "cvRoberts_dns_constraints\;\;develop" - "cvRoberts_dns_negsol\;\;exclude-single" - "cvRoberts_dns_uw\;\;develop" - "cvRocket_dns\;\;develop" - ) + "cvAdvDiff_bnd\;\;develop" + "cvAnalytic_mels\;\;develop" + "cvDirectDemo_ls\;\;develop" + "cvDisc_dns\;\;develop" + "cvDiurnal_kry_bp\;\;develop" + "cvDiurnal_kry\;\;develop" + "cvKrylovDemo_ls\;\;develop" + "cvKrylovDemo_ls\;1\;develop" + "cvKrylovDemo_ls\;2\;develop" + "cvKrylovDemo_prec\;\;develop" + "cvParticle_dns\;\;develop" + "cvPendulum_dns\;\;exclude-single" + "cvRoberts_dns\;\;" + "cvRoberts_dns_constraints\;\;develop" + "cvRoberts_dns_negsol\;\;exclude-single" + "cvRoberts_dns_uw\;\;develop" + "cvRocket_dns\;\;develop") if(SUNDIALS_BUILD_WITH_MONITORING) list(APPEND CVODE_examples "cvKrylovDemo_ls\;0 1\;develop") endif() # Examples using LAPACK linear solvers -set(CVODE_examples_BL - "cvAdvDiff_bndL\;\;exclude-single" - "cvRoberts_dnsL\;\;exclude-single" - ) +set(CVODE_examples_BL "cvAdvDiff_bndL\;\;exclude-single" + "cvRoberts_dnsL\;\;exclude-single") # Examples using KLU linear solver -set(CVODE_examples_KLU - "cvRoberts_block_klu\;\;develop" - "cvRoberts_klu\;\;develop" - ) +set(CVODE_examples_KLU "cvRoberts_block_klu\;\;develop" + "cvRoberts_klu\;\;develop") # Examples using SuperLU_MT linear solver -set(CVODE_examples_SUPERLUMT - "cvRoberts_sps\;\;develop" - ) +set(CVODE_examples_SUPERLUMT "cvRoberts_sps\;\;develop") # Auxiliary files to install -set(CVODE_extras - plot_cvParticle.py - plot_cvPendulum.py - cvRoberts_dns_stats.csv - ) +set(CVODE_extras plot_cvParticle.py plot_cvPendulum.py cvRoberts_dns_stats.csv) # Specify libraries to link against set(CVODE_LIB sundials_cvode) @@ -86,8 +75,8 @@ foreach(example_tuple ${CVODE_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -107,7 +96,8 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -119,19 +109,17 @@ foreach(example_tuple ${CVODE_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) endif() endforeach(example_tuple ${CVODE_examples}) - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackband + sundials_sunlinsollapackdense) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -143,8 +131,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -164,7 +152,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -176,14 +165,13 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) endif() endforeach(example_tuple ${CVODE_examples_BL}) endif() - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -200,8 +188,8 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -221,7 +209,8 @@ if(BUILD_SUNLINSOL_KLU) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -233,14 +222,13 @@ if(BUILD_SUNLINSOL_KLU) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) endif() endforeach(example_tuple ${CVODE_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -257,8 +245,8 @@ if(BUILD_SUNLINSOL_SUPERLUMT) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -277,13 +265,14 @@ if(BUILD_SUNLINSOL_SUPERLUMT) string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) endif() - # Do not include SuperLUMT examples in testing when the indextype is int64_t. - # Answer files were generated with int32_t and minor differences in output - # occur causing a false positive when testing. These tests can be re-enabled - # when type specific answer files are added. + # Do not include SuperLUMT examples in testing when the indextype is + # int64_t. Answer files were generated with int32_t and minor differences in + # output occur causing a false positive when testing. These tests can be + # re-enabled when type specific answer files are added. if(SUNDIALS_INDEX_SIZE MATCHES "32") # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -296,14 +285,13 @@ if(BUILD_SUNLINSOL_SUPERLUMT) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) endif() endforeach(example_tuple ${CVODE_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -312,7 +300,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -338,7 +327,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(CVODE_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -349,39 +338,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvode/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvode/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvode/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvode/superludist/CMakeLists.txt b/examples/cvode/superludist/CMakeLists.txt index a6ec3ad259..d0c25e651c 100644 --- a/examples/cvode/superludist/CMakeLists.txt +++ b/examples/cvode/superludist/CMakeLists.txt @@ -14,8 +14,8 @@ # CMakeLists.txt file for CVODE SuperLU_DIST examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;type" where the type is develop +# for examples excluded from 'make test' in releases list(APPEND CVODE_examples "cvAdvDiff_sludist.cpp\;2 1\;2\;develop") @@ -41,7 +41,10 @@ foreach(example_tuple ${CVODE_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") if(SUNDIALS_INDEX_SIZE STREQUAL "32") - set(integer_precision "15") # superlu-dist seems to result in more output variability (maybe due to a bug with 32-bit indices?) + set(integer_precision "15") + + # superlu-dist seems to result in more output variability (maybe due to a + # bug with 32-bit indices?) set(float_precision "3") else() set(integer_precision "default") @@ -49,24 +52,21 @@ foreach(example_tuple ${CVODE_examples}) endif() # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_nodes} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}_${SUNDIALS_INDEX_SIZE}.out EXAMPLE_TYPE ${example_type} INTEGER_PRECISION ${integer_precision} - FLOAT_PRECISION ${float_precision} - ) + FLOAT_PRECISION ${float_precision}) # libraries to link against - target_link_libraries(${example_target} PRIVATE - MPI::MPI_CXX - sundials_cvode - sundials_nvecparallel - sundials_sunlinsolsuperludist - ${_fused_lib} - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE MPI::MPI_CXX sundials_cvode sundials_nvecparallel + sundials_sunlinsolsuperludist ${_fused_lib} ${EXE_EXTRA_LINK_LIBS}) endforeach(example_tuple ${CVODE_examples}) @@ -81,18 +81,12 @@ endif() # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - sundials_install_examples(cvode_superludist CVODE_examples - EXTRA_FILES - README - CMAKE_TEMPLATE - cmakelists_${_ex_lang}_MPI_ex.in - SUNDIALS_TARGETS - cvode - nvecparallel - sunlinsolsuperludist - DESTINATION - cvode/superludist - ) + sundials_install_examples( + cvode_superludist CVODE_examples + EXTRA_FILES README + CMAKE_TEMPLATE cmakelists_${_ex_lang}_MPI_ex.in + SUNDIALS_TARGETS cvode nvecparallel sunlinsolsuperludist + DESTINATION cvode/superludist) # add test_install target sundials_add_test_install(cvode superludist) diff --git a/examples/cvodes/CMakeLists.txt b/examples/cvodes/CMakeLists.txt index bb57f3e400..58dacdd293 100644 --- a/examples/cvodes/CMakeLists.txt +++ b/examples/cvodes/CMakeLists.txt @@ -27,4 +27,4 @@ endif() if(BUILD_FORTRAN_MODULE_INTERFACE AND EXAMPLES_ENABLE_F2003) add_subdirectory(F2003_serial) -endif() \ No newline at end of file +endif() diff --git a/examples/cvodes/C_openmp/CMakeLists.txt b/examples/cvodes/C_openmp/CMakeLists.txt index 02fab6bb9f..cc344d5e07 100644 --- a/examples/cvodes/C_openmp/CMakeLists.txt +++ b/examples/cvodes/C_openmp/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for CVODES OpenMP examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(CVODES_examples_OMP - "cvsAdvDiff_bnd_omp\;4\;develop" - ) +set(CVODES_examples_OMP "cvsAdvDiff_bnd_omp\;4\;develop") # Specify libraries to link against set(CVODES_LIB sundials_cvodes) @@ -37,8 +35,8 @@ foreach(example_tuple ${CVODES_examples_OMP}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -51,7 +49,8 @@ foreach(example_tuple ${CVODES_examples_OMP}) endif() # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -60,12 +59,11 @@ foreach(example_tuple ${CVODES_examples_OMP}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp) endif() endforeach(example_tuple ${CVODES_examples_OMP}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -74,7 +72,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODES_extras_OMP}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -84,39 +83,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODES_examples_OMP EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvodes/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvodes/F2003_serial/CMakeLists.txt b/examples/cvodes/F2003_serial/CMakeLists.txt index 5e5bac8953..aa175b2a93 100644 --- a/examples/cvodes/F2003_serial/CMakeLists.txt +++ b/examples/cvodes/F2003_serial/CMakeLists.txt @@ -14,12 +14,12 @@ # CMakeLists.txt file for the F2003 CVODES serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases set(FCVODES_examples - "cvs_analytic_fp_f2003\;\;develop" - "cvsAdvDiff_FSA_non_f2003\;-sensi stg t\;develop" - "cvsAdvDiff_FSA_non_f2003\;-sensi sim t\;develop") + "cvs_analytic_fp_f2003\;\;develop" + "cvsAdvDiff_FSA_non_f2003\;-sensi stg t\;develop" + "cvsAdvDiff_FSA_non_f2003\;-sensi sim t\;develop") # Specify libraries to link against set(CVODES_LIB sundials_fcvodes_mod) @@ -34,11 +34,12 @@ foreach(example_tuple ${FCVODES_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -58,7 +59,8 @@ foreach(example_tuple ${FCVODES_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -67,10 +69,10 @@ foreach(example_tuple ${FCVODES_examples}) # find all .out files for this example file(GLOB example_out ${example}*.out) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/F2003_serial) endif() endforeach(example_tuple ${FCVODES_examples}) @@ -85,39 +87,33 @@ if(EXAMPLES_INSTALL) examples2string(FCVODES_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/F2003_serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvodes/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvodes/parallel/CMakeLists.txt b/examples/cvodes/parallel/CMakeLists.txt index dc985978ce..1a1ede9689 100644 --- a/examples/cvodes/parallel/CMakeLists.txt +++ b/examples/cvodes/parallel/CMakeLists.txt @@ -14,21 +14,20 @@ # CMakeLists.txt file for CVODES parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(CVODES_examples - "cvsAdvDiff_ASAp_non_p\;\;2\;2\;exclude-single" - "cvsAdvDiff_FSA_non_p\;-sensi stg t\;2\;2\;exclude-single" - "cvsAdvDiff_FSA_non_p\;-sensi sim t\;2\;2\;exclude-single" - "cvsAdvDiff_non_p\;\;2\;2\;exclude-single" - "cvsAtmDisp_ASAi_kry_bbd_p\;\;2\;4\;exclude-single" - "cvsDiurnal_FSA_kry_p\;-sensi stg t\;2\;4\;exclude-single" - "cvsDiurnal_FSA_kry_p\;-sensi sim t\;2\;4\;exclude-single" - "cvsDiurnal_kry_bbd_p\;\;2\;4\;exclude-single" - "cvsDiurnal_kry_p\;\;2\;4\;exclude-single" - ) + "cvsAdvDiff_ASAp_non_p\;\;2\;2\;exclude-single" + "cvsAdvDiff_FSA_non_p\;-sensi stg t\;2\;2\;exclude-single" + "cvsAdvDiff_FSA_non_p\;-sensi sim t\;2\;2\;exclude-single" + "cvsAdvDiff_non_p\;\;2\;2\;exclude-single" + "cvsAtmDisp_ASAi_kry_bbd_p\;\;2\;4\;exclude-single" + "cvsDiurnal_FSA_kry_p\;-sensi stg t\;2\;4\;exclude-single" + "cvsDiurnal_FSA_kry_p\;-sensi sim t\;2\;4\;exclude-single" + "cvsDiurnal_kry_bbd_p\;\;2\;4\;exclude-single" + "cvsDiurnal_kry_p\;\;2\;4\;exclude-single") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -45,7 +44,6 @@ set(NVECP_LIB sundials_nvecparallel) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${CVODES_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${CVODES_examples}) @@ -56,8 +54,8 @@ foreach(example_tuple ${CVODES_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -81,7 +79,8 @@ foreach(example_tuple ${CVODES_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -94,12 +93,11 @@ foreach(example_tuple ${CVODES_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/parallel) endif() endforeach(example_tuple ${CVODES_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -113,39 +111,32 @@ if(EXAMPLES_INSTALL) examples2string(CVODES_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvodes/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/cvodes/serial/CMakeLists.txt b/examples/cvodes/serial/CMakeLists.txt index 48cfb72f99..4089accc24 100644 --- a/examples/cvodes/serial/CMakeLists.txt +++ b/examples/cvodes/serial/CMakeLists.txt @@ -15,76 +15,69 @@ # CMakeLists.txt file for CVODES serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(CVODES_examples - "cvsAdvDiff_ASAi_bnd\;\;develop" - "cvsAdvDiff_FSA_non\;-sensi sim t\;exclude-single" - "cvsAdvDiff_FSA_non\;-sensi stg t\;exclude-single" - "cvsAdvDiff_bnd\;\;develop" - "cvsAnalytic_mels\;\;develop" - "cvsDirectDemo_ls\;\;develop" - "cvsDiurnal_FSA_kry\;-sensi sim t\;exclude-single" - "cvsDiurnal_FSA_kry\;-sensi stg t\;exclude-single" - "cvsDiurnal_kry\;\;develop" - "cvsDiurnal_kry_bp\;\;develop" - "cvsFoodWeb_ASAi_kry\;\;develop" - "cvsFoodWeb_ASAp_kry\;\;develop" - "cvsHessian_ASA_FSA\;\;exclude-single" - "cvsKrylovDemo_ls\;\;develop" - "cvsKrylovDemo_ls\;1\;develop" - "cvsKrylovDemo_ls\;2\;develop" - "cvsKrylovDemo_prec\;\;develop" - "cvsParticle_dns\;\;develop" - "cvsPendulum_dns\;\;exclude-single" - "cvsRoberts_ASAi_dns\;\;exclude-single" - "cvsRoberts_ASAi_dns_constraints\;\;develop" - "cvsRoberts_FSA_dns\;-sensi sim t\;exclude-single" - "cvsRoberts_FSA_dns\;-sensi stg1 t\;exclude-single" - "cvsRoberts_FSA_dns_Switch\;\;exclude-single" - "cvsRoberts_FSA_dns_constraints\;-sensi stg1 t\;exclude-single" - "cvsRoberts_dns\;\;" - "cvsRoberts_dns_constraints\;\;develop" - "cvsRoberts_dns_uw\;\;develop" - ) + "cvsAdvDiff_ASAi_bnd\;\;develop" + "cvsAdvDiff_FSA_non\;-sensi sim t\;exclude-single" + "cvsAdvDiff_FSA_non\;-sensi stg t\;exclude-single" + "cvsAdvDiff_bnd\;\;develop" + "cvsAnalytic_mels\;\;develop" + "cvsDirectDemo_ls\;\;develop" + "cvsDiurnal_FSA_kry\;-sensi sim t\;exclude-single" + "cvsDiurnal_FSA_kry\;-sensi stg t\;exclude-single" + "cvsDiurnal_kry\;\;develop" + "cvsDiurnal_kry_bp\;\;develop" + "cvsFoodWeb_ASAi_kry\;\;develop" + "cvsFoodWeb_ASAp_kry\;\;develop" + "cvsHessian_ASA_FSA\;\;exclude-single" + "cvsKrylovDemo_ls\;\;develop" + "cvsKrylovDemo_ls\;1\;develop" + "cvsKrylovDemo_ls\;2\;develop" + "cvsKrylovDemo_prec\;\;develop" + "cvsParticle_dns\;\;develop" + "cvsPendulum_dns\;\;exclude-single" + "cvsRoberts_ASAi_dns\;\;exclude-single" + "cvsRoberts_ASAi_dns_constraints\;\;develop" + "cvsRoberts_FSA_dns\;-sensi sim t\;exclude-single" + "cvsRoberts_FSA_dns\;-sensi stg1 t\;exclude-single" + "cvsRoberts_FSA_dns_Switch\;\;exclude-single" + "cvsRoberts_FSA_dns_constraints\;-sensi stg1 t\;exclude-single" + "cvsRoberts_dns\;\;" + "cvsRoberts_dns_constraints\;\;develop" + "cvsRoberts_dns_uw\;\;develop") if(SUNDIALS_BUILD_WITH_MONITORING) list(APPEND CVODE_examples "cvsKrylovDemo_ls\;0 1\;develop") endif() # Examples using LAPACK linear solvers -set(CVODES_examples_BL - "cvsAdvDiff_bndL\;\;exclude-single" - "cvsRoberts_dnsL\;\;exclude-single" - ) +set(CVODES_examples_BL "cvsAdvDiff_bndL\;\;exclude-single" + "cvsRoberts_dnsL\;\;exclude-single") # Examples using KLU linear solver set(CVODES_examples_KLU - "cvsRoberts_ASAi_klu\;\;develop" - "cvsRoberts_FSA_klu\;-sensi stg1 t\;develop" - "cvsRoberts_klu\;\;develop" - ) + "cvsRoberts_ASAi_klu\;\;develop" + "cvsRoberts_FSA_klu\;-sensi stg1 t\;develop" "cvsRoberts_klu\;\;develop") # Examples using SuperLU_MT linear solver set(CVODES_examples_SUPERLUMT - "cvsRoberts_ASAi_sps\;\;exclude-single" - "cvsRoberts_FSA_sps\;-sensi stg1 t\;exclude-single" - "cvsRoberts_sps\;\;develop" - ) + "cvsRoberts_ASAi_sps\;\;exclude-single" + "cvsRoberts_FSA_sps\;-sensi stg1 t\;exclude-single" + "cvsRoberts_sps\;\;develop") # Auxiliary files to install set(CVODES_extras - plot_cvsParticle.py - plot_cvsPendulum.py - cvsRoberts_ASAi_dns_bkw1_stats.csv - cvsRoberts_ASAi_dns_bkw2_stats.csv - cvsRoberts_ASAi_dns_fwd_stats.csv - cvsRoberts_dns_stats.csv - cvsRoberts_FSA_dns_stats_-sensi_sim_t.csv - cvsRoberts_FSA_dns_stats_-sensi_stg1_t.csv - ) + plot_cvsParticle.py + plot_cvsPendulum.py + cvsRoberts_ASAi_dns_bkw1_stats.csv + cvsRoberts_ASAi_dns_bkw2_stats.csv + cvsRoberts_ASAi_dns_fwd_stats.csv + cvsRoberts_dns_stats.csv + cvsRoberts_FSA_dns_stats_-sensi_sim_t.csv + cvsRoberts_FSA_dns_stats_-sensi_stg1_t.csv) # Specify libraries to link against set(CVODES_LIB sundials_cvodes) @@ -101,8 +94,8 @@ foreach(example_tuple ${CVODES_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -122,7 +115,8 @@ foreach(example_tuple ${CVODES_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -134,19 +128,17 @@ foreach(example_tuple ${CVODES_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) endif() endforeach(example_tuple ${CVODES_examples}) - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackband + sundials_sunlinsollapackdense) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -158,8 +150,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -179,7 +171,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -191,14 +184,13 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) endif() endforeach(example_tuple ${CVODES_examples_BL}) endif() - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -215,8 +207,8 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -236,7 +228,8 @@ if(BUILD_SUNLINSOL_KLU) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -248,14 +241,13 @@ if(BUILD_SUNLINSOL_KLU) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) endif() endforeach(example_tuple ${CVODES_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -272,8 +264,8 @@ if(BUILD_SUNLINSOL_SUPERLUMT) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -292,13 +284,14 @@ if(BUILD_SUNLINSOL_SUPERLUMT) string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) endif() - # Do not include SuperLUMT examples in testing when the indextype is int32_t. - # Answer files were generated with int64_t and minor differences in output - # occur causing a false positive when testing. These tests can be re-enabled - # when type specific answer files are added. + # Do not include SuperLUMT examples in testing when the indextype is + # int32_t. Answer files were generated with int64_t and minor differences in + # output occur causing a false positive when testing. These tests can be + # re-enabled when type specific answer files are added. if(SUNDIALS_INDEX_SIZE MATCHES "64") # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -311,14 +304,13 @@ if(BUILD_SUNLINSOL_SUPERLUMT) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) endif() endforeach(example_tuple ${CVODES_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -327,7 +319,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${CVODES_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -350,7 +343,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(CVODES_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -361,39 +354,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvodes/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/cvodes/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/cvodes/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/cvodes/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/cvodes/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/cvodes/serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/CMakeLists.txt b/examples/ida/CMakeLists.txt index 60b3867f90..c018807336 100644 --- a/examples/ida/CMakeLists.txt +++ b/examples/ida/CMakeLists.txt @@ -33,7 +33,9 @@ endif() if(EXAMPLES_ENABLE_CXX) if(ENABLE_RAJA AND RAJA_FOUND) add_subdirectory(raja) - if(ENABLE_MPI AND MPI_C_FOUND AND (SUNDIALS_RAJA_BACKENDS MATCHES "CUDA")) + if(ENABLE_MPI + AND MPI_C_FOUND + AND (SUNDIALS_RAJA_BACKENDS MATCHES "CUDA")) add_subdirectory(mpiraja) endif() endif() diff --git a/examples/ida/C_openmp/CMakeLists.txt b/examples/ida/C_openmp/CMakeLists.txt index bd5632d0c0..6fcf691c6e 100644 --- a/examples/ida/C_openmp/CMakeLists.txt +++ b/examples/ida/C_openmp/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for IDA OpenMP examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDA_examples - "idaFoodWeb_bnd_omp\;4\;develop" - "idaFoodWeb_kry_omp\;4\;develop" - ) +set(IDA_examples "idaFoodWeb_bnd_omp\;4\;develop" + "idaFoodWeb_kry_omp\;4\;develop") # Specify libraries to link against set(IDA_LIB sundials_ida) @@ -43,9 +41,10 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") - if (NOT ${example} MATCHES "idaFoodWeb_kry_omp") + if(NOT ${example} MATCHES "idaFoodWeb_kry_omp") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -58,12 +57,11 @@ foreach(example_tuple ${IDA_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/C_openmp) endif() endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -77,39 +75,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/F2003_openmp/CMakeLists.txt b/examples/ida/F2003_openmp/CMakeLists.txt index 63fb888572..77a99633c0 100644 --- a/examples/ida/F2003_openmp/CMakeLists.txt +++ b/examples/ida/F2003_openmp/CMakeLists.txt @@ -15,15 +15,13 @@ # CMakeLists.txt file for the F2003 IDA OpenMP examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - set(FIDA_examples_OMP - "idaHeat2D_kry_omp_f2003.f90\;4\;exclude" - "idaHeat2D_kry_omp_f2003.f90\;8\;exclude" - ) + set(FIDA_examples_OMP "idaHeat2D_kry_omp_f2003.f90\;4\;exclude" + "idaHeat2D_kry_omp_f2003.f90\;8\;exclude") endif() # Specify libraries to link against @@ -48,15 +46,13 @@ foreach(example_tuple ${FIDA_examples_OMP}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_ida - sundials_fida_mod - sundials_nvecopenmp - sundials_fnvecopenmp_mod - ${SUNDIALS_LIBS}) + target_link_libraries( + ${example} sundials_ida sundials_fida_mod sundials_nvecopenmp + sundials_fnvecopenmp_mod ${SUNDIALS_LIBS}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) endif() @@ -68,7 +64,8 @@ foreach(example_tuple ${FIDA_examples_OMP}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -77,7 +74,7 @@ foreach(example_tuple ${FIDA_examples_OMP}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${test_name}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_openmp) endif() endforeach(example_tuple ${FIDA_examples_OMP}) @@ -92,39 +89,32 @@ if(EXAMPLES_INSTALL) examples2string(FIDA_examples_OMP EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/F2003_parallel/CMakeLists.txt b/examples/ida/F2003_parallel/CMakeLists.txt index af50a152e3..afaea82c5f 100644 --- a/examples/ida/F2003_parallel/CMakeLists.txt +++ b/examples/ida/F2003_parallel/CMakeLists.txt @@ -15,19 +15,15 @@ # CMakeLists.txt file for the IDA F2003 module parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases if(SUNDIALS_INDEX_SIZE MATCHES "64") - set(FIDA_examples - "ida_heat2D_kry_bbd_f2003\;\;1\;4\;develop\;2") + set(FIDA_examples "ida_heat2D_kry_bbd_f2003\;\;1\;4\;develop\;2") endif() # Specify libraries to link against -set(IDA_LIBS - sundials_ida - sundials_fida_mod - sundials_nvecparallel - sundials_fnvecparallel_mod) +set(IDA_LIBS sundials_ida sundials_fida_mod sundials_nvecparallel + sundials_fnvecparallel_mod) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${IDA_LIBS} ${EXE_EXTRA_LINK_LIBS}) @@ -45,7 +41,8 @@ foreach(example_tuple ${FIDA_examples}) if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -64,7 +61,8 @@ foreach(example_tuple ${FIDA_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -78,19 +76,18 @@ foreach(example_tuple ${FIDA_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel) endif() endforeach(example_tuple ${FIDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${IDA_extras}) install(FILES ${extrafile} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -101,45 +98,38 @@ if(EXAMPLES_INSTALL) # CMakeLists: replace sundials_ prefix and convert to space separted string list(TRANSFORM IDA_LIBS REPLACE "sundials_" "SUNDIALS::" - OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) + OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) list2string(EXAMPLES_CMAKE_TARGETS_tmp EXAMPLES_CMAKE_TARGETS) examples2string(FIDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/F2003_serial/CMakeLists.txt b/examples/ida/F2003_serial/CMakeLists.txt index 107b423e41..8d0ddb1e75 100644 --- a/examples/ida/F2003_serial/CMakeLists.txt +++ b/examples/ida/F2003_serial/CMakeLists.txt @@ -14,19 +14,15 @@ # CMakeLists.txt file for the F2003 IDA serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(FIDA_examples - "idaRoberts_dns_f2003\;develop" -) +set(FIDA_examples "idaRoberts_dns_f2003\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - list(APPEND FIDA_examples - "idaHeat2D_kry_f2003\;develop" - ) + list(APPEND FIDA_examples "idaHeat2D_kry_f2003\;develop") endif() # Specify libraries to link against @@ -42,7 +38,8 @@ foreach(example_tuple ${FIDA_examples}) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -50,7 +47,8 @@ foreach(example_tuple ${FIDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -58,10 +56,10 @@ foreach(example_tuple ${FIDA_examples}) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_serial) endif() endforeach(example_tuple ${FIDA_examples}) @@ -76,39 +74,32 @@ if(EXAMPLES_INSTALL) examples2string(FIDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/cuda/CMakeLists.txt b/examples/ida/cuda/CMakeLists.txt index cc420c0721..81c74e96df 100644 --- a/examples/ida/cuda/CMakeLists.txt +++ b/examples/ida/cuda/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for IDA CUDA examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDA_examples - "idaHeat2D_kry_cuda\;develop" - ) +set(IDA_examples "idaHeat2D_kry_cuda\;develop") # Add source directory to include directories include_directories(.) @@ -39,7 +37,8 @@ foreach(example_tuple ${IDA_examples}) list(GET example_tuple 0 example) list(GET example_tuple 1 example_type) - set_source_files_properties(${example}.cu PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) + set_source_files_properties(${example}.cu + PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) # add example source files add_executable(${example} ${example}.cu) @@ -47,7 +46,8 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -58,12 +58,11 @@ foreach(example_tuple ${IDA_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cu ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/cuda) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/cuda) endif() endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -78,39 +77,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/cuda/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/cuda/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/cuda/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/cuda - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/cuda/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/cuda) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/cuda/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/cuda/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/cuda/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/cuda - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/mpicuda/CMakeLists.txt b/examples/ida/mpicuda/CMakeLists.txt index ff3129ba28..fb01b8b3b6 100644 --- a/examples/ida/mpicuda/CMakeLists.txt +++ b/examples/ida/mpicuda/CMakeLists.txt @@ -14,12 +14,11 @@ # CMakeLists.txt file for IDA CUDA examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDA_examples - "idaHeat2D_kry_p_mpicuda\;1\;4\;develop") +set(IDA_examples "idaHeat2D_kry_p_mpicuda\;1\;4\;develop") # Specify libraries to link against set(IDA_LIB sundials_ida) @@ -37,7 +36,8 @@ foreach(example_tuple ${IDA_examples}) list(GET example_tuple 2 number_of_tasks) list(GET example_tuple 3 example_type) - set_source_files_properties(${example}.cu PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) + set_source_files_properties(${example}.cu + PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) # add example source files add_executable(${example} ${example}.cu) @@ -45,25 +45,24 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) # libraries to link against - target_link_libraries(${example} PRIVATE - MPI::MPI_CXX ${SUNDIALS_LIBS}) + target_link_libraries(${example} PRIVATE MPI::MPI_CXX ${SUNDIALS_LIBS}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cu ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/mpicuda) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/mpicuda) endif() endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -77,39 +76,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/mpicuda - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/mpicuda) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/mpicuda/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/mpicuda - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/mpiraja/CMakeLists.txt b/examples/ida/mpiraja/CMakeLists.txt index ede0737c54..9db66e0922 100644 --- a/examples/ida/mpiraja/CMakeLists.txt +++ b/examples/ida/mpiraja/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for IDA raja examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDA_examples - "idaHeat2D_kry_p_mpiraja.cpp\;1\;4\;develop" - ) +set(IDA_examples "idaHeat2D_kry_p_mpiraja.cpp\;1\;4\;develop") if(SUNDIALS_RAJA_BACKENDS MATCHES "CUDA") set(_lang CUDA) @@ -54,17 +52,14 @@ foreach(example_tuple ${IDA_examples}) target_include_directories(${example_target} PUBLIC ${MPI_CXX_INCLUDE_DIRS}) # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_ida - sundials_nvecmpiplusx - sundials_nvecraja - ${MPI_CXX_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS} - ${OTHER_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE sundials_ida sundials_nvecmpiplusx sundials_nvecraja + ${MPI_CXX_LIBRARIES} ${EXE_EXTRA_LINK_LIBS} ${OTHER_LIBS}) # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out @@ -72,38 +67,29 @@ foreach(example_tuple ${IDA_examples}) endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") set(_openmp_target OpenMP::OpenMP_CXX) endif() if(RAJA_NEEDS_THREADS) - set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") + set(EXAMPLES_FIND_PACKAGE + "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() - sundials_install_examples(ida IDA_examples - CMAKE_TEMPLATE - cmakelists_${_lang}_MPI_ex.in - MAKE_TEMPLATE - makefile_parallel_RAJA_ex.in - SOLVER_LIBRARY - sundials_ida - SUNDIALS_TARGETS - ida - nvecmpiplusx - nvecraja - OTHER_TARGETS - ${_openmp_target} - DESTINATION - ida/mpiraja - EXTRA_FILES - README - TEST_INSTALL - mpiraja - ) + sundials_install_examples( + ida IDA_examples + CMAKE_TEMPLATE cmakelists_${_lang}_MPI_ex.in + MAKE_TEMPLATE makefile_parallel_RAJA_ex.in + SOLVER_LIBRARY sundials_ida + SUNDIALS_TARGETS ida nvecmpiplusx nvecraja + OTHER_TARGETS ${_openmp_target} + DESTINATION ida/mpiraja + EXTRA_FILES README + TEST_INSTALL mpiraja) endif() diff --git a/examples/ida/parallel/CMakeLists.txt b/examples/ida/parallel/CMakeLists.txt index 726502d5f9..0eff8ed069 100644 --- a/examples/ida/parallel/CMakeLists.txt +++ b/examples/ida/parallel/CMakeLists.txt @@ -14,16 +14,15 @@ # CMakeLists.txt file for IDA parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(IDA_examples - "idaFoodWeb_kry_bbd_p\;1\;4\;exclude-single" - "idaFoodWeb_kry_p\;1\;4\;exclude-single" - "idaHeat2D_kry_bbd_p\;1\;4\;exclude-single" - "idaHeat2D_kry_p\;1\;4\;exclude-single" - ) + "idaFoodWeb_kry_bbd_p\;1\;4\;exclude-single" + "idaFoodWeb_kry_p\;1\;4\;exclude-single" + "idaHeat2D_kry_bbd_p\;1\;4\;exclude-single" + "idaHeat2D_kry_p\;1\;4\;exclude-single") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -54,7 +53,8 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -70,12 +70,11 @@ foreach(example_tuple ${IDA_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/parallel) endif() endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -89,39 +88,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/petsc/CMakeLists.txt b/examples/ida/petsc/CMakeLists.txt index d75471d8c4..098ce24569 100644 --- a/examples/ida/petsc/CMakeLists.txt +++ b/examples/ida/petsc/CMakeLists.txt @@ -14,17 +14,16 @@ # CMakeLists.txt file for IDA PETSc examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args;\nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args;\nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(IDA_examples - "idaHeat2D_petsc_spgmr\;\;1\;4\;develop" - "idaHeat2D_petsc_snes\;\;1\;4\;develop" - "idaHeat2D_petsc_snes\;-pre\;1\;4\;develop" - "idaHeat2D_petsc_snes\;-jac\;1\;4\;develop" - "idaHeat2D_petsc_snes\;-jac -pre\;1\;4\;develop" - ) + "idaHeat2D_petsc_spgmr\;\;1\;4\;develop" + "idaHeat2D_petsc_snes\;\;1\;4\;develop" + "idaHeat2D_petsc_snes\;-pre\;1\;4\;develop" + "idaHeat2D_petsc_snes\;-jac\;1\;4\;develop" + "idaHeat2D_petsc_snes\;-jac -pre\;1\;4\;develop") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -51,8 +50,8 @@ foreach(example_tuple ${IDA_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) add_executable(${example} ${example}.c) @@ -75,7 +74,8 @@ foreach(example_tuple ${IDA_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -88,12 +88,11 @@ foreach(example_tuple ${IDA_examples}) # install example if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/petsc) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/petsc) endif() endforeach(example_tuple ${IDA_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -106,39 +105,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/petsc/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/petsc/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/petsc/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/petsc - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/petsc/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/petsc) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/petsc/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/petsc/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/petsc/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/petsc - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/raja/CMakeLists.txt b/examples/ida/raja/CMakeLists.txt index 2117b9c1bc..98ea198a79 100644 --- a/examples/ida/raja/CMakeLists.txt +++ b/examples/ida/raja/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for IDA raja examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDA_examples - "idaHeat2D_kry_raja.cpp\;develop" - ) +set(IDA_examples "idaHeat2D_kry_raja.cpp\;develop") # Add source directory to include directories include_directories(.) @@ -53,52 +51,42 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_ida - sundials_nvecraja - ${EXE_EXTRA_LINK_LIBS} - ${OTHER_LIBS}) + target_link_libraries( + ${example_target} PRIVATE sundials_ida sundials_nvecraja + ${EXE_EXTRA_LINK_LIBS} ${OTHER_LIBS}) # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out EXAMPLE_TYPE ${example_type}) endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") set(_openmp_target OpenMP::OpenMP_CXX) endif() if(RAJA_NEEDS_THREADS) - set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") + set(EXAMPLES_FIND_PACKAGE + "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() - sundials_install_examples(ida IDA_examples - CMAKE_TEMPLATE - cmakelists_${_lang}_ex.in - MAKE_TEMPLATE - makefile_serial_RAJA_ex.in - SOLVER_LIBRARY - sundials_ida - SUNDIALS_TARGETS - ida - nvecraja - OTHER_TARGETS - ${_openmp_target} - DESTINATION - ida/raja - EXTRA_FILES - README - TEST_INSTALL - raja - ) + sundials_install_examples( + ida IDA_examples + CMAKE_TEMPLATE cmakelists_${_lang}_ex.in + MAKE_TEMPLATE makefile_serial_RAJA_ex.in + SOLVER_LIBRARY sundials_ida + SUNDIALS_TARGETS ida nvecraja + OTHER_TARGETS ${_openmp_target} + DESTINATION ida/raja + EXTRA_FILES README + TEST_INSTALL raja) endif() diff --git a/examples/ida/serial/CMakeLists.txt b/examples/ida/serial/CMakeLists.txt index e11c3fd56a..809c6be76d 100644 --- a/examples/ida/serial/CMakeLists.txt +++ b/examples/ida/serial/CMakeLists.txt @@ -15,43 +15,36 @@ # CMakeLists.txt file for IDA serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(IDA_examples - "idaAnalytic_mels\;\;exclude-single" - "idaFoodWeb_bnd\;\;develop" - "idaFoodWeb_kry\;\;develop" - "idaHeat2D_bnd\;\;develop" - "idaHeat2D_kry\;\;develop" - "idaKrylovDemo_ls\;\;develop" - "idaKrylovDemo_ls\;1\;develop" - "idaKrylovDemo_ls\;2\;develop" - "idaRoberts_dns\;\;" - "idaSlCrank_dns\;\;exclude-single" - ) + "idaAnalytic_mels\;\;exclude-single" + "idaFoodWeb_bnd\;\;develop" + "idaFoodWeb_kry\;\;develop" + "idaHeat2D_bnd\;\;develop" + "idaHeat2D_kry\;\;develop" + "idaKrylovDemo_ls\;\;develop" + "idaKrylovDemo_ls\;1\;develop" + "idaKrylovDemo_ls\;2\;develop" + "idaRoberts_dns\;\;" + "idaSlCrank_dns\;\;exclude-single") # Examples using LAPACK linear solvers -set(IDA_examples_BL - ) +set(IDA_examples_BL) # Examples using KLU linear solver -set(IDA_examples_KLU - "idaHeat2D_klu\;\;develop" - "idaRoberts_klu\;\;develop" - ) +set(IDA_examples_KLU "idaHeat2D_klu\;\;develop" "idaRoberts_klu\;\;develop") # Examples using SuperLU_MT linear solver set(IDA_examples_SUPERLUMT "idaRoberts_sps\;\;develop" - #"idaHeat2D_sps\;develop" # not ready yet, incorrect answer. - ) + # "idaHeat2D_sps\;develop" # not ready yet, incorrect answer. +) # Auxiliary files to install -set(IDA_extras - idaRoberts_dns_stats.csv - ) +set(IDA_extras idaRoberts_dns_stats.csv) # Specify libraries to link against set(IDA_LIB sundials_ida) @@ -68,8 +61,8 @@ foreach(example_tuple ${IDA_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -89,7 +82,8 @@ foreach(example_tuple ${IDA_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -101,19 +95,17 @@ foreach(example_tuple ${IDA_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) endif() endforeach(example_tuple ${IDA_examples}) - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackband + sundials_sunlinsollapackdense) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -125,8 +117,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -146,7 +138,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -158,14 +151,13 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) endif() endforeach(example_tuple ${IDA_examples_BL}) endif() - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -182,8 +174,8 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -203,7 +195,8 @@ if(BUILD_SUNLINSOL_KLU) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -215,14 +208,13 @@ if(BUILD_SUNLINSOL_KLU) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) endif() endforeach(example_tuple ${IDA_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -239,8 +231,8 @@ if(BUILD_SUNLINSOL_SUPERLUMT) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -259,13 +251,14 @@ if(BUILD_SUNLINSOL_SUPERLUMT) string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) endif() - # Do not include SuperLUMT examples in testing when the indextype is int64_t. - # Answer files were generated with int32_t and minor differences in output - # occur causing a false positive when testing. These tests can be re-enabled - # when type specific answer files are added. + # Do not include SuperLUMT examples in testing when the indextype is + # int64_t. Answer files were generated with int32_t and minor differences in + # output occur causing a false positive when testing. These tests can be + # re-enabled when type specific answer files are added. if(SUNDIALS_INDEX_SIZE MATCHES "32") # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -278,14 +271,13 @@ if(BUILD_SUNLINSOL_SUPERLUMT) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) endif() endforeach(example_tuple ${IDA_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -317,7 +309,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(IDA_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -328,39 +320,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/ida/trilinos/CMakeLists.txt b/examples/ida/trilinos/CMakeLists.txt index 384d549478..9a11456931 100644 --- a/examples/ida/trilinos/CMakeLists.txt +++ b/examples/ida/trilinos/CMakeLists.txt @@ -14,25 +14,22 @@ # CMakeLists.txt file for IDA Trilinos examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers if(Trilinos_INTERFACE_MPI_CXX_FOUND) - set(IDA_examples - "idaHeat2D_kry_tpetra\;1\;1\;develop" - "idaHeat2D_kry_p_tpetra\;1\;4\;develop" - ) + set(IDA_examples "idaHeat2D_kry_tpetra\;1\;1\;develop" + "idaHeat2D_kry_p_tpetra\;1\;4\;develop") else() - set(IDA_examples - "idaHeat2D_kry_tpetra\;1\;1\;develop" - ) + set(IDA_examples "idaHeat2D_kry_tpetra\;1\;1\;develop") endif() # Set Trilinos compilers/flags set(CMAKE_CXX_COMPILER ${Trilinos_INTERFACE_CXX_COMPILER}) -set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") +set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) +set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Trilinos_INTERFACE_C_COMPILER_FLAGS}") set(MPIEXEC_EXECUTABLE ${Trilinos_INTERFACE_MPIEXEC}) @@ -59,7 +56,8 @@ foreach(example_tuple ${IDA_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -71,12 +69,11 @@ foreach(example_tuple ${IDA_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/trilinos) + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/trilinos) endif() endforeach(example_tuple ${IDA_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -90,39 +87,32 @@ if(EXAMPLES_INSTALL) examples2string(IDA_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_trilinos_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/trilinos/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/trilinos/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/trilinos/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/trilinos - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/ida/trilinos/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/trilinos) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_trilinos_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/trilinos/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/ida/trilinos/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/ida/trilinos/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/trilinos - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/idas/CMakeLists.txt b/examples/idas/CMakeLists.txt index b191f2effa..90617df855 100644 --- a/examples/idas/CMakeLists.txt +++ b/examples/idas/CMakeLists.txt @@ -27,4 +27,4 @@ endif() if(BUILD_FORTRAN_MODULE_INTERFACE AND EXAMPLES_ENABLE_F2003) add_subdirectory(F2003_serial) -endif() \ No newline at end of file +endif() diff --git a/examples/idas/C_openmp/CMakeLists.txt b/examples/idas/C_openmp/CMakeLists.txt index 1a0eb6c8f3..d9bf8c422a 100644 --- a/examples/idas/C_openmp/CMakeLists.txt +++ b/examples/idas/C_openmp/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for IDAS OpenMP examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(IDAS_examples - "idasFoodWeb_bnd_omp\;4\;develop" - "idasFoodWeb_kry_omp\;4\;develop" - ) +set(IDAS_examples "idasFoodWeb_bnd_omp\;4\;develop" + "idasFoodWeb_kry_omp\;4\;develop") # Specify libraries to link against set(IDAS_LIB sundials_idas) @@ -38,8 +36,8 @@ foreach(example_tuple ${IDAS_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -52,16 +50,14 @@ foreach(example_tuple ${IDAS_examples}) endif() # check if example args are provided and set the test name - # IF("${example_args}" STREQUAL "") - # SET(test_name ${example}) - # ELSE() - # STRING(REGEX REPLACE " " "_" test_name ${example}_${example_args}) - # ENDIF() + # IF("${example_args}" STREQUAL "") SET(test_name ${example}) ELSE() + # STRING(REGEX REPLACE " " "_" test_name ${example}_${example_args}) ENDIF() # LEB NOTE: This goes away with TestRunner fix for OpenMP if(NOT ${example} MATCHES "idasFoodWeb_kry_omp") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -71,12 +67,11 @@ foreach(example_tuple ${IDAS_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp) endif() endforeach(example_tuple ${IDAS_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -85,7 +80,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${IDAS_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -95,39 +91,32 @@ if(EXAMPLES_INSTALL) examples2string(IDAS_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/idas/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/idas/F2003_serial/CMakeLists.txt b/examples/idas/F2003_serial/CMakeLists.txt index d66b309729..d019e822c9 100644 --- a/examples/idas/F2003_serial/CMakeLists.txt +++ b/examples/idas/F2003_serial/CMakeLists.txt @@ -14,17 +14,13 @@ # CMakeLists.txt file for the F2003 IDAS serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases -set(FIDAS_examples - "idasAkzoNob_ASAi_dns_f2003\;develop" - ) +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases +set(FIDAS_examples "idasAkzoNob_ASAi_dns_f2003\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "64") # Examples using SUNDIALS linear solvers - list(APPEND FIDAS_examples - "idasHeat2D_kry_f2003\;develop" - ) + list(APPEND FIDAS_examples "idasHeat2D_kry_f2003\;develop") endif() # Specify libraries to link against @@ -40,7 +36,8 @@ foreach(example_tuple ${FIDAS_examples}) list(GET example_tuple 1 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -48,7 +45,8 @@ foreach(example_tuple ${FIDAS_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -56,10 +54,10 @@ foreach(example_tuple ${FIDAS_examples}) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/F2003_serial) endif() endforeach(example_tuple ${FIDAS_examples}) @@ -74,39 +72,32 @@ if(EXAMPLES_INSTALL) examples2string(FIDAS_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/F2003_serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/idas/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/idas/parallel/CMakeLists.txt b/examples/idas/parallel/CMakeLists.txt index f6cd322534..3c18e878fc 100644 --- a/examples/idas/parallel/CMakeLists.txt +++ b/examples/idas/parallel/CMakeLists.txt @@ -14,20 +14,19 @@ # CMakeLists.txt file for IDAS parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(IDAS_examples - "idasBruss_ASAp_kry_bbd_p\;\;1\;4\;exclude-single" - "idasBruss_FSA_kry_bbd_p\;\;1\;4\;exclude-single" - "idasBruss_kry_bbd_p\;\;1\;4\;exclude-single" - "idasFoodWeb_kry_bbd_p\;\;1\;4\;exclude-single" - "idasFoodWeb_kry_p\;\;1\;4\;exclude-single" - "idasHeat2D_FSA_kry_bbd_p\;-sensi stg t\;1\;4\;exclude-single" - "idasHeat2D_kry_bbd_p\;\;1\;4\;exclude-single" - "idasHeat2D_kry_p\;\;1\;4\;exclude-single" - ) + "idasBruss_ASAp_kry_bbd_p\;\;1\;4\;exclude-single" + "idasBruss_FSA_kry_bbd_p\;\;1\;4\;exclude-single" + "idasBruss_kry_bbd_p\;\;1\;4\;exclude-single" + "idasFoodWeb_kry_bbd_p\;\;1\;4\;exclude-single" + "idasFoodWeb_kry_p\;\;1\;4\;exclude-single" + "idasHeat2D_FSA_kry_bbd_p\;-sensi stg t\;1\;4\;exclude-single" + "idasHeat2D_kry_bbd_p\;\;1\;4\;exclude-single" + "idasHeat2D_kry_p\;\;1\;4\;exclude-single") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -44,7 +43,6 @@ set(NVECP_LIB sundials_nvecparallel) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${IDAS_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${IDAS_examples}) @@ -55,8 +53,8 @@ foreach(example_tuple ${IDAS_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -80,7 +78,8 @@ foreach(example_tuple ${IDAS_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -93,12 +92,11 @@ foreach(example_tuple ${IDAS_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/parallel) endif() endforeach(example_tuple ${IDAS_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -112,39 +110,32 @@ if(EXAMPLES_INSTALL) examples2string(IDAS_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/idas/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/idas/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/idas/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/idas/serial/CMakeLists.txt b/examples/idas/serial/CMakeLists.txt index b4531f52c5..c90e776019 100644 --- a/examples/idas/serial/CMakeLists.txt +++ b/examples/idas/serial/CMakeLists.txt @@ -15,53 +15,45 @@ # CMakeLists.txt file for IDAS serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(IDAS_examples - "idasAkzoNob_ASAi_dns\;\;exclude-single" - "idasAkzoNob_dns\;\;exclude-single" - "idasAnalytic_mels\;\;exclude-single" - "idasFoodWeb_bnd\;\;develop" - "idasHeat2D_bnd\;\;exclude-single" - "idasHeat2D_kry\;\;exclude-single" - "idasHessian_ASA_FSA\;\;exclude-single" - "idasKrylovDemo_ls\;\;develop" - "idasKrylovDemo_ls\;1\;develop" - "idasKrylovDemo_ls\;2\;develop" - "idasRoberts_ASAi_dns\;\;exclude-single" - "idasRoberts_FSA_dns\;-sensi stg t\;exclude-single" - "idasRoberts_dns\;\;" - "idasSlCrank_dns\;\;exclude-single" - "idasSlCrank_FSA_dns\;\;exclude-single" - ) + "idasAkzoNob_ASAi_dns\;\;exclude-single" + "idasAkzoNob_dns\;\;exclude-single" + "idasAnalytic_mels\;\;exclude-single" + "idasFoodWeb_bnd\;\;develop" + "idasHeat2D_bnd\;\;exclude-single" + "idasHeat2D_kry\;\;exclude-single" + "idasHessian_ASA_FSA\;\;exclude-single" + "idasKrylovDemo_ls\;\;develop" + "idasKrylovDemo_ls\;1\;develop" + "idasKrylovDemo_ls\;2\;develop" + "idasRoberts_ASAi_dns\;\;exclude-single" + "idasRoberts_FSA_dns\;-sensi stg t\;exclude-single" + "idasRoberts_dns\;\;" + "idasSlCrank_dns\;\;exclude-single" + "idasSlCrank_FSA_dns\;\;exclude-single") # Examples using LAPACK linear solvers -set(IDAS_examples_BL - ) +set(IDAS_examples_BL) # Examples using KLU linear solver set(IDAS_examples_KLU - "idasRoberts_ASAi_klu\;\;develop" - "idasRoberts_FSA_klu\;-sensi stg t\;develop" - "idasRoberts_klu\;\;develop" - ) + "idasRoberts_ASAi_klu\;\;develop" + "idasRoberts_FSA_klu\;-sensi stg t\;develop" "idasRoberts_klu\;\;develop") # Examples using SuperLU_MT linear solver set(IDAS_examples_SUPERLUMT - "idasRoberts_ASAi_sps\;\;exclude-single" - "idasRoberts_FSA_sps\;-sensi stg t\;exclude-single" - "idasRoberts_sps\;\;exclude-single" - ) + "idasRoberts_ASAi_sps\;\;exclude-single" + "idasRoberts_FSA_sps\;-sensi stg t\;exclude-single" + "idasRoberts_sps\;\;exclude-single") # Auxiliary files to install set(IDAS_extras - idasRoberts_ASAi_dns_bkw1_stats.csv - idasRoberts_ASAi_dns_fwd_stats.csv - idasRoberts_dns_stats.csv - idasRoberts_FSA_dns_stats_-sensi_stg_t.csv - ) + idasRoberts_ASAi_dns_bkw1_stats.csv idasRoberts_ASAi_dns_fwd_stats.csv + idasRoberts_dns_stats.csv idasRoberts_FSA_dns_stats_-sensi_stg_t.csv) # Specify libraries to link against set(IDAS_LIB sundials_idas) @@ -78,8 +70,8 @@ foreach(example_tuple ${IDAS_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -99,7 +91,8 @@ foreach(example_tuple ${IDAS_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -111,19 +104,17 @@ foreach(example_tuple ${IDAS_examples}) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) endif() endforeach(example_tuple ${IDAS_examples}) - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackband + sundials_sunlinsollapackdense) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -135,8 +126,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -156,7 +147,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -168,14 +160,13 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) endif() endforeach(example_tuple ${IDAS_examples_BL}) endif() - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -192,8 +183,8 @@ if(BUILD_SUNLINSOL_KLU) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -213,7 +204,8 @@ if(BUILD_SUNLINSOL_KLU) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -225,14 +217,13 @@ if(BUILD_SUNLINSOL_KLU) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) endif() endforeach(example_tuple ${IDAS_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -249,8 +240,8 @@ if(BUILD_SUNLINSOL_SUPERLUMT) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # add example source files add_executable(${example} ${example}.c) @@ -269,13 +260,14 @@ if(BUILD_SUNLINSOL_SUPERLUMT) string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) endif() - # Do not include SuperLUMT examples in testing when the indextype is int64_t. - # Answer files were generated with int32_t and minor differences in output - # occur causing a false positive when testing. These tests can be re-enabled - # when type specific answer files are added. + # Do not include SuperLUMT examples in testing when the indextype is + # int64_t. Answer files were generated with int32_t and minor differences in + # output occur causing a false positive when testing. These tests can be + # re-enabled when type specific answer files are added. if(SUNDIALS_INDEX_SIZE MATCHES "32") # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -288,14 +280,13 @@ if(BUILD_SUNLINSOL_SUPERLUMT) # install example source and .out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) endif() endforeach(example_tuple ${IDAS_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -327,7 +318,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(IDAS_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -338,39 +329,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/idas/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/idas/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/idas/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/idas/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/idas/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/idas/serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/CMakeLists.txt b/examples/kinsol/CMakeLists.txt index 67657f9399..46c2da46a9 100644 --- a/examples/kinsol/CMakeLists.txt +++ b/examples/kinsol/CMakeLists.txt @@ -19,7 +19,8 @@ if(EXAMPLES_ENABLE_C) add_subdirectory(serial) if(ENABLE_OPENMP AND OPENMP_FOUND) - # the only example here need special handling from testrunner (not yet implemented) + # the only example here need special handling from testrunner (not yet + # implemented) add_subdirectory(C_openmp) endif() if(ENABLE_MPI AND MPI_C_FOUND) @@ -32,7 +33,10 @@ if(EXAMPLES_ENABLE_CXX) if(ENABLE_MPI AND MPI_CXX_FOUND) add_subdirectory(CXX_parallel) endif() - if(ENABLE_MPI AND MPI_CXX_FOUND AND ENABLE_HYPRE AND HYPRE_FOUND) + if(ENABLE_MPI + AND MPI_CXX_FOUND + AND ENABLE_HYPRE + AND HYPRE_FOUND) add_subdirectory(CXX_parhyp) endif() endif() diff --git a/examples/kinsol/CUDA_mpi/CMakeLists.txt b/examples/kinsol/CUDA_mpi/CMakeLists.txt index cc134aacfe..c938ca7702 100644 --- a/examples/kinsol/CUDA_mpi/CMakeLists.txt +++ b/examples/kinsol/CUDA_mpi/CMakeLists.txt @@ -18,12 +18,10 @@ # for examples excluded from 'make test' in releases. # Examples to build -set(KINSOL_examples - "kin_em_mpicuda.cu\;1\;2\;develop") +set(KINSOL_examples "kin_em_mpicuda.cu\;1\;2\;develop") # Header files to install -set(KINSOL_headers - "kin_em_mpicuda.hpp") +set(KINSOL_headers "kin_em_mpicuda.hpp") # Add the build target for each example foreach(example_tuple ${KINSOL_examples}) @@ -46,15 +44,14 @@ foreach(example_tuple ${KINSOL_examples}) target_include_directories(${example_target} PRIVATE ${MPI_CXX_INCLUDE_DIRS}) # libraries to link against - target_link_libraries(${example_target} PRIVATE - sundials_kinsol - sundials_nvecmpiplusx - sundials_nveccuda - ${MPI_CXX_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE sundials_kinsol sundials_nvecmpiplusx sundials_nveccuda + ${MPI_CXX_LIBRARIES} ${EXE_EXTRA_LINK_LIBS}) # add example to regression tests - sundials_add_test(${example_target} ${example_target} + sundials_add_test( + ${example_target} ${example_target} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example_target}.out @@ -62,28 +59,17 @@ foreach(example_tuple ${KINSOL_examples}) endforeach() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - sundials_install_examples(kinsol KINSOL_examples - CMAKE_TEMPLATE - cmakelists_CUDA_MPI_ex.in - MAKE_TEMPLATE - makefile_parallel_CUDA_ex.in - SOLVER_LIBRARY - sundials_kinsol - SUNDIALS_TARGETS - kinsol - nvecmpiplusx - nveccuda - DESTINATION - kinsol/CUDA_mpi - EXTRA_FILES - ${KINSOL_headers} - README - TEST_INSTALL - CUDA_mpi - ) + sundials_install_examples( + kinsol KINSOL_examples + CMAKE_TEMPLATE cmakelists_CUDA_MPI_ex.in + MAKE_TEMPLATE makefile_parallel_CUDA_ex.in + SOLVER_LIBRARY sundials_kinsol + SUNDIALS_TARGETS kinsol nvecmpiplusx nveccuda + DESTINATION kinsol/CUDA_mpi + EXTRA_FILES ${KINSOL_headers} README + TEST_INSTALL CUDA_mpi) endif() diff --git a/examples/kinsol/CXX_parallel/CMakeLists.txt b/examples/kinsol/CXX_parallel/CMakeLists.txt index 83c6501b77..64657bdae9 100644 --- a/examples/kinsol/CXX_parallel/CMakeLists.txt +++ b/examples/kinsol/CXX_parallel/CMakeLists.txt @@ -18,9 +18,8 @@ # develop for examples excluded from 'make test' in releases. # Examples to build -set(KINSOL_examples - "kin_heat2D_nonlin_p.cpp\;--np 2 2\;1\;4\;exclude-single" - "kin_em_p.cpp\;\;1\;2\;exclude-single") +set(KINSOL_examples "kin_heat2D_nonlin_p.cpp\;--np 2 2\;1\;4\;exclude-single" + "kin_em_p.cpp\;\;1\;2\;exclude-single") # Add the build target for each example foreach(example_tuple ${KINSOL_examples}) @@ -43,13 +42,10 @@ foreach(example_tuple ${KINSOL_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} PRIVATE - sundials_kinsol - sundials_nvecparallel - sundials_nvecmpiplusx - sundials_nvecserial - MPI::MPI_CXX - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE sundials_kinsol sundials_nvecparallel sundials_nvecmpiplusx + sundials_nvecserial MPI::MPI_CXX ${EXE_EXTRA_LINK_LIBS}) endif() @@ -61,7 +57,8 @@ foreach(example_tuple ${KINSOL_examples}) endif() # add regression test - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -70,28 +67,17 @@ foreach(example_tuple ${KINSOL_examples}) endforeach() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) - sundials_install_examples(kinsol KINSOL_examples - CMAKE_TEMPLATE - cmakelists_CXX_MPI_ex.in - MAKE_TEMPLATE - makefile_parallel_CXX_ex.in - SOLVER_LIBRARY - sundials_kinsol - SUNDIALS_TARGETS - kinsol - nvecparallel - nvecmpiplusx - nvecserial - DESTINATION - kinsol/CXX_parallel - EXTRA_FILES - README - TEST_INSTALL - CXX_parallel - ) + sundials_install_examples( + kinsol KINSOL_examples + CMAKE_TEMPLATE cmakelists_CXX_MPI_ex.in + MAKE_TEMPLATE makefile_parallel_CXX_ex.in + SOLVER_LIBRARY sundials_kinsol + SUNDIALS_TARGETS kinsol nvecparallel nvecmpiplusx nvecserial + DESTINATION kinsol/CXX_parallel + EXTRA_FILES README + TEST_INSTALL CXX_parallel) endif() diff --git a/examples/kinsol/CXX_parhyp/CMakeLists.txt b/examples/kinsol/CXX_parhyp/CMakeLists.txt index fb9e2540df..6f5fe21285 100644 --- a/examples/kinsol/CXX_parhyp/CMakeLists.txt +++ b/examples/kinsol/CXX_parhyp/CMakeLists.txt @@ -14,18 +14,15 @@ # CMakeLists.txt file for KINSOL C++ parhyp examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(KINSOL_examples - "kin_bratu2D_hypre_pfmg\;--np 2 2\;1\;4\;develop" - "kin_heat2D_nonlin_hypre_pfmg\;--np 2 2\;1\;4\;develop" - ) +set(KINSOL_examples "kin_bratu2D_hypre_pfmg\;--np 2 2\;1\;4\;develop" + "kin_heat2D_nonlin_hypre_pfmg\;--np 2 2\;1\;4\;develop") -set(KINSOL_headers - "kin_bratu2D_hypre_pfmg.hpp" - "kin_heat2D_nonlin_hypre_pfmg.hpp") +set(KINSOL_headers "kin_bratu2D_hypre_pfmg.hpp" + "kin_heat2D_nonlin_hypre_pfmg.hpp") # Specify libraries to link against set(KINSOL_LIB sundials_kinsol) @@ -34,7 +31,6 @@ set(NVECP_LIB sundials_nvecparallel) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${KINSOL_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build target for each example foreach(example_tuple ${KINSOL_examples}) @@ -45,8 +41,8 @@ foreach(example_tuple ${KINSOL_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cpp) @@ -55,8 +51,8 @@ foreach(example_tuple ${KINSOL_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE - MPI::MPI_CXX ${SUNDIALS_LIBS} SUNDIALS::HYPRE) + target_link_libraries(${example} PRIVATE MPI::MPI_CXX ${SUNDIALS_LIBS} + SUNDIALS::HYPRE) endif() # check if example args are provided and set the test name @@ -67,7 +63,8 @@ foreach(example_tuple ${KINSOL_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -80,18 +77,18 @@ foreach(example_tuple ${KINSOL_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.cpp ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp) endif() endforeach(example_tuple ${KINSOL_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the header files foreach(extrafile ${KINSOL_headers}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp) endforeach() # Install the README file @@ -104,39 +101,32 @@ if(EXAMPLES_INSTALL) examples2string(KINSOL_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parhyp_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/CXX_parhyp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/CXX_parhyp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/C_openmp/CMakeLists.txt b/examples/kinsol/C_openmp/CMakeLists.txt index 1fa6c190c9..80beb7a8aa 100644 --- a/examples/kinsol/C_openmp/CMakeLists.txt +++ b/examples/kinsol/C_openmp/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for KINSOL OpenMP examples # ----------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(KINSOL_examples - "kinFoodWeb_kry_omp\;4\;develop" - ) +set(KINSOL_examples "kinFoodWeb_kry_omp\;4\;develop") # Specify libraries to link against set(KINSOL_LIB sundials_kinsol) @@ -42,9 +40,11 @@ foreach(example_tuple ${KINSOL_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") - if (NOT ${example} MATCHES "kinFoodWeb_kry_omp") # No test until TestRunner modified for OpenMP + if(NOT ${example} MATCHES "kinFoodWeb_kry_omp") # No test until TestRunner + # modified for OpenMP # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -57,12 +57,11 @@ foreach(example_tuple ${KINSOL_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/C_openmp) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/C_openmp) endif() endforeach(example_tuple ${KINSOL_examples_OMP}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -76,39 +75,32 @@ if(EXAMPLES_INSTALL) examples2string(KINSOL_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/F2003_parallel/CMakeLists.txt b/examples/kinsol/F2003_parallel/CMakeLists.txt index d6ea17cb03..53fe77561c 100644 --- a/examples/kinsol/F2003_parallel/CMakeLists.txt +++ b/examples/kinsol/F2003_parallel/CMakeLists.txt @@ -15,19 +15,15 @@ # CMakeLists.txt file for the KINsol F2003 module parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases if(SUNDIALS_INDEX_SIZE MATCHES "64") - set(FKINSOL_examples - "kin_diagon_kry_f2003\;\;1\;4\;develop\;2") + set(FKINSOL_examples "kin_diagon_kry_f2003\;\;1\;4\;develop\;2") endif() # Specify libraries to link against -set(KINSOL_LIBS - sundials_kinsol - sundials_fkinsol_mod - sundials_nvecparallel - sundials_fnvecparallel_mod) +set(KINSOL_LIBS sundials_kinsol sundials_fkinsol_mod sundials_nvecparallel + sundials_fnvecparallel_mod) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${KINSOL_LIBS} ${EXE_EXTRA_LINK_LIBS}) @@ -45,7 +41,8 @@ foreach(example_tuple ${FKINSOL_examples}) if(NOT TARGET ${example}) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -64,7 +61,8 @@ foreach(example_tuple ${FKINSOL_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} @@ -78,19 +76,18 @@ foreach(example_tuple ${FKINSOL_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example_out} - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel) endif() endforeach(example_tuple ${FKINSOL_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${KINSOL_extras}) install(FILES ${extrafile} - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -101,45 +98,39 @@ if(EXAMPLES_INSTALL) # CMakeLists: replace sundials_ prefix and convert to space separted string list(TRANSFORM KINSOL_LIBS REPLACE "sundials_" "SUNDIALS::" - OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) + OUTPUT_VARIABLE EXAMPLES_CMAKE_TARGETS_tmp) list2string(EXAMPLES_CMAKE_TARGETS_tmp EXAMPLES_CMAKE_TARGETS) examples2string(FKINSOL_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/F2003_serial/CMakeLists.txt b/examples/kinsol/F2003_serial/CMakeLists.txt index 1bca9e8dd3..6a71b7c40a 100644 --- a/examples/kinsol/F2003_serial/CMakeLists.txt +++ b/examples/kinsol/F2003_serial/CMakeLists.txt @@ -14,17 +14,14 @@ # CMakeLists.txt file for the F2003 KINSOL serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases -set(FKINSOL_examples - "kinDiagon_kry_f2003\;\;develop") +# Example lists are tuples "name\;type" where the type is 'develop' for examples +# excluded from 'make test' in releases +set(FKINSOL_examples "kinDiagon_kry_f2003\;\;develop") if(SUNDIALS_INDEX_SIZE MATCHES "64") - list(APPEND FKINSOL_examples - "kinRoboKin_dns_f2003\;\;develop" - "kinLaplace_bnd_f2003\;\;develop" - "kinLaplace_picard_kry_f2003\;\;develop" - ) + list(APPEND FKINSOL_examples "kinRoboKin_dns_f2003\;\;develop" + "kinLaplace_bnd_f2003\;\;develop" + "kinLaplace_picard_kry_f2003\;\;develop") endif() # Specify libraries to link against @@ -41,7 +38,8 @@ foreach(example_tuple ${FKINSOL_examples}) list(GET example_tuple 2 example_type) # Install fortran modules to a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files add_executable(${example} ${example}.f90) @@ -49,7 +47,8 @@ foreach(example_tuple ${FKINSOL_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -58,10 +57,10 @@ foreach(example_tuple ${FKINSOL_examples}) # libraries to link against target_link_libraries(${example} ${SUNDIALS_LIBS}) - # install example source and out files + # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_serial) endif() endforeach(example_tuple ${FKINSOL_examples}) @@ -76,39 +75,33 @@ if(EXAMPLES_INSTALL) examples2string(FKINSOL_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F2003_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/F2003_serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/F2003_serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/parallel/CMakeLists.txt b/examples/kinsol/parallel/CMakeLists.txt index 2b3cbf7c88..e043a6b221 100644 --- a/examples/kinsol/parallel/CMakeLists.txt +++ b/examples/kinsol/parallel/CMakeLists.txt @@ -14,14 +14,12 @@ # CMakeLists.txt file for KINSOL parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;nodes\;tasks\;type" where the type is develop +# for examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers -set(KINSOL_examples - "kinFoodWeb_kry_bbd_p\;1\;4\;exclude-single" - "kinFoodWeb_kry_p\;1\;4\;exclude-single" - ) +set(KINSOL_examples "kinFoodWeb_kry_bbd_p\;1\;4\;exclude-single" + "kinFoodWeb_kry_p\;1\;4\;exclude-single") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -53,7 +51,8 @@ foreach(example_tuple ${KINSOL_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} MPI_NPROCS ${number_of_tasks} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out @@ -69,12 +68,11 @@ foreach(example_tuple ${KINSOL_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/parallel) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/parallel) endif() endforeach(example_tuple ${KINSOL_examples}) - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -88,39 +86,32 @@ if(EXAMPLES_INSTALL) examples2string(KINSOL_examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/parallel - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/kinsol/serial/CMakeLists.txt b/examples/kinsol/serial/CMakeLists.txt index 9ca7edb76f..47d5fae83a 100644 --- a/examples/kinsol/serial/CMakeLists.txt +++ b/examples/kinsol/serial/CMakeLists.txt @@ -15,47 +15,39 @@ # CMakeLists.txt file for KINSOL serial examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS linear solvers set(KINSOL_examples - "kinAnalytic_fp\;\;" - "kinAnalytic_fp\;--damping_fp 0.5\;develop" - "kinAnalytic_fp\;--m_aa 2\;" - "kinAnalytic_fp\;--m_aa 2 --delay_aa 2\;" - "kinAnalytic_fp\;--m_aa 2 --damping_aa 0.5\;develop" - "kinAnalytic_fp\;--m_aa 2 --orth_aa 1\;" - "kinAnalytic_fp\;--m_aa 2 --orth_aa 2\;" - "kinAnalytic_fp\;--m_aa 2 --orth_aa 3\;" - "kinFerTron_dns\;\;develop" - "kinFoodWeb_kry\;\;exclude-single" - "kinKrylovDemo_ls\;\;exclude-single" - "kinLaplace_bnd\;\;exclude-single" - "kinLaplace_picard_bnd\;\;exclude-single" - "kinLaplace_picard_kry\;\;exclude-single" - "kinRoberts_fp\;\;develop" - "kinRoboKin_dns\;\;exclude-single" - ) + "kinAnalytic_fp\;\;" + "kinAnalytic_fp\;--damping_fp 0.5\;develop" + "kinAnalytic_fp\;--m_aa 2\;" + "kinAnalytic_fp\;--m_aa 2 --delay_aa 2\;" + "kinAnalytic_fp\;--m_aa 2 --damping_aa 0.5\;develop" + "kinAnalytic_fp\;--m_aa 2 --orth_aa 1\;" + "kinAnalytic_fp\;--m_aa 2 --orth_aa 2\;" + "kinAnalytic_fp\;--m_aa 2 --orth_aa 3\;" + "kinFerTron_dns\;\;develop" + "kinFoodWeb_kry\;\;exclude-single" + "kinKrylovDemo_ls\;\;exclude-single" + "kinLaplace_bnd\;\;exclude-single" + "kinLaplace_picard_bnd\;\;exclude-single" + "kinLaplace_picard_kry\;\;exclude-single" + "kinRoberts_fp\;\;develop" + "kinRoboKin_dns\;\;exclude-single") # Examples using LAPACK linear solvers -set(KINSOL_examples_BL - ) +set(KINSOL_examples_BL) # Examples using KLU linear solver -set(KINSOL_examples_KLU - "kinFerTron_klu\;develop" - ) +set(KINSOL_examples_KLU "kinFerTron_klu\;develop") # Examples using SuperLU_MT linear solver -set(KINSOL_examples_SUPERLUMT - "kinRoboKin_slu\;develop" - ) +set(KINSOL_examples_SUPERLUMT "kinRoboKin_slu\;develop") # Auxiliary files to install -set(KINSOL_extras - kinRoboKin_dns_stats.csv - ) +set(KINSOL_extras kinRoboKin_dns_stats.csv) # Specify libraries to link against set(KINSOL_LIB sundials_kinsol) @@ -64,7 +56,6 @@ set(NVECS_LIB sundials_nvecserial) # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${KINSOL_LIB} ${NVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${KINSOL_examples}) @@ -73,8 +64,8 @@ foreach(example_tuple ${KINSOL_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files @@ -95,7 +86,8 @@ foreach(example_tuple ${KINSOL_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out @@ -107,19 +99,17 @@ foreach(example_tuple ${KINSOL_examples}) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) endif() endforeach(example_tuple ${KINSOL_examples}) - # Add the build and install targets for each LAPACK example (if needed) if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense) + set(SUNLINSOLLAPACK_LIBS sundials_sunlinsollapackband + sundials_sunlinsollapackdense) # LAPACK libraries list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) @@ -136,7 +126,8 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -147,14 +138,13 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) endif() endforeach(example_tuple ${KINSOL_examples_BL}) endif() - # Add the build and install targets for each KLU example (if needed) if(BUILD_SUNLINSOL_KLU) @@ -176,7 +166,8 @@ if(BUILD_SUNLINSOL_KLU) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -187,14 +178,13 @@ if(BUILD_SUNLINSOL_KLU) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) endif() endforeach(example_tuple ${KINSOL_examples_KLU}) endif() - # Add the build and install targets for each SuperLU_MT example (if needed) if(BUILD_SUNLINSOL_SUPERLUMT) @@ -216,7 +206,8 @@ if(BUILD_SUNLINSOL_SUPERLUMT) set_target_properties(${example} PROPERTIES FOLDER "Examples") # add example to regression tests - sundials_add_test(${example} ${example} + sundials_add_test( + ${example} ${example} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${example}.out EXAMPLE_TYPE ${example_type}) @@ -227,14 +218,13 @@ if(BUILD_SUNLINSOL_SUPERLUMT) # install example source and out files if(EXAMPLES_INSTALL) install(FILES ${example}.c ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) endif() endforeach(example_tuple ${KINSOL_examples_SUPERLUMT}) endif() - # create Makfile and CMakeLists.txt for examples if(EXAMPLES_INSTALL) @@ -243,7 +233,8 @@ if(EXAMPLES_INSTALL) # Install the extra files foreach(extrafile ${KINSOL_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) + install(FILES ${extrafile} + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) endforeach() # Prepare substitution variables for Makefile and/or CMakeLists templates @@ -266,7 +257,7 @@ if(EXAMPLES_INSTALL) if(BUILD_SUNLINSOL_SUPERLUMT) examples2string(KINSOL_examples_SUPERLUMT EXAMPLES_SLUMT) - if (SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") + if(SUNDIALS_SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") set(THREAD_LIBRARY_SLUMT ${CMAKE_THREAD_LIBS_INIT}) else() set(THREAD_LIBRARY_SLUMT "") @@ -277,39 +268,32 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/kinsol/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/kinsol/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/kinsol/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/serial - RENAME Makefile - ) + RENAME Makefile) endif() # add test_install target diff --git a/examples/nvector/CMakeLists.txt b/examples/nvector/CMakeLists.txt index 54aa22f08d..35a9279997 100644 --- a/examples/nvector/CMakeLists.txt +++ b/examples/nvector/CMakeLists.txt @@ -26,12 +26,12 @@ add_subdirectory(serial) # Build the nvector test utilities add_library(test_nvector_obj OBJECT test_nvector.c) if(BUILD_SHARED_LIBS) - # need PIC when shared libs are used since the example executables will link to the shared lib + # need PIC when shared libs are used since the example executables will link + # to the shared lib set_property(TARGET test_nvector_obj PROPERTY POSITION_INDEPENDENT_CODE TRUE) endif() target_link_libraries(test_nvector_obj PRIVATE sundials_nvecserial) - if(ENABLE_MPI AND MPI_C_FOUND) add_subdirectory(parallel) if(BUILD_NVECTOR_MPIMANYVECTOR) @@ -41,9 +41,11 @@ if(ENABLE_MPI AND MPI_C_FOUND) # Build the mpi nvector test utilities add_library(test_nvectormpi_obj OBJECT test_mpinvector.c) if(BUILD_SHARED_LIBS) - set_property(TARGET test_nvectormpi_obj PROPERTY POSITION_INDEPENDENT_CODE TRUE) + set_property(TARGET test_nvectormpi_obj PROPERTY POSITION_INDEPENDENT_CODE + TRUE) endif() - target_link_libraries(test_nvectormpi_obj PRIVATE MPI::MPI_C sundials_nvecparallel) + target_link_libraries(test_nvectormpi_obj PRIVATE MPI::MPI_C + sundials_nvecparallel) endif() if(BUILD_NVECTOR_MANYVECTOR) add_subdirectory(manyvector) diff --git a/examples/nvector/C_openmp/CMakeLists.txt b/examples/nvector/C_openmp/CMakeLists.txt index b332f20064..5ed142e6da 100644 --- a/examples/nvector/C_openmp/CMakeLists.txt +++ b/examples/nvector/C_openmp/CMakeLists.txt @@ -14,28 +14,21 @@ # CMakeLists.txt file for OpenMP nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS OpenMP nvector set(nvector_openmp_examples - "test_nvector_openmp\;1000 1 0\;" - "test_nvector_openmp\;1000 2 0\;" - "test_nvector_openmp\;1000 4 0\;" - "test_nvector_openmp\;10000 1 0\;" - "test_nvector_openmp\;10000 2 0\;" - "test_nvector_openmp\;10000 4 0\;" - ) + "test_nvector_openmp\;1000 1 0\;" "test_nvector_openmp\;1000 2 0\;" + "test_nvector_openmp\;1000 4 0\;" "test_nvector_openmp\;10000 1 0\;" + "test_nvector_openmp\;10000 2 0\;" "test_nvector_openmp\;10000 4 0\;") # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - ) +set(nvector_examples_dependencies test_nvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_openmp_fortran_examples - "test_fnvector_openmp_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_openmp_fortran_examples "test_fnvector_openmp_mod\;\;") endif() # Add source directory to include directories @@ -43,7 +36,7 @@ include_directories(. ..) # Specify libraries to link against set(NVECS_LIB sundials_nvecopenmp) -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) list(APPEND NVECS_LIB sundials_fnvecopenmp_mod) endif() @@ -58,8 +51,8 @@ foreach(example_tuple ${nvector_openmp_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -82,17 +75,16 @@ foreach(example_tuple ${nvector_openmp_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/C_openmp) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/C_openmp) endif() endforeach(example_tuple ${nvector_openmp_examples}) @@ -105,14 +97,17 @@ foreach(example_tuple ${nvector_openmp_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -131,7 +126,8 @@ foreach(example_tuple ${nvector_openmp_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -150,39 +146,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/C_openmp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/C_openmp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/C_openmp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/C_openmp - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/cuda/CMakeLists.txt b/examples/nvector/cuda/CMakeLists.txt index 99893704f8..e60c7f11ef 100644 --- a/examples/nvector/cuda/CMakeLists.txt +++ b/examples/nvector/cuda/CMakeLists.txt @@ -14,20 +14,16 @@ # CMakeLists.txt file for CUDA nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS cuda nvector set(nvector_cuda_examples - "test_nvector_cuda\;3 32 0\;\;\;" - "test_nvector_cuda\;500 128 0\;\;\;" - "test_nvector_cuda\;1000 0 0\;\;\;" - ) + "test_nvector_cuda\;3 32 0\;\;\;" "test_nvector_cuda\;500 128 0\;\;\;" + "test_nvector_cuda\;1000 0 0\;\;\;") # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - ) +set(nvector_examples_dependencies test_nvector) # Add source directory to include directories include_directories(. .. ${PROJECT_SOURCE_DIR}/examples/utilities) @@ -48,8 +44,8 @@ foreach(example_tuple ${nvector_cuda_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cu) @@ -75,28 +71,28 @@ foreach(example_tuple ${nvector_cuda_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.cu - ../test_nvector.c - ../test_nvector.h - ${SUNDIALS_SOURCE_DIR}/examples/utilities/custom_memory_helper_gpu.h + install( + FILES ${example}.cu ../test_nvector.c ../test_nvector.h + ${SUNDIALS_SOURCE_DIR}/examples/utilities/custom_memory_helper_gpu.h DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/cuda) endif() endforeach(example_tuple ${nvector_cuda_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -109,39 +105,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/cuda/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/cuda/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/cuda/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/cuda - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/cuda/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/cuda) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/cuda/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/cuda/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/cuda/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/cuda - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/hip/CMakeLists.txt b/examples/nvector/hip/CMakeLists.txt index f2ef2e7621..9d303d2ccd 100644 --- a/examples/nvector/hip/CMakeLists.txt +++ b/examples/nvector/hip/CMakeLists.txt @@ -14,8 +14,8 @@ # CMakeLists.txt file for HIP nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases if(HIP_PLATFORM STREQUAL "nvcc") set(_warp_size 32) @@ -25,10 +25,9 @@ endif() # Examples using SUNDIALS hip nvector set(nvector_hip_examples - "test_nvector_hip.cpp\;3 ${_warp_size} 0\;\;\;" - "test_nvector_hip.cpp\;500 128 0\;\;\;" - "test_nvector_hip.cpp\;1000 0 0\;\;\;" - ) + "test_nvector_hip.cpp\;3 ${_warp_size} 0\;\;\;" + "test_nvector_hip.cpp\;500 128 0\;\;\;" + "test_nvector_hip.cpp\;1000 0 0\;\;\;") # Add source directory to include directories include_directories(. .. ${PROJECT_SOURCE_DIR}/examples/utilities) @@ -52,8 +51,8 @@ foreach(example_tuple ${nvector_hip_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -73,18 +72,21 @@ foreach(example_tuple ${nvector_hip_examples}) if("${number_of_tasks}" STREQUAL "") set(test_name ${example_target}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_tasks}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_tasks}) endif() else() if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example_target}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -93,18 +95,14 @@ endforeach(example_tuple ${nvector_hip_examples}) if(EXAMPLES_INSTALL) - sundials_install_examples(nvector nvector_hip_examples - SUNDIALS_TARGETS - nvechip - EXAMPLES_DEPENDENCIES - test_nvector.c + sundials_install_examples( + nvector nvector_hip_examples + SUNDIALS_TARGETS nvechip + EXAMPLES_DEPENDENCIES test_nvector.c EXTRA_FILES - ../test_nvector.c - ../test_nvector.h + ../test_nvector.c ../test_nvector.h ${SUNDIALS_SOURCE_DIR}/examples/utilities/custom_memory_helper_gpu.h - CMAKE_TEMPLATE - cmakelists_HIP_ex.in - DESTINATION - nvector/hip) + CMAKE_TEMPLATE cmakelists_HIP_ex.in + DESTINATION nvector/hip) endif(EXAMPLES_INSTALL) diff --git a/examples/nvector/kokkos/CMakeLists.txt b/examples/nvector/kokkos/CMakeLists.txt index 6f1d8bf9f6..648d867ea0 100644 --- a/examples/nvector/kokkos/CMakeLists.txt +++ b/examples/nvector/kokkos/CMakeLists.txt @@ -14,11 +14,9 @@ # CMakeLists.txt file for Kokkos nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the -# type is develop for examples excluded from 'make test' in releases -set(examples_list - "test_nvector_kokkos.cpp\;1000 0\;" -) +# Example lists are tuples "name\;args\;type" where the type is develop for +# examples excluded from 'make test' in releases +set(examples_list "test_nvector_kokkos.cpp\;1000 0\;") include_directories(..) @@ -35,8 +33,8 @@ foreach(example_tuple ${examples_list}) get_filename_component(example_target ${example} NAME_WE) set(example_target "${example_target}.${backend}") - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -48,10 +46,8 @@ foreach(example_tuple ${examples_list}) target_compile_definitions(${example_target} PRIVATE USE_${backend}) # link vector test utilties - target_link_libraries(${example_target} PRIVATE - test_nvector_obj - sundials_nveckokkos - ) + target_link_libraries(${example_target} PRIVATE test_nvector_obj + sundials_nveckokkos) endif() # check if example args are provided and set the test name @@ -62,7 +58,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -72,22 +69,15 @@ endforeach() if(EXAMPLES_INSTALL) - sundials_install_examples(nvec_kokkos examples_list - EXAMPLES_DEPENDENCIES - test_nvector.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.c - ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_COMPONENTS - nveckokkos - SUNDIALS_TARGETS - generic - OTHER_TARGETS - Kokkos::kokkos - DESTINATION - nvector/kokkos - ) + sundials_install_examples( + nvec_kokkos examples_list + EXAMPLES_DEPENDENCIES test_nvector.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.c + ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.h + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_COMPONENTS nveckokkos + SUNDIALS_TARGETS generic + OTHER_TARGETS Kokkos::kokkos + DESTINATION nvector/kokkos) endif() diff --git a/examples/nvector/manyvector/CMakeLists.txt b/examples/nvector/manyvector/CMakeLists.txt index a43d1e4c15..abba295138 100644 --- a/examples/nvector/manyvector/CMakeLists.txt +++ b/examples/nvector/manyvector/CMakeLists.txt @@ -14,24 +14,19 @@ # CMakeLists.txt file for ManyVector nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS manyvector nvector -set(nvector_manyvector_examples - "test_nvector_manyvector\;1000 100 0\;" - "test_nvector_manyvector\;100 1000 0\;" - ) +set(nvector_manyvector_examples "test_nvector_manyvector\;1000 100 0\;" + "test_nvector_manyvector\;100 1000 0\;") # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - ) +set(nvector_examples_dependencies test_nvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_manyvector_fortran_examples - "test_fnvector_manyvector_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_manyvector_fortran_examples "test_fnvector_manyvector_mod\;\;") endif() # Add source directory to include directories @@ -39,14 +34,13 @@ include_directories(. ..) # Specify libraries to link against set(NVECS_LIB sundials_nvecserial sundials_nvecmanyvector) -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) list(APPEND NVECS_LIB sundials_fnvecserial_mod sundials_fnvecmanyvector_mod) endif() # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${NVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${nvector_manyvector_examples}) @@ -55,8 +49,8 @@ foreach(example_tuple ${nvector_manyvector_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -79,17 +73,16 @@ foreach(example_tuple ${nvector_manyvector_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/manyvector) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/manyvector) endif() endforeach(example_tuple ${nvector_manyvector_examples}) @@ -102,14 +95,17 @@ foreach(example_tuple ${nvector_manyvector_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -128,7 +124,8 @@ foreach(example_tuple ${nvector_manyvector_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -147,39 +144,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/manyvector - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/manyvector) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/manyvector/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/manyvector - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/mpicuda/CMakeLists.txt b/examples/nvector/mpicuda/CMakeLists.txt index ce44c0c26e..35f33a5e1b 100644 --- a/examples/nvector/mpicuda/CMakeLists.txt +++ b/examples/nvector/mpicuda/CMakeLists.txt @@ -14,20 +14,17 @@ # CMakeLists.txt file for MPIPlusX, X = CUDA NVECTOR examples. # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS MPI+cuda nvector set(nvector_cuda_examples - "test_nvector_mpicuda\;1000 0\;\;\;" # run sequentially - "test_nvector_mpicuda\;1000 0\;1\;4\;" # run parallel on 4 - ) + "test_nvector_mpicuda\;1000 0\;\;\;" # run sequentially + "test_nvector_mpicuda\;1000 0\;1\;4\;" # run parallel on 4 +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # Add source directory to include directories include_directories(. ..) @@ -48,14 +45,15 @@ foreach(example_tuple ${nvector_cuda_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cu) # link vector test utilties - target_link_libraries(${example} PRIVATE test_nvector_obj test_nvectormpi_obj) + target_link_libraries(${example} PRIVATE test_nvector_obj + test_nvectormpi_obj) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -79,12 +77,14 @@ foreach(example_tuple ${nvector_cuda_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -92,16 +92,13 @@ foreach(example_tuple ${nvector_cuda_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.cu - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpicuda) + install(FILES ${example}.cu ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpicuda) endif() endforeach(example_tuple ${nvector_cuda_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -111,39 +108,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpicuda - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpicuda) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_CUDA_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpicuda/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpicuda - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/mpimanyvector/CMakeLists.txt b/examples/nvector/mpimanyvector/CMakeLists.txt index 66c7253bc9..b6f185aa1f 100644 --- a/examples/nvector/mpimanyvector/CMakeLists.txt +++ b/examples/nvector/mpimanyvector/CMakeLists.txt @@ -14,38 +14,36 @@ # CMakeLists.txt file for MPIManyVector nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS MPIManyVector module set(nvector_mpimanyvector_examples - "test_nvector_mpimanyvector_parallel1\;1000 200 0\;1\;4\;" # run parallel on 4 procs - "test_nvector_mpimanyvector_parallel2\;200 1000 0\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_mpimanyvector_parallel1\;1000 200 0\;1\;4\;" # run parallel on + # 4 procs + "test_nvector_mpimanyvector_parallel2\;200 1000 0\;1\;4\;" # run parallel on + # 4 procs +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) set(nvector_mpimanyvector_fortran_examples - "test_fnvector_mpimanyvector_mod\;\;1\;1\;" - "test_fnvector_mpimanyvector_mod\;\;1\;4\;") + "test_fnvector_mpimanyvector_mod\;\;1\;1\;" + "test_fnvector_mpimanyvector_mod\;\;1\;4\;") endif() # Add source directory to include directories include_directories(. ..) # Specify libraries to link against -set(NVECS_LIB sundials_nvecmpimanyvector - sundials_nvecparallel +set(NVECS_LIB sundials_nvecmpimanyvector sundials_nvecparallel sundials_nvecserial) -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) list(APPEND NVECS_LIB sundials_fnvecmpimanyvector_mod - sundials_fnvecserial_mod) + sundials_fnvecserial_mod) endif() # Set-up linker flags and link libraries @@ -59,7 +57,7 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) if(MPI_Fortran_COMPILER) # use MPI wrapper as the compiler set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) @@ -69,7 +67,6 @@ if (BUILD_FORTRAN_MODULE_INTERFACE) endif() endif() - # Add the build and install targets for each example foreach(example_tuple ${nvector_mpimanyvector_examples}) @@ -80,14 +77,15 @@ foreach(example_tuple ${nvector_mpimanyvector_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) # link vector test utilties - target_link_libraries(${example} PRIVATE test_nvector_obj test_nvectormpi_obj) + target_link_libraries(${example} PRIVATE test_nvector_obj + test_nvectormpi_obj) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -111,12 +109,14 @@ foreach(example_tuple ${nvector_mpimanyvector_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -124,11 +124,9 @@ foreach(example_tuple ${nvector_mpimanyvector_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpimanyvector) + install(FILES ${example}.c ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpimanyvector) endif() endforeach(example_tuple ${nvector_mpimanyvector_examples}) @@ -143,14 +141,17 @@ foreach(example_tuple ${nvector_mpimanyvector_fortran_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -176,12 +177,14 @@ foreach(example_tuple ${nvector_mpimanyvector_fortran_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -201,39 +204,33 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpimanyvector - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpimanyvector) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpimanyvector/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpimanyvector - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/mpiplusx/CMakeLists.txt b/examples/nvector/mpiplusx/CMakeLists.txt index 195bcb6868..88e551386b 100644 --- a/examples/nvector/mpiplusx/CMakeLists.txt +++ b/examples/nvector/mpiplusx/CMakeLists.txt @@ -14,37 +14,30 @@ # CMakeLists.txt file for parallel MPIPlusX nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS MPI nvector set(nvector_mpiplusx_examples - "test_nvector_mpiplusx\;1000 9\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_mpiplusx\;1000 9\;1\;4\;" # run parallel on 4 procs +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_mpiplusx_fortran_examples - "test_fnvector_mpiplusx_mod\;\;1\;1\;" - "test_fnvector_mpiplusx_mod\;\;1\;4\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_mpiplusx_fortran_examples "test_fnvector_mpiplusx_mod\;\;1\;1\;" + "test_fnvector_mpiplusx_mod\;\;1\;4\;") endif() # Add source directory to include directories include_directories(. ..) # Specify libraries to link against -set(NVECS_LIB sundials_nvecmpiplusx - sundials_nvecparallel - sundials_nvecserial) -if (BUILD_FORTRAN_MODULE_INTERFACE) - list(APPEND NVECS_LIB sundials_fnvecmpiplusx_mod - sundials_fnvecserial_mod) +set(NVECS_LIB sundials_nvecmpiplusx sundials_nvecparallel sundials_nvecserial) +if(BUILD_FORTRAN_MODULE_INTERFACE) + list(APPEND NVECS_LIB sundials_fnvecmpiplusx_mod sundials_fnvecserial_mod) endif() # Set-up linker flags and link libraries @@ -58,7 +51,7 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) if(MPI_Fortran_COMPILER) # use MPI wrapper as the compiler set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) @@ -78,14 +71,15 @@ foreach(example_tuple ${nvector_mpiplusx_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) # link vector test utilties - target_link_libraries(${example} PRIVATE test_nvector_obj test_nvectormpi_obj) + target_link_libraries(${example} PRIVATE test_nvector_obj + test_nvectormpi_obj) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -109,12 +103,14 @@ foreach(example_tuple ${nvector_mpiplusx_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -122,11 +118,9 @@ foreach(example_tuple ${nvector_mpiplusx_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpiplusx) + install(FILES ${example}.c ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpiplusx) endif() endforeach(example_tuple ${nvector_mpiplusx_examples}) @@ -141,14 +135,17 @@ foreach(example_tuple ${nvector_mpiplusx_fortran_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -174,12 +171,14 @@ foreach(example_tuple ${nvector_mpiplusx_fortran_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -199,39 +198,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpiplusx - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpiplusx) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/mpiplusx/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/mpiplusx - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/mpiraja/CMakeLists.txt b/examples/nvector/mpiraja/CMakeLists.txt index ffd97ab5a1..bd64a2cf78 100644 --- a/examples/nvector/mpiraja/CMakeLists.txt +++ b/examples/nvector/mpiraja/CMakeLists.txt @@ -14,12 +14,12 @@ # CMakeLists.txt file for raja nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases set(examples_list - "test_nvector_mpiraja.cpp\;1000 0\;\;\;" # run sequentially - "test_nvector_mpiraja.cpp\;1000 0\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_mpiraja.cpp\;1000 0\;\;\;" # run sequentially + "test_nvector_mpiraja.cpp\;1000 0\;1\;4\;" # run parallel on 4 procs +) # Add source directory to include directories include_directories(. ..) @@ -47,8 +47,8 @@ foreach(example_tuple ${nvector_raja_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files @@ -60,15 +60,15 @@ foreach(example_tuple ${nvector_raja_examples}) target_include_directories(${example_target} PUBLIC ${MPI_CXX_INCLUDE_DIRS}) - target_link_libraries(${example_target} - PRIVATE - test_nvector_obj - test_nvectormpi_obj - sundials_nvecmpiplusx - sundials_nvecraja - ${MPI_CXX_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS} - ${OTHER_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE test_nvector_obj + test_nvectormpi_obj + sundials_nvecmpiplusx + sundials_nvecraja + ${MPI_CXX_LIBRARIES} + ${EXE_EXTRA_LINK_LIBS} + ${OTHER_LIBS}) endif() @@ -83,12 +83,14 @@ foreach(example_tuple ${nvector_raja_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -98,35 +100,28 @@ endforeach() if(EXAMPLES_INSTALL) - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") set(_openmp_target OpenMP::OpenMP_CXX) endif() if(RAJA_NEEDS_THREADS) - set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") + set(EXAMPLES_FIND_PACKAGE + "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() - sundials_install_examples(nvec_mpiraja examples_list - EXAMPLES_DEPENDENCIES - test_nvector.c - test_mpinvector.c + sundials_install_examples( + nvec_mpiraja examples_list + EXAMPLES_DEPENDENCIES test_nvector.c test_mpinvector.c EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.c ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.h ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_mpinvector.c - CMAKE_TEMPLATE - cmakelists_${_lang}_MPI_ex.in - SOLVER_LIBRARY - sundials_ida - SUNDIALS_TARGETS - generic - nvecmpiplusx - nvecraja - OTHER_TARGETS - ${_openmp_target} - DESTINATION - nvector/mpiraja - ) + CMAKE_TEMPLATE cmakelists_${_lang}_MPI_ex.in + SOLVER_LIBRARY sundials_ida + SUNDIALS_TARGETS generic nvecmpiplusx nvecraja + OTHER_TARGETS ${_openmp_target} + DESTINATION nvector/mpiraja) endif() diff --git a/examples/nvector/openmpdev/CMakeLists.txt b/examples/nvector/openmpdev/CMakeLists.txt index f115e3c982..d1d301e125 100644 --- a/examples/nvector/openmpdev/CMakeLists.txt +++ b/examples/nvector/openmpdev/CMakeLists.txt @@ -14,19 +14,15 @@ # CMakeLists.txt file for OpenMP DEV nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS OpenMP DEV nvector -set(nvector_openmpdev_examples - "test_nvector_openmpdev\;1000 0\;" - "test_nvector_openmpdev\;10000 0\;" - ) +set(nvector_openmpdev_examples "test_nvector_openmpdev\;1000 0\;" + "test_nvector_openmpdev\;10000 0\;") # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - ) +set(nvector_examples_dependencies test_nvector) # Add source directory to include directories include_directories(. ..) @@ -47,8 +43,8 @@ foreach(example_tuple ${nvector_openmpdev_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -71,22 +67,20 @@ foreach(example_tuple ${nvector_openmpdev_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/openmpdev) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/openmpdev) endif() endforeach() - if(EXAMPLES_INSTALL) # Install the README file @@ -99,39 +93,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/openmpdev - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/openmpdev) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmpdev_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/openmpdev/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/openmpdev - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/parallel/CMakeLists.txt b/examples/nvector/parallel/CMakeLists.txt index bfdf74eec8..c49f6e2f6f 100644 --- a/examples/nvector/parallel/CMakeLists.txt +++ b/examples/nvector/parallel/CMakeLists.txt @@ -14,25 +14,21 @@ # CMakeLists.txt file for MPI nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS MPI nvector set(nvector_parallel_examples - "test_nvector_mpi\;1000 0\;\;\;" # run sequentially - "test_nvector_mpi\;1000 0\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_mpi\;1000 0\;\;\;" # run sequentially + "test_nvector_mpi\;1000 0\;1\;4\;" # run parallel on 4 procs +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_parallel_fortran_examples - "test_fnvector_parallel_mod\;\;1\;4\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_parallel_fortran_examples "test_fnvector_parallel_mod\;\;1\;4\;") endif() # Add source directory to include directories @@ -46,7 +42,7 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) if(MPI_Fortran_COMPILER) # use MPI wrapper as the compiler set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) @@ -66,8 +62,8 @@ foreach(example_tuple ${nvector_parallel_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -76,11 +72,9 @@ foreach(example_tuple ${nvector_parallel_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE - test_nvector_obj - test_nvectormpi_obj - sundials_nvecparallel - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} PRIVATE test_nvector_obj test_nvectormpi_obj + sundials_nvecparallel ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_link_libraries(${example} PRIVATE ${MPI_LIBRARIES}) @@ -98,12 +92,14 @@ foreach(example_tuple ${nvector_parallel_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -111,11 +107,9 @@ foreach(example_tuple ${nvector_parallel_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parallel) + install(FILES ${example}.c ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parallel) endif() endforeach(example_tuple ${nvector_parallel_examples}) @@ -130,14 +124,17 @@ foreach(example_tuple ${nvector_parallel_fortran_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -145,10 +142,8 @@ foreach(example_tuple ${nvector_parallel_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_fnvecparallel_mod - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_fnvecparallel_mod ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_Fortran_COMPILER) target_link_libraries(${example} ${MPI_LIBRARIES}) @@ -166,12 +161,14 @@ foreach(example_tuple ${nvector_parallel_fortran_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -179,7 +176,6 @@ foreach(example_tuple ${nvector_parallel_fortran_examples}) endforeach(example_tuple ${nvector_parallel_fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -192,39 +188,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parallel - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/parhyp/CMakeLists.txt b/examples/nvector/parhyp/CMakeLists.txt index 2c51e65c59..90b2f7e11a 100644 --- a/examples/nvector/parhyp/CMakeLists.txt +++ b/examples/nvector/parhyp/CMakeLists.txt @@ -14,20 +14,17 @@ # CMakeLists.txt file for hypre nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS parallel hypre nvector set(nvector_parhyp_examples - "test_nvector_parhyp\;1000 0\;1\;1\;" # run sequentially - "test_nvector_parhyp\;1000 0\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_parhyp\;1000 0\;1\;1\;" # run sequentially + "test_nvector_parhyp\;1000 0\;1\;4\;" # run parallel on 4 procs +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # Add source directory to include directories include_directories(. ..) @@ -61,14 +58,15 @@ foreach(example_tuple ${nvector_parhyp_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) # link vector test utilties - target_link_libraries(${example} PRIVATE test_nvector_obj test_nvectormpi_obj) + target_link_libraries(${example} PRIVATE test_nvector_obj + test_nvectormpi_obj) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -92,12 +90,14 @@ foreach(example_tuple ${nvector_parhyp_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -105,11 +105,9 @@ foreach(example_tuple ${nvector_parhyp_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - ../test_mpinvector.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parhyp) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + ../test_mpinvector.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parhyp) endif() endforeach(example_tuple ${nvector_parhyp_examples}) @@ -126,39 +124,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parhyp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parhyp - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parhyp) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parhyp_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/parhyp/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/parhyp - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/petsc/CMakeLists.txt b/examples/nvector/petsc/CMakeLists.txt index 7c838ee724..db3d53c851 100644 --- a/examples/nvector/petsc/CMakeLists.txt +++ b/examples/nvector/petsc/CMakeLists.txt @@ -14,20 +14,16 @@ # CMakeLists.txt file for PETSc nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS PETSc nvector -set(nvector_petsc_examples - "test_nvector_petsc\;1000 0\;\;\;" # run sequentially - "test_nvector_petsc\;1000 0\;1\;4\;" # run 4 procs - ) +set(nvector_petsc_examples "test_nvector_petsc\;1000 0\;\;\;" # run sequentially + "test_nvector_petsc\;1000 0\;1\;4\;" # run 4 procs +) # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) +set(nvector_examples_dependencies test_nvector test_mpinvector) # Add source directory to include directories include_directories(. ..) @@ -47,7 +43,6 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() - # Add the build and install targets for each nvector example foreach(example_tuple ${nvector_petsc_examples}) @@ -58,14 +53,15 @@ foreach(example_tuple ${nvector_petsc_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) # link vector test utilties - target_link_libraries(${example} PRIVATE test_nvector_obj test_nvectormpi_obj) + target_link_libraries(${example} PRIVATE test_nvector_obj + test_nvectormpi_obj) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -89,12 +85,14 @@ foreach(example_tuple ${nvector_petsc_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -102,16 +100,13 @@ foreach(example_tuple ${nvector_petsc_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/petsc) + install(FILES ${example}.c ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/petsc) endif() endforeach(example_tuple ${nvector_petsc_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -124,39 +119,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/petsc/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/petsc/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/petsc/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/petsc - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/petsc/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/petsc) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/petsc/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/petsc/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/petsc/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/petsc - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/pthreads/CMakeLists.txt b/examples/nvector/pthreads/CMakeLists.txt index e9fefd7191..4dc45ff76d 100644 --- a/examples/nvector/pthreads/CMakeLists.txt +++ b/examples/nvector/pthreads/CMakeLists.txt @@ -14,28 +14,21 @@ # CMakeLists.txt file for PThread nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS pthread nvector set(nvector_pthreads_examples - "test_nvector_pthreads\;1000 1 0\;" - "test_nvector_pthreads\;1000 2 0\;" - "test_nvector_pthreads\;1000 4 0\;" - "test_nvector_pthreads\;10000 1 0\;" - "test_nvector_pthreads\;10000 2 0\;" - "test_nvector_pthreads\;10000 4 0\;" - ) + "test_nvector_pthreads\;1000 1 0\;" "test_nvector_pthreads\;1000 2 0\;" + "test_nvector_pthreads\;1000 4 0\;" "test_nvector_pthreads\;10000 1 0\;" + "test_nvector_pthreads\;10000 2 0\;" "test_nvector_pthreads\;10000 4 0\;") # Dependencies for nvector examples -set(nvector_examples_dependencies - test_nvector - ) +set(nvector_examples_dependencies test_nvector) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_pthreads_fortran_examples - "test_fnvector_pthreads_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_pthreads_fortran_examples "test_fnvector_pthreads_mod\;\;") endif() # Add source directory to include directories @@ -43,7 +36,7 @@ include_directories(. ..) # Specify libraries to link against set(NVECS_LIB sundials_nvecpthreads) -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) list(APPEND NVECS_LIB sundials_fnvecpthreads_mod) endif() @@ -58,8 +51,8 @@ foreach(example_tuple ${nvector_pthreads_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -71,7 +64,8 @@ foreach(example_tuple ${nvector_pthreads_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} PRIVATE ${SUNDIALS_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${example} PRIVATE ${SUNDIALS_LIBS} + ${CMAKE_THREAD_LIBS_INIT}) endif() # check if example args are provided and set the test name @@ -82,17 +76,16 @@ foreach(example_tuple ${nvector_pthreads_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/pthreads) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/pthreads) endif() endforeach(example_tuple ${nvector_pthreads_examples}) @@ -105,14 +98,17 @@ foreach(example_tuple ${nvector_pthreads_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -131,7 +127,8 @@ foreach(example_tuple ${nvector_pthreads_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -150,39 +147,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_pthreads_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/pthreads - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/pthreads) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_pthreads_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/pthreads/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/pthreads - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/raja/CMakeLists.txt b/examples/nvector/raja/CMakeLists.txt index ad87ee3902..3e8d716eaf 100644 --- a/examples/nvector/raja/CMakeLists.txt +++ b/examples/nvector/raja/CMakeLists.txt @@ -14,15 +14,12 @@ # CMakeLists.txt file for raja nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the -# type is develop for examples excluded from 'make test' in releases -set(examples_list - "test_nvector_raja.cpp\;1000 0\;" - ) +# Example lists are tuples "name\;args\;type" where the type is develop for +# examples excluded from 'make test' in releases +set(examples_list "test_nvector_raja.cpp\;1000 0\;") # Add source directory to include directories -include_directories(. .. - ${SUNDIALS_SOURCE_DIR}/examples/utilities) +include_directories(. .. ${SUNDIALS_SOURCE_DIR}/examples/utilities) if(SUNDIALS_RAJA_BACKENDS MATCHES "CUDA") set(_lang CUDA) @@ -51,8 +48,8 @@ foreach(example_tuple ${examples_list}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # add example source files @@ -63,12 +60,9 @@ foreach(example_tuple ${examples_list}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - test_nvector_obj - sundials_nvecraja - ${EXE_EXTRA_LINK_LIBS} - ${OTHER_LIBS}) + target_link_libraries( + ${example_target} PRIVATE test_nvector_obj sundials_nvecraja + ${EXE_EXTRA_LINK_LIBS} ${OTHER_LIBS}) endif() @@ -80,7 +74,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -89,31 +84,27 @@ endforeach() if(EXAMPLES_INSTALL) - if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP")) + if((RAJA_BACKENDS MATCHES "TARGET_OPENMP") OR (RAJA_BACKENDS MATCHES "OPENMP" + )) set(EXAMPLES_FIND_PACKAGE "find_package(OpenMP REQUIRED)\n") set(_openmp_target OpenMP::OpenMP_CXX) endif() if(RAJA_NEEDS_THREADS) - set(EXAMPLES_FIND_PACKAGE "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") + set(EXAMPLES_FIND_PACKAGE + "${EXAMPLES_FIND_PACKAGE}find_package(Threads REQUIRED)\n") endif() - sundials_install_examples(nvec_raja examples_list - EXAMPLES_DEPENDENCIES - test_nvector.c + sundials_install_examples( + nvec_raja examples_list + EXAMPLES_DEPENDENCIES test_nvector.c EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.c ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.h ${SUNDIALS_SOURCE_DIR}/examples/utilities/${_custom_memhelper} - CMAKE_TEMPLATE - cmakelists_${_lang}_ex.in - SUNDIALS_TARGETS - generic - nvecraja - OTHER_TARGETS - ${_openmp_target} - DESTINATION - nvector/raja - ) + CMAKE_TEMPLATE cmakelists_${_lang}_ex.in + SUNDIALS_TARGETS generic nvecraja + OTHER_TARGETS ${_openmp_target} + DESTINATION nvector/raja) endif() diff --git a/examples/nvector/serial/CMakeLists.txt b/examples/nvector/serial/CMakeLists.txt index 6807562188..5e74daf715 100644 --- a/examples/nvector/serial/CMakeLists.txt +++ b/examples/nvector/serial/CMakeLists.txt @@ -14,19 +14,16 @@ # CMakeLists.txt file for serial nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS serial nvector -set(nvector_serial_examples - "test_nvector_serial\;1000 0\;" - "test_nvector_serial\;10000 0\;" - ) +set(nvector_serial_examples "test_nvector_serial\;1000 0\;" + "test_nvector_serial\;10000 0\;") # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(nvector_serial_fortran_examples - "test_fnvector_serial_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(nvector_serial_fortran_examples "test_fnvector_serial_mod\;\;") endif() # Add source directory to include directories @@ -34,14 +31,13 @@ include_directories(. ..) # Specify libraries to link against set(NVECS_LIB sundials_nvecserial) -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) list(APPEND NVECS_LIB sundials_fnvecserial_mod) endif() # Set-up linker flags and link libraries set(SUNDIALS_LIBS ${NVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - # Add the build and install targets for each example foreach(example_tuple ${nvector_serial_examples}) @@ -50,8 +46,8 @@ foreach(example_tuple ${nvector_serial_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -74,17 +70,16 @@ foreach(example_tuple ${nvector_serial_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_nvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/serial) + install(FILES ${example}.c ../test_nvector.c ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/serial) endif() endforeach(example_tuple ${nvector_serial_examples}) @@ -97,14 +92,17 @@ foreach(example_tuple ${nvector_serial_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.f90) @@ -123,7 +121,8 @@ foreach(example_tuple ${nvector_serial_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -143,26 +142,22 @@ if(EXAMPLES_INSTALL) examples2string(nvector_serial_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/serial/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/serial - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/serial/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - set(EXAMPLES_DEPENDENCIES ) + # building the examples. This makefile can then be used as a template for the + # user's own programs. + set(EXAMPLES_DEPENDENCIES) set(nvector_serial_dependencies test_nvector) examples2string(nvector_serial_dependencies EXAMPLES_DEPENDENCIES) @@ -170,15 +165,12 @@ if(EXAMPLES_INSTALL) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/nvector/sycl/CMakeLists.txt b/examples/nvector/sycl/CMakeLists.txt index f667464755..70e7b04121 100644 --- a/examples/nvector/sycl/CMakeLists.txt +++ b/examples/nvector/sycl/CMakeLists.txt @@ -14,15 +14,13 @@ # CMakeLists.txt file for SYCL nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using SUNDIALS sycl nvector set(nvector_sycl_examples - "test_nvector_sycl.cpp\;7 32 0\;" - "test_nvector_sycl.cpp\;500 128 0\;" - "test_nvector_sycl.cpp\;1000 0 0\;" - ) + "test_nvector_sycl.cpp\;7 32 0\;" "test_nvector_sycl.cpp\;500 128 0\;" + "test_nvector_sycl.cpp\;1000 0 0\;") # Add source directory to include directories include_directories(. .. ${PROJECT_SOURCE_DIR}/examples/utilities) @@ -38,8 +36,8 @@ foreach(example_tuple ${nvector_sycl_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files @@ -49,11 +47,9 @@ foreach(example_tuple ${nvector_sycl_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - test_nvector_obj - sundials_nvecsycl - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} PRIVATE test_nvector_obj sundials_nvecsycl + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -65,29 +61,25 @@ foreach(example_tuple ${nvector_sycl_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach() - if(EXAMPLES_INSTALL) - sundials_install_examples(nvector_sycl nvector_sycl_examples - EXAMPLES_DEPENDENCIES - test_nvector.c + sundials_install_examples( + nvector_sycl nvector_sycl_examples + EXAMPLES_DEPENDENCIES test_nvector.c EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.c ${SUNDIALS_SOURCE_DIR}/examples/nvector/test_nvector.h ${SUNDIALS_SOURCE_DIR}/examples/utilities/custom_memory_helper_sycl.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_TARGETS - nvecsycl - DESTINATION - nvector/sycl - ) + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_TARGETS nvecsycl + DESTINATION nvector/sycl) endif() diff --git a/examples/nvector/trilinos/CMakeLists.txt b/examples/nvector/trilinos/CMakeLists.txt index 0bda6e0cb7..909b1366b9 100644 --- a/examples/nvector/trilinos/CMakeLists.txt +++ b/examples/nvector/trilinos/CMakeLists.txt @@ -14,37 +14,33 @@ # CMakeLists.txt file for Trilinos nvector examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;tasks\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;tasks\;type" where the type is 'develop' +# for examples excluded from 'make test' in releases # Examples using SUNDIALS Trilinos nvector wrapper if(Trilinos_INTERFACE_MPI_CXX_FOUND) set(nvector_trilinos_examples - "test_nvector_trilinos\;1000 0\;\;\;" # run sequentially - "test_nvector_trilinos\;1000 0\;1\;4\;" # run parallel on 4 procs - ) + "test_nvector_trilinos\;1000 0\;\;\;" # run sequentially + "test_nvector_trilinos\;1000 0\;1\;4\;" # run parallel on 4 procs + ) else() set(nvector_trilinos_examples - "test_nvector_trilinos\;1000 0\;\;\;" # run sequentially - ) + "test_nvector_trilinos\;1000 0\;\;\;" # run sequentially + ) endif() # Dependencies for nvector examples if(Trilinos_MPI) - set(nvector_examples_dependencies - test_nvector - test_mpinvector - ) + set(nvector_examples_dependencies test_nvector test_mpinvector) else() - set(nvector_examples_dependencies - test_nvector - ) + set(nvector_examples_dependencies test_nvector) endif() # Set Trilinos compilers/flags set(CMAKE_CXX_COMPILER ${Trilinos_INTERFACE_CXX_COMPILER}) -set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") +set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) +set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Trilinos_INTERFACE_C_COMPILER_FLAGS}") # Set Trilinos MPI executable for trilinos tests @@ -69,22 +65,22 @@ foreach(example_tuple ${nvector_trilinos_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.cpp) # link vector test utilties target_link_libraries(${example} PRIVATE test_nvector_obj) - if (Trilinos_MPI) + if(Trilinos_MPI) target_link_libraries(${example} PRIVATE test_nvectormpi_obj) endif() set_target_properties(${example} PROPERTIES FOLDER "Examples") - # Trilinos libraries must be linked after SUNDIALS libraries! - # Otherwise, segfaults may occur; something to do with RCPs. + # Trilinos libraries must be linked after SUNDIALS libraries! Otherwise, + # segfaults may occur; something to do with RCPs. target_link_libraries(${example} PRIVATE ${SUNDIALS_LIBS}) endif() @@ -99,12 +95,14 @@ foreach(example_tuple ${nvector_trilinos_examples}) if("${number_of_tasks}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${number_of_tasks}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example}_${number_of_tasks}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -112,16 +110,13 @@ foreach(example_tuple ${nvector_trilinos_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.cpp - ../test_nvector.c - ../test_mpinvector.c - ../test_nvector.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/trilinos) + install(FILES ${example}.cpp ../test_nvector.c ../test_mpinvector.c + ../test_nvector.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/trilinos) endif() endforeach(example_tuple ${nvector_trilinos_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -134,39 +129,32 @@ if(EXAMPLES_INSTALL) examples2string(nvector_examples_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_trilinos_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/trilinos - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/trilinos) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_trilinos_CXX_ex.in - ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/nvector/trilinos/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/nvector/trilinos - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/CMakeLists.txt b/examples/sunlinsol/CMakeLists.txt index c57c73797f..34eecd211b 100644 --- a/examples/sunlinsol/CMakeLists.txt +++ b/examples/sunlinsol/CMakeLists.txt @@ -33,8 +33,10 @@ add_subdirectory(pcg/serial) # Build the sunlinsol test utilities add_library(test_sunlinsol_obj OBJECT test_sunlinsol.c test_sunlinsol.h) if(BUILD_SHARED_LIBS) - # need PIC when shared libs are used since the example executables will link to the shared lib - set_property(TARGET test_sunlinsol_obj PROPERTY POSITION_INDEPENDENT_CODE TRUE) + # need PIC when shared libs are used since the example executables will link + # to the shared lib + set_property(TARGET test_sunlinsol_obj PROPERTY POSITION_INDEPENDENT_CODE + TRUE) endif() target_link_libraries(test_sunlinsol_obj PRIVATE sundials_sunlinsoldense) diff --git a/examples/sunlinsol/band/CMakeLists.txt b/examples/sunlinsol/band/CMakeLists.txt index 8a6d09997e..ef4cf305f2 100644 --- a/examples/sunlinsol/band/CMakeLists.txt +++ b/examples/sunlinsol/band/CMakeLists.txt @@ -14,26 +14,20 @@ # CMakeLists.txt file for sunlinsol band examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS band linear solver set(sunlinsol_band_examples - "test_sunlinsol_band\;10 2 3 0\;" - "test_sunlinsol_band\;300 7 4 0\;" - "test_sunlinsol_band\;1000 8 8 0\;" - "test_sunlinsol_band\;5000 3 100 0\;" -) + "test_sunlinsol_band\;10 2 3 0\;" "test_sunlinsol_band\;300 7 4 0\;" + "test_sunlinsol_band\;1000 8 8 0\;" "test_sunlinsol_band\;5000 3 100 0\;") # Dependencies for nvector examples -set(sunlinsol_band_dependencies - test_sunlinsol - ) +set(sunlinsol_band_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_band_fortran_examples - "test_fsunlinsol_band_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_band_fortran_examples "test_fsunlinsol_band_mod\;\;") endif() # Add source directory to include directories @@ -47,8 +41,8 @@ foreach(example_tuple ${sunlinsol_band_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -57,10 +51,8 @@ foreach(example_tuple ${sunlinsol_band_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolband - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial sundials_sunlinsolband + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -71,17 +63,16 @@ foreach(example_tuple ${sunlinsol_band_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/band) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/band) endif() endforeach(example_tuple ${sunlinsol_band_examples}) @@ -94,14 +85,17 @@ foreach(example_tuple ${sunlinsol_band_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -109,12 +103,9 @@ foreach(example_tuple ${sunlinsol_band_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolband - sundials_fsunlinsolband_mod - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolband sundials_fsunlinsolband_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name if("${example_args}" STREQUAL "") @@ -124,7 +115,8 @@ foreach(example_tuple ${sunlinsol_band_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -132,7 +124,6 @@ foreach(example_tuple ${sunlinsol_band_fortran_examples}) endforeach(example_tuple ${sunlinsol_band_fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -142,47 +133,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsolband") set(LIBS "${LIBS} -lsundials_sunmatrixband") - # Set the link directory for the band sunmatrix library - # The generated CMakeLists.txt does not use find_library() locate it + # Set the link directory for the band sunmatrix library The generated + # CMakeLists.txt does not use find_library() locate it set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_band_examples EXAMPLES) examples2string(sunlinsol_band_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/band - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/band) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/band/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/band - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/cusolversp/CMakeLists.txt b/examples/sunlinsol/cusolversp/CMakeLists.txt index ed288d8014..69bc49e030 100644 --- a/examples/sunlinsol/cusolversp/CMakeLists.txt +++ b/examples/sunlinsol/cusolversp/CMakeLists.txt @@ -14,12 +14,10 @@ # CMakeLists.txt file for cuSolverSp examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the -# type is develop for examples excluded from 'make test' in releases -set(examples_list - "test_sunlinsol_cusolversp_batchqr.cu\;100 1 0\;" - "test_sunlinsol_cusolversp_batchqr.cu\;10 10 0\;" - ) +# Example lists are tuples "name\;args\;type" where the type is develop for +# examples excluded from 'make test' in releases +set(examples_list "test_sunlinsol_cusolversp_batchqr.cu\;100 1 0\;" + "test_sunlinsol_cusolversp_batchqr.cu\;10 10 0\;") # Add source directory to include directories include_directories(. ..) @@ -35,25 +33,26 @@ foreach(example_tuple ${examples_list}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunlinsol.c ../test_sunlinsol.h) + add_executable(${example_target} ${example} ../test_sunlinsol.c + ../test_sunlinsol.h) # folder to organize targets in an IDE set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} PRIVATE - sundials_nveccuda - sundials_nvecserial - sundials_sunmatrixdense - sundials_sunmatrixsparse - sundials_sunmatrixcusparse - sundials_sunlinsolcusolversp - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE sundials_nveccuda + sundials_nvecserial + sundials_sunmatrixdense + sundials_sunmatrixsparse + sundials_sunmatrixcusparse + sundials_sunlinsolcusolversp + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -64,7 +63,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -73,23 +73,14 @@ endforeach() if(EXAMPLES_INSTALL) - sundials_install_examples(sunlinsol_cusolversp examples_list - EXAMPLES_DEPENDENCIES - test_sunlinsol.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - CMAKE_TEMPLATE - cmakelists_CUDA_ex.in - SUNDIALS_TARGETS - nveccuda - nvecserial - sunmatrixdense - sunmatrixsparse - sunmatrixcusparse - sunlinsolcusolversp - DESTINATION - sunlinsol/cusolversp - ) + sundials_install_examples( + sunlinsol_cusolversp examples_list + EXAMPLES_DEPENDENCIES test_sunlinsol.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + CMAKE_TEMPLATE cmakelists_CUDA_ex.in + SUNDIALS_TARGETS nveccuda nvecserial sunmatrixdense sunmatrixsparse + sunmatrixcusparse sunlinsolcusolversp + DESTINATION sunlinsol/cusolversp) endif() diff --git a/examples/sunlinsol/dense/CMakeLists.txt b/examples/sunlinsol/dense/CMakeLists.txt index 03b6155811..7dec711c8a 100644 --- a/examples/sunlinsol/dense/CMakeLists.txt +++ b/examples/sunlinsol/dense/CMakeLists.txt @@ -15,26 +15,20 @@ # CMakeLists.txt file for sunlinsol dense examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS dense linear solver set(sunlinsol_dense_examples - "test_sunlinsol_dense\;10 0\;" - "test_sunlinsol_dense\;100 0\;" - "test_sunlinsol_dense\;500 0\;" - "test_sunlinsol_dense\;1000 0\;" -) + "test_sunlinsol_dense\;10 0\;" "test_sunlinsol_dense\;100 0\;" + "test_sunlinsol_dense\;500 0\;" "test_sunlinsol_dense\;1000 0\;") # Dependencies for nvector examples -set(sunlinsol_dense_dependencies - test_sunlinsol - ) +set(sunlinsol_dense_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_dense_fortran_examples - "test_fsunlinsol_dense_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_dense_fortran_examples "test_fsunlinsol_dense_mod\;\;") endif() # Add source directory to include directories @@ -48,8 +42,8 @@ foreach(example_tuple ${sunlinsol_dense_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -58,10 +52,8 @@ foreach(example_tuple ${sunlinsol_dense_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsoldense - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunlinsoldense ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -72,16 +64,15 @@ foreach(example_tuple ${sunlinsol_dense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/dense) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/dense) endif() endforeach(example_tuple ${sunlinsol_dense_examples}) @@ -94,14 +85,17 @@ foreach(example_tuple ${sunlinsol_dense_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -109,11 +103,9 @@ foreach(example_tuple ${sunlinsol_dense_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsoldense - sundials_fsunlinsoldense_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsoldense sundials_fsunlinsoldense_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -124,7 +116,8 @@ foreach(example_tuple ${sunlinsol_dense_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -141,47 +134,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsoldense") set(LIBS "${LIBS} -lsundials_sunmatrixdense") - # Set the link directory for the dense sunmatrix library - # The generated CMakeLists.txt does not use find_library() locate it + # Set the link directory for the dense sunmatrix library The generated + # CMakeLists.txt does not use find_library() locate it set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_dense_examples EXAMPLES) examples2string(sunlinsol_dense_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/dense - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/dense) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/dense/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/dense - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/ginkgo/CMakeLists.txt b/examples/sunlinsol/ginkgo/CMakeLists.txt index 6d3cae204f..c701ffc672 100644 --- a/examples/sunlinsol/ginkgo/CMakeLists.txt +++ b/examples/sunlinsol/ginkgo/CMakeLists.txt @@ -12,25 +12,26 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases set(examples - "test_sunlinsol_ginkgo.cpp\;bicg csr 100 0 100 0\;" -# "test_sunlinsol_ginkgo.cpp\;bicg dense 100 0 100 0\;" - "test_sunlinsol_ginkgo.cpp\;bicgstab csr 100 0 100 0\;" -# "test_sunlinsol_ginkgo.cpp\;bicgstab dense 100 0 100 0\;" - "test_sunlinsol_ginkgo.cpp\;cgs csr 100 0 100 0\;" -# "test_sunlinsol_ginkgo.cpp\;cgs dense 100 0 100 0\;" - "test_sunlinsol_ginkgo.cpp\;gmres csr 100 0 100 0\;" -# "test_sunlinsol_ginkgo.cpp\;gmres dense 100 0 100 0\;" - "test_sunlinsol_ginkgo.cpp\;idr csr 100 0 100 0\;" -# "test_sunlinsol_ginkgo.cpp\;idr dense 100 0 100 0\;" + "test_sunlinsol_ginkgo.cpp\;bicg csr 100 0 100 0\;" + # "test_sunlinsol_ginkgo.cpp\;bicg dense 100 0 100 0\;" + "test_sunlinsol_ginkgo.cpp\;bicgstab csr 100 0 100 0\;" + # "test_sunlinsol_ginkgo.cpp\;bicgstab dense 100 0 100 0\;" + "test_sunlinsol_ginkgo.cpp\;cgs csr 100 0 100 0\;" + # "test_sunlinsol_ginkgo.cpp\;cgs dense 100 0 100 0\;" + "test_sunlinsol_ginkgo.cpp\;gmres csr 100 0 100 0\;" + # "test_sunlinsol_ginkgo.cpp\;gmres dense 100 0 100 0\;" + "test_sunlinsol_ginkgo.cpp\;idr csr 100 0 100 0\;" + # "test_sunlinsol_ginkgo.cpp\;idr dense 100 0 100 0\;" ) # Add source directory to include directories include_directories(..) -sundials_add_examples_ginkgo(examples +sundials_add_examples_ginkgo( + examples TARGETS test_sunlinsol_obj BACKENDS REF OMP CUDA HIP SYCL UNIT_TEST) @@ -54,16 +55,12 @@ if(EXAMPLES_INSTALL) list(APPEND vectors nvecserial) endif() - sundials_install_examples_ginkgo(sunlinsol - CPU_GPU_EXAMPLES_VAR - examples - SUNDIALS_COMPONENTS - ${vectors} - DEPENDENCIES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - DESTINATION - sunlinsol/ginkgo - ) + sundials_install_examples_ginkgo( + sunlinsol + CPU_GPU_EXAMPLES_VAR examples + SUNDIALS_COMPONENTS ${vectors} + DEPENDENCIES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + DESTINATION sunlinsol/ginkgo) endif() diff --git a/examples/sunlinsol/klu/CMakeLists.txt b/examples/sunlinsol/klu/CMakeLists.txt index 664ec266a1..e3f54ce991 100644 --- a/examples/sunlinsol/klu/CMakeLists.txt +++ b/examples/sunlinsol/klu/CMakeLists.txt @@ -14,26 +14,20 @@ # CMakeLists.txt file for sunlinsol KLU examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using the KLU linear solver set(sunlinsol_klu_examples - "test_sunlinsol_klu\;300 0 0\;" - "test_sunlinsol_klu\;300 1 0\;" - "test_sunlinsol_klu\;1000 0 0\;" - "test_sunlinsol_klu\;1000 1 0\;" - ) + "test_sunlinsol_klu\;300 0 0\;" "test_sunlinsol_klu\;300 1 0\;" + "test_sunlinsol_klu\;1000 0 0\;" "test_sunlinsol_klu\;1000 1 0\;") # Dependencies for nvector examples -set(sunlinsol_klu_dependencies - test_sunlinsol - ) +set(sunlinsol_klu_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_klu_fortran_examples - "test_fsunlinsol_klu_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_klu_fortran_examples "test_fsunlinsol_klu_mod\;\;") endif() # Add source directory to include directories @@ -47,8 +41,8 @@ foreach(example_tuple ${sunlinsol_klu_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -57,11 +51,9 @@ foreach(example_tuple ${sunlinsol_klu_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixdense - sundials_sunlinsolklu - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_sunmatrixdense + sundials_sunlinsolklu ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -72,17 +64,16 @@ foreach(example_tuple ${sunlinsol_klu_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/klu) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/klu) endif() endforeach(example_tuple ${sunlinsol_klu_examples}) @@ -95,14 +86,17 @@ foreach(example_tuple ${sunlinsol_klu_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -110,7 +104,8 @@ foreach(example_tuple ${sunlinsol_klu_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod sundials_sunmatrixdense @@ -127,7 +122,8 @@ foreach(example_tuple ${sunlinsol_klu_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -144,47 +140,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsolklu") set(LIBS "${LIBS} -lsundials_sunmatrixsparse -lsundials_sunmatrixdense") - # Set the link directory for the sparse and dense sunmatrix libraries - # The generated CMakeLists.txt does not use find_library() locate them + # Set the link directory for the sparse and dense sunmatrix libraries The + # generated CMakeLists.txt does not use find_library() locate them set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_klu_examples EXAMPLES_KLU) examples2string(sunlinsol_klu_dependencies EXAMPLES_DEPENDENCIES_KLU) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/klu - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/klu) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/klu/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/klu - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/kokkos/CMakeLists.txt b/examples/sunlinsol/kokkos/CMakeLists.txt index 7a4c9e0f5c..08964355dc 100644 --- a/examples/sunlinsol/kokkos/CMakeLists.txt +++ b/examples/sunlinsol/kokkos/CMakeLists.txt @@ -12,14 +12,13 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases set(examples_list - "test_sunlinsol_kokkosdense.cpp\;10 1 0\;" - "test_sunlinsol_kokkosdense.cpp\;100 1 0\;" - "test_sunlinsol_kokkosdense.cpp\;10 1000 0\;" - "test_sunlinsol_kokkosdense.cpp\;100 50 0\;" - ) + "test_sunlinsol_kokkosdense.cpp\;10 1 0\;" + "test_sunlinsol_kokkosdense.cpp\;100 1 0\;" + "test_sunlinsol_kokkosdense.cpp\;10 1000 0\;" + "test_sunlinsol_kokkosdense.cpp\;100 50 0\;") # Add source directory to include directories include_directories(..) @@ -37,10 +36,10 @@ foreach(example_tuple ${examples_list}) get_filename_component(example_target ${example} NAME_WE) set(example_target "${example_target}.${backend}") - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunlinsol.c ../test_sunlinsol.h) + add_executable(${example_target} ${example} ../test_sunlinsol.c + ../test_sunlinsol.h) # folder for IDEs set_target_properties(${example_target} PROPERTIES FOLDER "Examples") @@ -49,13 +48,10 @@ foreach(example_tuple ${examples_list}) target_compile_definitions(${example_target} PRIVATE USE_${backend}) # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_nveckokkos - sundials_sunmatrixkokkosdense - sundials_sunlinsolkokkosdense - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE sundials_nveckokkos sundials_sunmatrixkokkosdense + sundials_sunlinsolkokkosdense ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -66,7 +62,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -76,25 +73,15 @@ endforeach() if(EXAMPLES_INSTALL) - sundials_install_examples(sunlinsol_kokkosdense examples_list - EXAMPLES_DEPENDENCIES - test_sunlinsol.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_COMPONENTS - nveckokkos - sunmatrixkokkosdense - sunlinsolkokkosdense - SUNDIALS_TARGETS - generic - OTHER_TARGETS - Kokkos::kokkos - Kokkos::kokkoskernels - DESTINATION - sunlinsol/kokkos - ) + sundials_install_examples( + sunlinsol_kokkosdense examples_list + EXAMPLES_DEPENDENCIES test_sunlinsol.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_COMPONENTS nveckokkos sunmatrixkokkosdense sunlinsolkokkosdense + SUNDIALS_TARGETS generic + OTHER_TARGETS Kokkos::kokkos Kokkos::kokkoskernels + DESTINATION sunlinsol/kokkos) endif() diff --git a/examples/sunlinsol/lapackband/CMakeLists.txt b/examples/sunlinsol/lapackband/CMakeLists.txt index 672a6ab46f..fefcb00eb3 100644 --- a/examples/sunlinsol/lapackband/CMakeLists.txt +++ b/examples/sunlinsol/lapackband/CMakeLists.txt @@ -14,21 +14,18 @@ # CMakeLists.txt file for sunlinsol LAPACK band examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using the LAPACK band linear solver set(sunlinsol_lapackband_examples - "test_sunlinsol_lapackband\;10 2 3 0 0\;" - "test_sunlinsol_lapackband\;300 7 4 0 0\;" - "test_sunlinsol_lapackband\;1000 8 8 0 0\;" - "test_sunlinsol_lapackband\;5000 3 100 0 0\;" - ) + "test_sunlinsol_lapackband\;10 2 3 0 0\;" + "test_sunlinsol_lapackband\;300 7 4 0 0\;" + "test_sunlinsol_lapackband\;1000 8 8 0 0\;" + "test_sunlinsol_lapackband\;5000 3 100 0 0\;") # Dependencies for nvector examples -set(sunlinsol_lapackband_dependencies - test_sunlinsol - ) +set(sunlinsol_lapackband_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ..) @@ -41,8 +38,8 @@ foreach(example_tuple ${sunlinsol_lapackband_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -51,12 +48,9 @@ foreach(example_tuple ${sunlinsol_lapackband_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixband - sundials_sunlinsollapackband - ${LAPACK_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_sunmatrixband + sundials_sunlinsollapackband ${LAPACK_LIBRARIES} ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -67,22 +61,20 @@ foreach(example_tuple ${sunlinsol_lapackband_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackband) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackband) endif() endforeach(example_tuple ${sunlinsol_lapackband_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -92,47 +84,41 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsollapackband") set(LIBS "${LIBS} -lsundials_sunmatrixband -lsundials_sunmatrixdense") - # Set the link directory for the band and dense sunmatrix libraries - # The generated CMakeLists.txt does not use find_library() locate them + # Set the link directory for the band and dense sunmatrix libraries The + # generated CMakeLists.txt does not use find_library() locate them set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_lapackband_examples EXAMPLES_BL) examples2string(sunlinsol_lapackband_dependencies EXAMPLES_DEPENDENCIES_BL) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackband - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackband) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackband/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackband - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/lapackdense/CMakeLists.txt b/examples/sunlinsol/lapackdense/CMakeLists.txt index 0dd6ea947e..e5ff8e32b4 100644 --- a/examples/sunlinsol/lapackdense/CMakeLists.txt +++ b/examples/sunlinsol/lapackdense/CMakeLists.txt @@ -14,30 +14,26 @@ # CMakeLists.txt file for sunlinsol LAPACK dense examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using the LAPACK dense linear solver set(sunlinsol_lapackdense_examples - "test_sunlinsol_lapackdense\;10 0 0\;" - "test_sunlinsol_lapackdense\;100 0 0\;" - "test_sunlinsol_lapackdense\;500 0 0\;" - "test_sunlinsol_lapackdense\;1000 0 0\;" -) + "test_sunlinsol_lapackdense\;10 0 0\;" + "test_sunlinsol_lapackdense\;100 0 0\;" + "test_sunlinsol_lapackdense\;500 0 0\;" + "test_sunlinsol_lapackdense\;1000 0 0\;") # Dependencies for nvector examples -set(sunlinsol_lapackdense_dependencies - test_sunlinsol -) +set(sunlinsol_lapackdense_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) set(sunlinsol_lapackdense_fortran_examples - "test_fsunlinsol_lapackdense_mod\;10 0 0\;" - "test_fsunlinsol_lapackdense_mod\;100 0 0\;" - "test_fsunlinsol_lapackdense_mod\;500 0 0\;" - "test_fsunlinsol_lapackdense_mod\;1000 0 0\;" - ) + "test_fsunlinsol_lapackdense_mod\;10 0 0\;" + "test_fsunlinsol_lapackdense_mod\;100 0 0\;" + "test_fsunlinsol_lapackdense_mod\;500 0 0\;" + "test_fsunlinsol_lapackdense_mod\;1000 0 0\;") endif() # Add source directory to include directories @@ -51,8 +47,8 @@ foreach(example_tuple ${sunlinsol_lapackdense_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -61,12 +57,9 @@ foreach(example_tuple ${sunlinsol_lapackdense_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixdense - sundials_sunlinsollapackdense - ${LAPACK_LIBRARIES} - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_sunmatrixdense + sundials_sunlinsollapackdense ${LAPACK_LIBRARIES} ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -77,17 +70,16 @@ foreach(example_tuple ${sunlinsol_lapackdense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackdense) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackdense) endif() endforeach(example_tuple ${sunlinsol_lapackdense_examples}) @@ -100,14 +92,17 @@ foreach(example_tuple ${sunlinsol_lapackdense_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -115,11 +110,9 @@ foreach(example_tuple ${sunlinsol_lapackdense_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsollapackdense - sundials_fsunlinsollapackdense_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsollapackdense sundials_fsunlinsollapackdense_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -130,7 +123,8 @@ foreach(example_tuple ${sunlinsol_lapackdense_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -138,7 +132,6 @@ foreach(example_tuple ${sunlinsol_lapackdense_fortran_examples}) endforeach(example_tuple ${sunlinsol_lapackdense_fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -148,47 +141,41 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsollapackdense") set(LIBS "${LIBS} -lsundials_sunmatrixdense -lsundials_sunmatrixband") - # Set the link directory for the dense and band sunmatrix libraries - # The generated CMakeLists.txt does not use find_library() locate them + # Set the link directory for the dense and band sunmatrix libraries The + # generated CMakeLists.txt does not use find_library() locate them set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_lapackdense_examples EXAMPLES_BL) examples2string(sunlinsol_lapackdense_dependencies EXAMPLES_DEPENDENCIES_BL) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackdense - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackdense) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/lapackdense/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/lapackdense - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/magmadense/CMakeLists.txt b/examples/sunlinsol/magmadense/CMakeLists.txt index 0d58eed8f3..9a2b4460c6 100644 --- a/examples/sunlinsol/magmadense/CMakeLists.txt +++ b/examples/sunlinsol/magmadense/CMakeLists.txt @@ -12,23 +12,24 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS MAGMA dense matrix set(sunlinsols_magmadense_examples - "test_sunlinsol_magmadense.cpp\;10 1 0\;" - "test_sunlinsol_magmadense.cpp\;100 1 0\;" - "test_sunlinsol_magmadense.cpp\;10 1000 0\;" - "test_sunlinsol_magmadense.cpp\;100 100 0\;" - ) + "test_sunlinsol_magmadense.cpp\;10 1 0\;" + "test_sunlinsol_magmadense.cpp\;100 1 0\;" + "test_sunlinsol_magmadense.cpp\;10 1000 0\;" + "test_sunlinsol_magmadense.cpp\;100 100 0\;") if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") - set_source_files_properties(test_sunlinsol_magmadense.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(test_sunlinsol_magmadense.cpp PROPERTIES LANGUAGE + CUDA) set(vector nveccuda) set(cuda_or_hip CUDA) elseif(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") - set_source_files_properties(test_sunlinsol_magmadense.cpp PROPERTIES LANGUAGE CXX) + set_source_files_properties(test_sunlinsol_magmadense.cpp PROPERTIES LANGUAGE + CXX) set(vector nvechip) set(cuda_or_hip HIP) endif() @@ -47,20 +48,18 @@ foreach(example_tuple ${sunlinsols_magmadense_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} ../test_sunlinsol.c ../test_sunlinsol.h) + add_executable(${example_target} ${example} ../test_sunlinsol.c + ../test_sunlinsol.h) # folder for IDEs set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_${vector} - sundials_sunlinsolmagmadense - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} PRIVATE sundials_${vector} sundials_sunlinsolmagmadense + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -71,7 +70,8 @@ foreach(example_tuple ${sunlinsols_magmadense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -80,19 +80,13 @@ endforeach(example_tuple ${sunlinsols_magmadense_examples}) if(EXAMPLES_INSTALL) - sundials_install_examples(sunlinsol_magma sunlinsols_magmadense_examples - EXAMPLES_DEPENDENCIES - test_sunlinsol.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - CMAKE_TEMPLATE - cmakelists_${cuda_or_hip}_ex.in - SUNDIALS_TARGETS - ${vector} - sunlinsolmagmadense - DESTINATION - sunlinsol/magmadense - ) + sundials_install_examples( + sunlinsol_magma sunlinsols_magmadense_examples + EXAMPLES_DEPENDENCIES test_sunlinsol.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + CMAKE_TEMPLATE cmakelists_${cuda_or_hip}_ex.in + SUNDIALS_TARGETS ${vector} sunlinsolmagmadense + DESTINATION sunlinsol/magmadense) endif() diff --git a/examples/sunlinsol/onemkldense/CMakeLists.txt b/examples/sunlinsol/onemkldense/CMakeLists.txt index de5cf8b81a..bdf4c4fb5c 100644 --- a/examples/sunlinsol/onemkldense/CMakeLists.txt +++ b/examples/sunlinsol/onemkldense/CMakeLists.txt @@ -12,16 +12,15 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS ONEMKL dense matrix set(sunlinsols_onemkldense_examples - "test_sunlinsol_onemkldense.cpp\;10 1 0\;" - "test_sunlinsol_onemkldense.cpp\;100 1 0\;" - "test_sunlinsol_onemkldense.cpp\;10 1000 0\;" - "test_sunlinsol_onemkldense.cpp\;100 100 0\;" - ) + "test_sunlinsol_onemkldense.cpp\;10 1 0\;" + "test_sunlinsol_onemkldense.cpp\;100 1 0\;" + "test_sunlinsol_onemkldense.cpp\;10 1000 0\;" + "test_sunlinsol_onemkldense.cpp\;100 100 0\;") # Add source directory to include directories include_directories(..) @@ -37,7 +36,7 @@ foreach(example_tuple ${sunlinsols_onemkldense_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -46,14 +45,11 @@ foreach(example_tuple ${sunlinsols_onemkldense_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - test_sunlinsol_obj - sundials_nvecsycl - sundials_sunlinsolonemkldense - MKL::MKL_DPCPP - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE test_sunlinsol_obj sundials_nvecsycl + sundials_sunlinsolonemkldense MKL::MKL_DPCPP + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -65,31 +61,24 @@ foreach(example_tuple ${sunlinsols_onemkldense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach() - if(EXAMPLES_INSTALL) - sundials_install_examples(sunlinsol_onemkl sunlinsols_onemkldense_examples - EXAMPLES_DEPENDENCIES - test_sunlinsol.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_TARGETS - nvecsycl - sunlinsolonemkldense - OTHER_TARGETS - MKL::MKL_DPCPP - DESTINATION - sunlinsol/onemkldense - ) + sundials_install_examples( + sunlinsol_onemkl sunlinsols_onemkldense_examples + EXAMPLES_DEPENDENCIES test_sunlinsol.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_TARGETS nvecsycl sunlinsolonemkldense + OTHER_TARGETS MKL::MKL_DPCPP + DESTINATION sunlinsol/onemkldense) endif() diff --git a/examples/sunlinsol/pcg/parallel/CMakeLists.txt b/examples/sunlinsol/pcg/parallel/CMakeLists.txt index 35982c87cf..7048c8f022 100644 --- a/examples/sunlinsol/pcg/parallel/CMakeLists.txt +++ b/examples/sunlinsol/pcg/parallel/CMakeLists.txt @@ -23,18 +23,15 @@ else() set(TOL "1e-13") endif() -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using the SUNDIALS PCG linear solver set(sunlinsol_pcg_examples - "test_sunlinsol_pcg_parallel\;100 500 ${TOL} 0\;1\;4\;" - ) + "test_sunlinsol_pcg_parallel\;100 500 ${TOL} 0\;1\;4\;") # Dependencies for nvector examples -set(sunlinsol_pcg_dependencies - test_sunlinsol - ) +set(sunlinsol_pcg_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ../..) @@ -57,21 +54,18 @@ foreach(example_tuple ${sunlinsol_pcg_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files - add_executable(${example} ${example}.c - ../../test_sunlinsol.c) + add_executable(${example} ${example}.c ../../test_sunlinsol.c) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_sunlinsolpcg - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_sunlinsolpcg ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_link_libraries(${example} ${MPI_LIBRARIES}) @@ -86,7 +80,8 @@ foreach(example_tuple ${sunlinsol_pcg_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -94,15 +89,12 @@ foreach(example_tuple ${sunlinsol_pcg_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/parallel) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/parallel) endif() endforeach(example_tuple ${sunlinsol_pcg_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -115,39 +107,33 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_pcg_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/parallel - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/pcg/serial/CMakeLists.txt b/examples/sunlinsol/pcg/serial/CMakeLists.txt index 4d6be609ee..353c4a4b97 100644 --- a/examples/sunlinsol/pcg/serial/CMakeLists.txt +++ b/examples/sunlinsol/pcg/serial/CMakeLists.txt @@ -23,23 +23,18 @@ else() set(TOL "1e-16") endif() -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS PCG linear solver -set(sunlinsol_pcg_examples - "test_sunlinsol_pcg_serial\;100 500 ${TOL} 0\;" - ) +set(sunlinsol_pcg_examples "test_sunlinsol_pcg_serial\;100 500 ${TOL} 0\;") # Dependencies for nvector examples -set(sunlinsol_pcg_dependencies - test_sunlinsol - ) +set(sunlinsol_pcg_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_pcg_fortran_examples - "test_fsunlinsol_pcg_mod_serial\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_pcg_fortran_examples "test_fsunlinsol_pcg_mod_serial\;\;") endif() # Add source directory to include directories @@ -53,21 +48,18 @@ foreach(example_tuple ${sunlinsol_pcg_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files - add_executable(${example} ${example}.c - ../../test_sunlinsol.c) + add_executable(${example} ${example}.c ../../test_sunlinsol.c) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolpcg - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial sundials_sunlinsolpcg + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -78,17 +70,16 @@ foreach(example_tuple ${sunlinsol_pcg_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/serial) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/serial) endif() endforeach(example_tuple ${sunlinsol_pcg_examples}) @@ -101,14 +92,17 @@ foreach(example_tuple ${sunlinsol_pcg_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -116,12 +110,9 @@ foreach(example_tuple ${sunlinsol_pcg_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolpcg - sundials_fsunlinsolpcg_mod - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolpcg sundials_fsunlinsolpcg_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name if("${example_args}" STREQUAL "") @@ -131,7 +122,8 @@ foreach(example_tuple ${sunlinsol_pcg_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -151,39 +143,33 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_pcg_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/pcg/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/pcg/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt b/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt index 2423663c52..d5934add2f 100644 --- a/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt +++ b/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt @@ -14,19 +14,16 @@ # CMakeLists.txt file for sunlinsol SPBCGS parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using the SUNDIALS SPBCGS linear solver set(sunlinsol_spbcgs_examples - "test_sunlinsol_spbcgs_parallel\;100 1 50 1e-3 0\;1\;4\;" - "test_sunlinsol_spbcgs_parallel\;100 2 50 1e-3 0\;1\;4\;" - ) + "test_sunlinsol_spbcgs_parallel\;100 1 50 1e-3 0\;1\;4\;" + "test_sunlinsol_spbcgs_parallel\;100 2 50 1e-3 0\;1\;4\;") # Dependencies for nvector examples -set(sunlinsol_spbcgs_dependencies - test_sunlinsol - ) +set(sunlinsol_spbcgs_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ../..) @@ -49,8 +46,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -59,10 +56,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_sunlinsolspbcgs - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_sunlinsolspbcgs ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_include_directories(${example} ${MPI_INCLUDE_PATH}) @@ -78,7 +73,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -86,15 +82,12 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/parallel) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/parallel) endif() endforeach(example_tuple ${sunlinsol_spbcgs_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -107,39 +100,36 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spbcgs_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/parallel - ) + FILES + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/parallel/Makefile_ex - @ONLY - ) + @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spbcgs/serial/CMakeLists.txt b/examples/sunlinsol/spbcgs/serial/CMakeLists.txt index 005f743cdf..1868e93bee 100644 --- a/examples/sunlinsol/spbcgs/serial/CMakeLists.txt +++ b/examples/sunlinsol/spbcgs/serial/CMakeLists.txt @@ -23,24 +23,20 @@ else() set(TOL "1e-16") endif() -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS SPBCGS linear solver set(sunlinsol_spbcgs_examples - "test_sunlinsol_spbcgs_serial\;100 1 100 ${TOL} 0\;" - "test_sunlinsol_spbcgs_serial\;100 2 100 ${TOL} 0\;" - ) + "test_sunlinsol_spbcgs_serial\;100 1 100 ${TOL} 0\;" + "test_sunlinsol_spbcgs_serial\;100 2 100 ${TOL} 0\;") # Dependencies for nvector examples -set(sunlinsol_spbcgs_dependencies - test_sunlinsol - ) +set(sunlinsol_spbcgs_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_spbcgs_fortran_examples - "test_fsunlinsol_spbcgs_mod_serial\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_spbcgs_fortran_examples "test_fsunlinsol_spbcgs_mod_serial\;\;") endif() # Add source directory to include directories @@ -54,8 +50,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -64,10 +60,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolspbcgs - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunlinsolspbcgs ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -78,17 +72,16 @@ foreach(example_tuple ${sunlinsol_spbcgs_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/serial) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/serial) endif() endforeach(example_tuple ${sunlinsol_spbcgs_examples}) @@ -101,14 +94,17 @@ foreach(example_tuple ${sunlinsol_spbcgs_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -116,11 +112,9 @@ foreach(example_tuple ${sunlinsol_spbcgs_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolspbcgs - sundials_fsunlinsolspbcgs_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolspbcgs sundials_fsunlinsolspbcgs_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -131,7 +125,8 @@ foreach(example_tuple ${sunlinsol_spbcgs_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -151,39 +146,33 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spbcgs_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spbcgs/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spbcgs/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt b/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt index c687877fcb..0d95eb0e53 100644 --- a/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt +++ b/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt @@ -14,19 +14,16 @@ # CMakeLists.txt file for sunlinsol SPFGMR parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using the SUNDIALS SPTFQMR linear solver set(sunlinsol_spfgmr_examples - "test_sunlinsol_spfgmr_parallel\;100 1 50 1e-3 0\;1\;4\;" - "test_sunlinsol_spfgmr_parallel\;100 2 50 1e-3 0\;1\;4\;" - ) + "test_sunlinsol_spfgmr_parallel\;100 1 50 1e-3 0\;1\;4\;" + "test_sunlinsol_spfgmr_parallel\;100 2 50 1e-3 0\;1\;4\;") # Dependencies for nvector examples -set(sunlinsol_spfgmr_dependencies - test_sunlinsol - ) +set(sunlinsol_spfgmr_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ../..) @@ -49,8 +46,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -59,10 +56,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_sunlinsolspfgmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_sunlinsolspfgmr ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_link_libraries(${example} ${MPI_LIBRARIES}) @@ -77,7 +72,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -85,15 +81,12 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) # add example to regression tests if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/parallel) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/parallel) endif() endforeach(example_tuple ${sunlinsol_spfgmr_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -106,39 +99,36 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spfgmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/parallel - ) + FILES + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/parallel/Makefile_ex - @ONLY - ) + @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spfgmr/serial/CMakeLists.txt b/examples/sunlinsol/spfgmr/serial/CMakeLists.txt index daa7d9fca3..aca3e453af 100644 --- a/examples/sunlinsol/spfgmr/serial/CMakeLists.txt +++ b/examples/sunlinsol/spfgmr/serial/CMakeLists.txt @@ -23,23 +23,19 @@ else() set(TOL "1e-14") endif() -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS SPFGMR linear solver set(sunlinsol_spfgmr_examples - "test_sunlinsol_spfgmr_serial\;100 1 100 ${TOL} 0\;" - "test_sunlinsol_spfgmr_serial\;100 2 100 ${TOL} 0\;" - ) + "test_sunlinsol_spfgmr_serial\;100 1 100 ${TOL} 0\;" + "test_sunlinsol_spfgmr_serial\;100 2 100 ${TOL} 0\;") # Dependencies for nvector examples -set(sunlinsol_spfgmr_dependencies - test_sunlinsol - ) +set(sunlinsol_spfgmr_dependencies test_sunlinsol) -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_spfgmr_fortran_examples - "test_fsunlinsol_spfgmr_mod_serial\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_spfgmr_fortran_examples "test_fsunlinsol_spfgmr_mod_serial\;\;") endif() # Add source directory to include directories @@ -53,8 +49,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -63,10 +59,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolspfgmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunlinsolspfgmr ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -77,17 +71,16 @@ foreach(example_tuple ${sunlinsol_spfgmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/serial) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/serial) endif() endforeach(example_tuple ${sunlinsol_spfgmr_examples}) @@ -100,14 +93,17 @@ foreach(example_tuple ${sunlinsol_spfgmr_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -115,11 +111,9 @@ foreach(example_tuple ${sunlinsol_spfgmr_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolspfgmr - sundials_fsunlinsolspfgmr_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolspfgmr sundials_fsunlinsolspfgmr_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -130,7 +124,8 @@ foreach(example_tuple ${sunlinsol_spfgmr_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -138,7 +133,6 @@ foreach(example_tuple ${sunlinsol_spfgmr_fortran_examples}) endforeach(example_tuple ${sunlinsol_spfgmr_fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -151,39 +145,33 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spfgmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spfgmr/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spfgmr/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spgmr/parallel/CMakeLists.txt b/examples/sunlinsol/spgmr/parallel/CMakeLists.txt index db280af33d..3dbda67ac8 100644 --- a/examples/sunlinsol/spgmr/parallel/CMakeLists.txt +++ b/examples/sunlinsol/spgmr/parallel/CMakeLists.txt @@ -14,21 +14,18 @@ # CMakeLists.txt file for sunlinsol SPGMR parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using the SUNDIALS SPGMR linear solver set(sunlinsol_spgmr_examples - "test_sunlinsol_spgmr_parallel\;100 1 1 50 1e-3 0\;1\;4\;" - "test_sunlinsol_spgmr_parallel\;100 1 2 50 1e-3 0\;1\;4\;" - "test_sunlinsol_spgmr_parallel\;100 2 1 50 1e-3 0\;1\;4\;" - "test_sunlinsol_spgmr_parallel\;100 2 2 50 1e-3 0\;1\;4\;" - ) + "test_sunlinsol_spgmr_parallel\;100 1 1 50 1e-3 0\;1\;4\;" + "test_sunlinsol_spgmr_parallel\;100 1 2 50 1e-3 0\;1\;4\;" + "test_sunlinsol_spgmr_parallel\;100 2 1 50 1e-3 0\;1\;4\;" + "test_sunlinsol_spgmr_parallel\;100 2 2 50 1e-3 0\;1\;4\;") # Dependencies for nvector examples -set(sunlinsol_spgmr_dependencies - test_sunlinsol - ) +set(sunlinsol_spgmr_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ../..) @@ -41,7 +38,6 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() - # Add the build and install targets for each example foreach(example_tuple ${sunlinsol_spgmr_examples}) @@ -52,8 +48,8 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -62,10 +58,8 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_sunlinsolspgmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_sunlinsolspgmr ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_link_libraries(${example} ${MPI_LIBRARIES}) @@ -80,7 +74,8 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -88,15 +83,12 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/parallel) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/parallel) endif() endforeach(example_tuple ${sunlinsol_spgmr_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -109,39 +101,34 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spgmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/parallel/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/parallel - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/parallel/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/parallel/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/spgmr/serial/CMakeLists.txt b/examples/sunlinsol/spgmr/serial/CMakeLists.txt index 3353f2a829..e318ed93a0 100644 --- a/examples/sunlinsol/spgmr/serial/CMakeLists.txt +++ b/examples/sunlinsol/spgmr/serial/CMakeLists.txt @@ -23,26 +23,22 @@ else() set(TOL "1e-14") endif() -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS SPGMR linear solver set(sunlinsol_spgmr_examples - "test_sunlinsol_spgmr_serial\;100 1 1 100 ${TOL} 0\;" - "test_sunlinsol_spgmr_serial\;100 2 1 100 ${TOL} 0\;" - "test_sunlinsol_spgmr_serial\;100 1 2 100 ${TOL} 0\;" - "test_sunlinsol_spgmr_serial\;100 2 2 100 ${TOL} 0\;" - ) + "test_sunlinsol_spgmr_serial\;100 1 1 100 ${TOL} 0\;" + "test_sunlinsol_spgmr_serial\;100 2 1 100 ${TOL} 0\;" + "test_sunlinsol_spgmr_serial\;100 1 2 100 ${TOL} 0\;" + "test_sunlinsol_spgmr_serial\;100 2 2 100 ${TOL} 0\;") # Dependencies for nvector examples -set(sunlinsol_spgmr_dependencies - test_sunlinsol - ) +set(sunlinsol_spgmr_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunlinsol_spgmr_fortran_examples - "test_fsunlinsol_spgmr_mod_serial\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunlinsol_spgmr_fortran_examples "test_fsunlinsol_spgmr_mod_serial\;\;") endif() # Add source directory to include directories @@ -56,8 +52,8 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -66,10 +62,8 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolspgmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunlinsolspgmr ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -80,17 +74,16 @@ foreach(example_tuple ${sunlinsol_spgmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/serial) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/serial) endif() endforeach(example_tuple ${sunlinsol_spgmr_examples}) @@ -103,14 +96,17 @@ foreach(example_tuple ${sunlinsol_spgmr_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -118,11 +114,9 @@ foreach(example_tuple ${sunlinsol_spgmr_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolspgmr - sundials_fsunlinsolspgmr_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolspgmr sundials_fsunlinsolspgmr_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -133,7 +127,8 @@ foreach(example_tuple ${sunlinsol_spgmr_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -153,39 +148,33 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_spgmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/spgmr/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/spgmr/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt b/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt index bb6b44935f..247c68ef57 100644 --- a/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt +++ b/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt @@ -14,19 +14,16 @@ # CMakeLists.txt file for sunlinsol SPTFQMR parallel examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;tasks\;type" where the type is +# develop for examples excluded from 'make test' in releases # Examples using the SUNDIALS SPTFQMR linear solver set(sunlinsol_sptfqmr_examples - "test_sunlinsol_sptfqmr_parallel\;100 1 50 1e-3 0\;1\;4\;" - "test_sunlinsol_sptfqmr_parallel\;100 2 50 1e-3 0\;1\;4\;" - ) + "test_sunlinsol_sptfqmr_parallel\;100 1 50 1e-3 0\;1\;4\;" + "test_sunlinsol_sptfqmr_parallel\;100 2 50 1e-3 0\;1\;4\;") # Dependencies for nvector examples -set(sunlinsol_sptfqmr_dependencies - test_sunlinsol - ) +set(sunlinsol_sptfqmr_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ../..) @@ -49,8 +46,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) list(GET example_tuple 3 number_of_tasks) list(GET example_tuple 4 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -59,10 +56,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecparallel - sundials_sunlinsolsptfqmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecparallel + sundials_sunlinsolsptfqmr ${EXE_EXTRA_LINK_LIBS}) if(NOT MPI_C_COMPILER) target_link_libraries(${example} ${MPI_LIBRARIES}) @@ -77,7 +72,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks} EXAMPLE_TYPE ${example_type} @@ -85,15 +81,12 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/parallel) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/parallel) endif() endforeach(example_tuple ${sunlinsol_sptfqmr_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -106,39 +99,37 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_sptfqmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/parallel - ) + FILES + ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/parallel) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/Makefile_ex - @ONLY - ) + @ONLY) # install the configured Makefile_ex as Makefile install( - FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/Makefile_ex + FILES + ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/parallel/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/parallel - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt b/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt index c985445c51..5d64fd308e 100644 --- a/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt +++ b/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt @@ -23,24 +23,21 @@ else() set(TOL "1e-16") endif() -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS SPTFQMR linear solver set(sunlinsol_sptfqmr_examples - "test_sunlinsol_sptfqmr_serial\;100 1 100 ${TOL} 0\;" - "test_sunlinsol_sptfqmr_serial\;100 2 100 ${TOL} 0\;" - ) + "test_sunlinsol_sptfqmr_serial\;100 1 100 ${TOL} 0\;" + "test_sunlinsol_sptfqmr_serial\;100 2 100 ${TOL} 0\;") # Dependencies for nvector examples -set(sunlinsol_sptfqmr_dependencies - test_sunlinsol - ) +set(sunlinsol_sptfqmr_dependencies test_sunlinsol) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) +if(BUILD_FORTRAN_MODULE_INTERFACE) set(sunlinsol_sptfqmr_fortran_examples - "test_fsunlinsol_sptfqmr_mod_serial\;\;") + "test_fsunlinsol_sptfqmr_mod_serial\;\;") endif() # Add source directory to include directories @@ -54,8 +51,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../../test_sunlinsol.c) @@ -64,10 +61,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunlinsolsptfqmr - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunlinsolsptfqmr ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -78,17 +73,16 @@ foreach(example_tuple ${sunlinsol_sptfqmr_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../../test_sunlinsol.h - ../../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/serial) + install(FILES ${example}.c ../../test_sunlinsol.h ../../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/serial) endif() endforeach(example_tuple ${sunlinsol_sptfqmr_examples}) @@ -101,14 +95,17 @@ foreach(example_tuple ${sunlinsol_sptfqmr_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.f90) @@ -116,11 +113,9 @@ foreach(example_tuple ${sunlinsol_sptfqmr_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunlinsolsptfqmr - sundials_fsunlinsolsptfqmr_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunlinsolsptfqmr sundials_fsunlinsolsptfqmr_mod ${EXE_EXTRA_LINK_LIBS}) # check if example args are provided and set the test name @@ -131,7 +126,8 @@ foreach(example_tuple ${sunlinsol_sptfqmr_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -151,39 +147,34 @@ if(EXAMPLES_INSTALL) examples2string(sunlinsol_sptfqmr_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt - @ONLY - ) + @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/serial - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/serial) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/serial/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/serial/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/sptfqmr/serial/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/sptfqmr/serial - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunlinsol/superludist/CMakeLists.txt b/examples/sunlinsol/superludist/CMakeLists.txt index bba860e2eb..03f7e028cc 100644 --- a/examples/sunlinsol/superludist/CMakeLists.txt +++ b/examples/sunlinsol/superludist/CMakeLists.txt @@ -14,21 +14,18 @@ # CMakeLists.txt file for the superlu-dist SUNLinearSolver examples # ----------------------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;type" where the -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;type" where the 'develop' for +# examples excluded from 'make test' in releases # Examples using the SuperLU_MT linear solver set(sunlinsol_superludist_examples - "test_sunlinsol_superludist.cpp\;100 1 1 0\;1\;" - "test_sunlinsol_superludist.cpp\;400 1 2 0\;2\;" - "test_sunlinsol_superludist.cpp\;900 3 1 0\;3\;" - "test_sunlinsol_superludist.cpp\;1000 2 2 0\;4\;" -) + "test_sunlinsol_superludist.cpp\;100 1 1 0\;1\;" + "test_sunlinsol_superludist.cpp\;400 1 2 0\;2\;" + "test_sunlinsol_superludist.cpp\;900 3 1 0\;3\;" + "test_sunlinsol_superludist.cpp\;1000 2 2 0\;4\;") # Dependencies for nvector examples -set(sunlinsol_superludist_dependencies - test_sunlinsol - ) +set(sunlinsol_superludist_dependencies test_sunlinsol) if(SUPERLUDIST_CUDA) set(_ex_lang CUDA) @@ -53,26 +50,22 @@ foreach(example_tuple ${sunlinsol_superludist_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunlinsol.c) + add_executable(${example_target} ${example} ../test_sunlinsol.c) # folder to organize targets in an IDE set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_sunlinsolsuperludist - sundials_sunmatrixslunrloc - sundials_sunmatrixdense - sundials_nvecparallel - sundials_nvecserial - MPI::MPI_CXX) + target_link_libraries( + ${example_target} + PRIVATE sundials_sunlinsolsuperludist sundials_sunmatrixslunrloc + sundials_sunmatrixdense sundials_nvecparallel sundials_nvecserial + MPI::MPI_CXX) endif() # check if example args are provided and set the test name @@ -80,18 +73,21 @@ foreach(example_tuple ${sunlinsol_superludist_examples}) if("${number_of_nodes}" STREQUAL "") set(test_name ${example_target}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_nodes}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_nodes}) endif() else() if("${number_of_nodes}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example_target}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_nodes}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_nodes}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_nodes} EXAMPLE_TYPE ${example_type} @@ -101,21 +97,13 @@ endforeach(example_tuple ${sunlinsol_superludist_examples}) if(EXAMPLES_INSTALL) - sundials_install_examples(sunlinsol_superludist sunlinsol_superludist_examples - EXAMPLES_DEPENDENCIES - test_sunlinsol.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c - ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h - CMAKE_TEMPLATE - cmakelists_${_ex_lang}_MPI_ex.in - SUNDIALS_TARGETS - nvecserial - nvecparallel - sunlinsoldense - sunlinsolsuperludist - DESTINATION - sunlinsol/superludist - ) + sundials_install_examples( + sunlinsol_superludist sunlinsol_superludist_examples + EXAMPLES_DEPENDENCIES test_sunlinsol.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.c + ${SUNDIALS_SOURCE_DIR}/examples/sunlinsol/test_sunlinsol.h + CMAKE_TEMPLATE cmakelists_${_ex_lang}_MPI_ex.in + SUNDIALS_TARGETS nvecserial nvecparallel sunlinsoldense sunlinsolsuperludist + DESTINATION sunlinsol/superludist) endif() diff --git a/examples/sunlinsol/superlumt/CMakeLists.txt b/examples/sunlinsol/superlumt/CMakeLists.txt index c2142f7bf2..794d69fe5f 100644 --- a/examples/sunlinsol/superlumt/CMakeLists.txt +++ b/examples/sunlinsol/superlumt/CMakeLists.txt @@ -14,23 +14,19 @@ # CMakeLists.txt file for sunlinsol SuperLU_MT examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases -# Examples using the SuperLU_MT linear solver -# Note: threaded tests are excluded because of a potential bug in -# SuperLU_MT that causes random test failures +# Examples using the SuperLU_MT linear solver Note: threaded tests are excluded +# because of a potential bug in SuperLU_MT that causes random test failures set(sunlinsol_superlumt_examples - "test_sunlinsol_superlumt\;300 0 1 0\;" - "test_sunlinsol_superlumt\;300 1 1 0\;" - "test_sunlinsol_superlumt\;1000 0 3 0\;exclude" - "test_sunlinsol_superlumt\;1000 1 3 0\;exclude" -) + "test_sunlinsol_superlumt\;300 0 1 0\;" + "test_sunlinsol_superlumt\;300 1 1 0\;" + "test_sunlinsol_superlumt\;1000 0 3 0\;exclude" + "test_sunlinsol_superlumt\;1000 1 3 0\;exclude") # Dependencies for nvector examples -set(sunlinsol_superlumt_dependencies - test_sunlinsol -) +set(sunlinsol_superlumt_dependencies test_sunlinsol) # Add source directory to include directories include_directories(. ..) @@ -43,8 +39,8 @@ foreach(example_tuple ${sunlinsol_superlumt_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunlinsol.c) @@ -53,11 +49,9 @@ foreach(example_tuple ${sunlinsol_superlumt_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixdense - sundials_sunmatrixsparse - sundials_sunlinsolsuperlumt + target_link_libraries( + ${example} sundials_nvecserial sundials_sunmatrixdense + sundials_sunmatrixsparse sundials_sunlinsolsuperlumt ${EXE_EXTRA_LINK_LIBS}) endif() @@ -69,21 +63,19 @@ foreach(example_tuple ${sunlinsol_superlumt_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunlinsol.h - ../test_sunlinsol.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/superlumt) + install(FILES ${example}.c ../test_sunlinsol.h ../test_sunlinsol.c + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/superlumt) endif() endforeach(example_tuple ${sunlinsol_superlumt_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -93,8 +85,8 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunlinsolsuperlumt") set(LIBS "${LIBS} -lsundials_sunmatrixdense -lsundials_sunmatrixsparse") - # Set the link directory for the dense and sparse sunmatrix libraries - # The generated CMakeLists.txt does not use find_library() locate them + # Set the link directory for the dense and sparse sunmatrix libraries The + # generated CMakeLists.txt does not use find_library() locate them set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunlinsol_superlumt_examples EXAMPLES_SLUMT) @@ -107,39 +99,33 @@ if(EXAMPLES_INSTALL) endif() # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/superlumt - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/superlumt) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunlinsol/superlumt/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunlinsol/superlumt - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunmatrix/CMakeLists.txt b/examples/sunmatrix/CMakeLists.txt index ecb74f6faa..97fe929142 100644 --- a/examples/sunmatrix/CMakeLists.txt +++ b/examples/sunmatrix/CMakeLists.txt @@ -28,8 +28,10 @@ add_subdirectory(sparse) # Build the sunmatrix test utilities add_library(test_sunmatrix_obj OBJECT test_sunmatrix.c test_sunmatrix.h) if(BUILD_SHARED_LIBS) - # need PIC when shared libs are used since the example executables will link to the shared lib - set_property(TARGET test_sunmatrix_obj PROPERTY POSITION_INDEPENDENT_CODE TRUE) + # need PIC when shared libs are used since the example executables will link + # to the shared lib + set_property(TARGET test_sunmatrix_obj PROPERTY POSITION_INDEPENDENT_CODE + TRUE) endif() target_link_libraries(test_sunmatrix_obj PRIVATE sundials_sunmatrixdense) diff --git a/examples/sunmatrix/band/CMakeLists.txt b/examples/sunmatrix/band/CMakeLists.txt index 1db5a837a3..fa6848a4c9 100644 --- a/examples/sunmatrix/band/CMakeLists.txt +++ b/examples/sunmatrix/band/CMakeLists.txt @@ -15,26 +15,20 @@ # CMakeLists.txt file for banded sunmatrix examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS banded matrix set(sunmatrix_band_examples - "test_sunmatrix_band\;10 2 3 0\;" - "test_sunmatrix_band\;300 7 4 0\;" - "test_sunmatrix_band\;1000 8 8 0\;" - "test_sunmatrix_band\;5000 3 20 0\;" -) + "test_sunmatrix_band\;10 2 3 0\;" "test_sunmatrix_band\;300 7 4 0\;" + "test_sunmatrix_band\;1000 8 8 0\;" "test_sunmatrix_band\;5000 3 20 0\;") # Dependencies for sunmatrix examples -set(sunmatrix_band_dependencies - test_sunmatrix - ) +set(sunmatrix_band_dependencies test_sunmatrix) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunmatrix_band_fortran_examples - "test_fsunmatrix_band_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunmatrix_band_fortran_examples "test_fsunmatrix_band_mod\;\;") endif() # Add source directory to include directories @@ -48,8 +42,8 @@ foreach(example_tuple ${sunmatrix_band_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunmatrix.c) @@ -58,10 +52,8 @@ foreach(example_tuple ${sunmatrix_band_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixband - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial sundials_sunmatrixband + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -72,17 +64,16 @@ foreach(example_tuple ${sunmatrix_band_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunmatrix.c - ../test_sunmatrix.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/band) + install(FILES ${example}.c ../test_sunmatrix.c ../test_sunmatrix.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/band) endif() endforeach(example_tuple ${sunmatrix_band_examples}) @@ -95,14 +86,17 @@ foreach(example_tuple ${sunmatrix_band_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.f90) @@ -110,12 +104,9 @@ foreach(example_tuple ${sunmatrix_band_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunmatrixband - sundials_fsunmatrixband_mod - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunmatrixband sundials_fsunmatrixband_mod ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -126,7 +117,8 @@ foreach(example_tuple ${sunmatrix_band_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -145,39 +137,32 @@ if(EXAMPLES_INSTALL) examples2string(sunmatrix_band_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/band - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/band) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/band/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/band - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunmatrix/cusparse/CMakeLists.txt b/examples/sunmatrix/cusparse/CMakeLists.txt index 5f3e2d0707..d3b3782fea 100644 --- a/examples/sunmatrix/cusparse/CMakeLists.txt +++ b/examples/sunmatrix/cusparse/CMakeLists.txt @@ -14,14 +14,13 @@ # CMakeLists.txt file for SUNMATRIX_CUSPARSE examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the -# type is develop for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is develop for +# examples excluded from 'make test' in releases set(examples_list - "test_sunmatrix_cusparse.cu\;random 100 100 1 CSR 0\;" - "test_sunmatrix_cusparse.cu\;random 101 100 1 CSR 0\;" - "test_sunmatrix_cusparse.cu\;random 10 10 50 BCSR 0\;" - "test_sunmatrix_cusparse.cu\;random 100 100 5 BCSR 0\;" - ) + "test_sunmatrix_cusparse.cu\;random 100 100 1 CSR 0\;" + "test_sunmatrix_cusparse.cu\;random 101 100 1 CSR 0\;" + "test_sunmatrix_cusparse.cu\;random 10 10 50 BCSR 0\;" + "test_sunmatrix_cusparse.cu\;random 100 100 5 BCSR 0\;") # Add source directory to include directories include_directories(. ..) @@ -37,24 +36,22 @@ foreach(example_tuple ${examples_list}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunmatrix.c ../dreadrb.c) + add_executable(${example_target} ${example} ../test_sunmatrix.c + ../dreadrb.c) # folder to organize targets in an IDE set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} PRIVATE - sundials_nvecserial - sundials_nveccuda - sundials_sunmatrixdense - sundials_sunmatrixsparse - sundials_sunmatrixcusparse - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example_target} + PRIVATE sundials_nvecserial sundials_nveccuda sundials_sunmatrixdense + sundials_sunmatrixsparse sundials_sunmatrixcusparse + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -65,7 +62,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -74,27 +72,17 @@ endforeach() if(EXAMPLES_INSTALL) - sundials_install_examples(sunmatrix_cusparse examples_list - EXAMPLES_DEPENDENCIES - test_sunmatrix.c - test_sunmatrix.h - dreadrb.c - dreadrb.h + sundials_install_examples( + sunmatrix_cusparse examples_list + EXAMPLES_DEPENDENCIES test_sunmatrix.c test_sunmatrix.h dreadrb.c dreadrb.h EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/dreadrb.c ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/dreadrb.h - CMAKE_TEMPLATE - cmakelists_CUDA_ex.in - SUNDIALS_TARGETS - nveccuda - nvecserial - sunmatrixdense - sunmatrixsparse - sunmatrixcusparse - DESTINATION - sunmatrix/cusparse - ) + CMAKE_TEMPLATE cmakelists_CUDA_ex.in + SUNDIALS_TARGETS nveccuda nvecserial sunmatrixdense sunmatrixsparse + sunmatrixcusparse + DESTINATION sunmatrix/cusparse) endif() diff --git a/examples/sunmatrix/dense/CMakeLists.txt b/examples/sunmatrix/dense/CMakeLists.txt index e5e5f9a346..577abf7011 100644 --- a/examples/sunmatrix/dense/CMakeLists.txt +++ b/examples/sunmatrix/dense/CMakeLists.txt @@ -15,25 +15,20 @@ # CMakeLists.txt file for dense sunmatrix examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS dense matrix set(sunmatrix_dense_examples - "test_sunmatrix_dense\;100 100 0\;" - "test_sunmatrix_dense\;200 1000 0\;" - "test_sunmatrix_dense\;2000 100 0\;" - ) + "test_sunmatrix_dense\;100 100 0\;" "test_sunmatrix_dense\;200 1000 0\;" + "test_sunmatrix_dense\;2000 100 0\;") # Dependencies for sunmatrix examples -set(sunmatrix_dense_dependencies - test_sunmatrix - ) +set(sunmatrix_dense_dependencies test_sunmatrix) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunmatrix_dense_fortran_examples - "test_fsunmatrix_dense_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunmatrix_dense_fortran_examples "test_fsunmatrix_dense_mod\;\;") endif() # Add source directory to include directories @@ -47,8 +42,8 @@ foreach(example_tuple ${sunmatrix_dense_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunmatrix.c) @@ -57,10 +52,8 @@ foreach(example_tuple ${sunmatrix_dense_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixdense - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${example} sundials_nvecserial + sundials_sunmatrixdense ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -71,17 +64,16 @@ foreach(example_tuple ${sunmatrix_dense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunmatrix.c - ../test_sunmatrix.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/dense) + install(FILES ${example}.c ../test_sunmatrix.c ../test_sunmatrix.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/dense) endif() endforeach(example_tuple ${sunmatrix_dense_examples}) @@ -94,13 +86,16 @@ foreach(example_tuple ${sunmatrix_dense_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.f90) @@ -108,11 +103,9 @@ foreach(example_tuple ${sunmatrix_dense_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_fnvecserial_mod - sundials_sunmatrixdense - sundials_fsunmatrixdense_mod + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod + sundials_sunmatrixdense sundials_fsunmatrixdense_mod ${EXE_EXTRA_LINK_LIBS}) endif() @@ -124,14 +117,14 @@ foreach(example_tuple ${sunmatrix_dense_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach(example_tuple ${sunmatrix_dense_fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -144,39 +137,32 @@ if(EXAMPLES_INSTALL) examples2string(sunmatrix_dense_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/dense - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/dense) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/dense/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/dense - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunmatrix/ginkgo/CMakeLists.txt b/examples/sunmatrix/ginkgo/CMakeLists.txt index 0e17ab0821..84c7a14873 100644 --- a/examples/sunmatrix/ginkgo/CMakeLists.txt +++ b/examples/sunmatrix/ginkgo/CMakeLists.txt @@ -12,21 +12,21 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases set(examples - "test_sunmatrix_ginkgo.cpp\;100 100 0\;" - "test_sunmatrix_ginkgo.cpp\;100 10 0\;" - "test_sunmatrix_ginkgo.cpp\;10 100 0\;" - "test_sunmatrix_ginkgo.cpp\;100 100 1\;" - "test_sunmatrix_ginkgo.cpp\;100 10 1\;" - "test_sunmatrix_ginkgo.cpp\;10 100 1\;" -) + "test_sunmatrix_ginkgo.cpp\;100 100 0\;" + "test_sunmatrix_ginkgo.cpp\;100 10 0\;" + "test_sunmatrix_ginkgo.cpp\;10 100 0\;" + "test_sunmatrix_ginkgo.cpp\;100 100 1\;" + "test_sunmatrix_ginkgo.cpp\;100 10 1\;" + "test_sunmatrix_ginkgo.cpp\;10 100 1\;") # Add source directory to include directories include_directories(..) -sundials_add_examples_ginkgo(examples +sundials_add_examples_ginkgo( + examples TARGETS test_sunmatrix_obj sundials_sunmatrixdense BACKENDS REF OMP CUDA HIP SYCL UNIT_TEST) @@ -50,19 +50,13 @@ if(EXAMPLES_INSTALL) list(APPEND vectors nvecserial) endif() - sundials_install_examples_ginkgo(sunmatrix - CPU_GPU_EXAMPLES_VAR - examples - SUNDIALS_COMPONENTS - sunmatrixdense - ${vectors} - SUNDIALS_TARGETS - sunmatrixdense - DEPENDENCIES - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h - DESTINATION - sunmatrix/ginkgo - ) + sundials_install_examples_ginkgo( + sunmatrix + CPU_GPU_EXAMPLES_VAR examples + SUNDIALS_COMPONENTS sunmatrixdense ${vectors} + SUNDIALS_TARGETS sunmatrixdense + DEPENDENCIES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c + ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h + DESTINATION sunmatrix/ginkgo) endif() diff --git a/examples/sunmatrix/kokkos/CMakeLists.txt b/examples/sunmatrix/kokkos/CMakeLists.txt index 7a0b0ad6b7..3a8a96b61b 100644 --- a/examples/sunmatrix/kokkos/CMakeLists.txt +++ b/examples/sunmatrix/kokkos/CMakeLists.txt @@ -12,16 +12,15 @@ # SUNDIALS Copyright End # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases set(examples_list - "test_sunmatrix_kokkosdense.cpp\;100 100 1 0\;" - "test_sunmatrix_kokkosdense.cpp\;200 1000 1 0\;" - "test_sunmatrix_kokkosdense.cpp\;2000 100 1 0\;" - "test_sunmatrix_kokkosdense.cpp\;10 10 100 0\;" - "test_sunmatrix_kokkosdense.cpp\;200 10 100 0\;" - "test_sunmatrix_kokkosdense.cpp\;10 200 100 0\;" - ) + "test_sunmatrix_kokkosdense.cpp\;100 100 1 0\;" + "test_sunmatrix_kokkosdense.cpp\;200 1000 1 0\;" + "test_sunmatrix_kokkosdense.cpp\;2000 100 1 0\;" + "test_sunmatrix_kokkosdense.cpp\;10 10 100 0\;" + "test_sunmatrix_kokkosdense.cpp\;200 10 100 0\;" + "test_sunmatrix_kokkosdense.cpp\;10 200 100 0\;") # Add source directory to include directories include_directories(..) @@ -39,10 +38,10 @@ foreach(example_tuple ${examples_list}) get_filename_component(example_target ${example} NAME_WE) set(example_target "${example_target}.${backend}") - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunmatrix.c ../test_sunmatrix.h) + add_executable(${example_target} ${example} ../test_sunmatrix.c + ../test_sunmatrix.h) # folder for IDEs set_target_properties(${example_target} PROPERTIES FOLDER "Examples") @@ -51,13 +50,10 @@ foreach(example_tuple ${examples_list}) target_compile_definitions(${example_target} PRIVATE USE_${backend}) # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_core - sundials_nveckokkos - sundials_sunmatrixkokkosdense - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE sundials_core sundials_nveckokkos sundials_sunmatrixkokkosdense + ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -68,7 +64,8 @@ foreach(example_tuple ${examples_list}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -78,24 +75,15 @@ endforeach() if(EXAMPLES_INSTALL) - sundials_install_examples(sunmatrix_kokkosdense examples_list - EXAMPLES_DEPENDENCIES - test_sunmatrix.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_COMPONENTS - nveckokkos - sunmatrixkokkosdense - SUNDIALS_TARGETS - generic - OTHER_TARGETS - Kokkos::kokkos - Kokkos::kokkoskernels - DESTINATION - sunmatrix/kokkos - ) + sundials_install_examples( + sunmatrix_kokkosdense examples_list + EXAMPLES_DEPENDENCIES test_sunmatrix.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c + ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_COMPONENTS nveckokkos sunmatrixkokkosdense + SUNDIALS_TARGETS generic + OTHER_TARGETS Kokkos::kokkos Kokkos::kokkoskernels + DESTINATION sunmatrix/kokkos) endif() diff --git a/examples/sunmatrix/magmadense/CMakeLists.txt b/examples/sunmatrix/magmadense/CMakeLists.txt index 5879aabb33..e860458d25 100644 --- a/examples/sunmatrix/magmadense/CMakeLists.txt +++ b/examples/sunmatrix/magmadense/CMakeLists.txt @@ -12,25 +12,26 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS MAGMA dense matrix set(sunmatrix_magmadense_examples - "test_sunmatrix_magmadense.cpp\;100 100 1 0\;" - "test_sunmatrix_magmadense.cpp\;200 1000 1 0\;" - "test_sunmatrix_magmadense.cpp\;2000 100 1 0\;" - "test_sunmatrix_magmadense.cpp\;10 10 100 0\;" - "test_sunmatrix_magmadense.cpp\;200 10 100 0\;" - "test_sunmatrix_magmadense.cpp\;10 200 100 0\;" - ) + "test_sunmatrix_magmadense.cpp\;100 100 1 0\;" + "test_sunmatrix_magmadense.cpp\;200 1000 1 0\;" + "test_sunmatrix_magmadense.cpp\;2000 100 1 0\;" + "test_sunmatrix_magmadense.cpp\;10 10 100 0\;" + "test_sunmatrix_magmadense.cpp\;200 10 100 0\;" + "test_sunmatrix_magmadense.cpp\;10 200 100 0\;") if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") - set_source_files_properties(test_sunmatrix_magmadense.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(test_sunmatrix_magmadense.cpp PROPERTIES LANGUAGE + CUDA) set(vector nveccuda) set(cuda_or_hip CUDA) elseif(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") - set_source_files_properties(test_sunmatrix_magmadense.cpp PROPERTIES LANGUAGE CXX) + set_source_files_properties(test_sunmatrix_magmadense.cpp PROPERTIES LANGUAGE + CXX) set(vector nvechip) set(cuda_or_hip HIP) endif() @@ -49,21 +50,18 @@ foreach(example_tuple ${sunmatrix_magmadense_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} ../test_sunmatrix.c ../test_sunmatrix.h) + add_executable(${example_target} ${example} ../test_sunmatrix.c + ../test_sunmatrix.h) # folder for IDEs set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - sundials_${vector} - sundials_sunmatrixmagmadense - SUNDIALS::MAGMA - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} PRIVATE sundials_${vector} sundials_sunmatrixmagmadense + SUNDIALS::MAGMA ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -74,7 +72,8 @@ foreach(example_tuple ${sunmatrix_magmadense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -83,19 +82,13 @@ endforeach(example_tuple ${sunmatrix_magmadense_examples}) if(EXAMPLES_INSTALL) - sundials_install_examples(sunmatrix_magma sunmatrix_magmadense_examples - EXAMPLES_DEPENDENCIES - test_sunmatrix.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h - CMAKE_TEMPLATE - cmakelists_${cuda_or_hip}_ex.in - SUNDIALS_TARGETS - ${vector} - sunmatrixmagmadense - DESTINATION - sunmatrix/magmadense - ) + sundials_install_examples( + sunmatrix_magma sunmatrix_magmadense_examples + EXAMPLES_DEPENDENCIES test_sunmatrix.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c + ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h + CMAKE_TEMPLATE cmakelists_${cuda_or_hip}_ex.in + SUNDIALS_TARGETS ${vector} sunmatrixmagmadense + DESTINATION sunmatrix/magmadense) endif() diff --git a/examples/sunmatrix/onemkldense/CMakeLists.txt b/examples/sunmatrix/onemkldense/CMakeLists.txt index f893de6ec7..80f51a86ea 100644 --- a/examples/sunmatrix/onemkldense/CMakeLists.txt +++ b/examples/sunmatrix/onemkldense/CMakeLists.txt @@ -12,18 +12,17 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS ONEMKL dense matrix set(sunmatrix_onemkldense_examples - "test_sunmatrix_onemkldense.cpp\;100 100 1 0\;" - "test_sunmatrix_onemkldense.cpp\;200 1000 1 0\;" - "test_sunmatrix_onemkldense.cpp\;2000 100 1 0\;" - "test_sunmatrix_onemkldense.cpp\;10 10 100 0\;" - "test_sunmatrix_onemkldense.cpp\;200 10 100 0\;" - "test_sunmatrix_onemkldense.cpp\;10 200 100 0\;" - ) + "test_sunmatrix_onemkldense.cpp\;100 100 1 0\;" + "test_sunmatrix_onemkldense.cpp\;200 1000 1 0\;" + "test_sunmatrix_onemkldense.cpp\;2000 100 1 0\;" + "test_sunmatrix_onemkldense.cpp\;10 10 100 0\;" + "test_sunmatrix_onemkldense.cpp\;200 10 100 0\;" + "test_sunmatrix_onemkldense.cpp\;10 200 100 0\;") # Add source directory to include directories include_directories(. ..) @@ -39,7 +38,7 @@ foreach(example_tuple ${sunmatrix_onemkldense_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - if (NOT TARGET ${example_target}) + if(NOT TARGET ${example_target}) # example source files add_executable(${example_target} ${example}) @@ -48,14 +47,11 @@ foreach(example_tuple ${sunmatrix_onemkldense_examples}) set_target_properties(${example_target} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example_target} - PRIVATE - test_sunmatrix_obj - sundials_nvecsycl - sundials_sunmatrixonemkldense - MKL::MKL_DPCPP - ${EXE_EXTRA_LINK_LIBS} - ) + target_link_libraries( + ${example_target} + PRIVATE test_sunmatrix_obj sundials_nvecsycl + sundials_sunmatrixonemkldense MKL::MKL_DPCPP + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -67,31 +63,24 @@ foreach(example_tuple ${sunmatrix_onemkldense_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach() - if(EXAMPLES_INSTALL) - sundials_install_examples(sunmatrix_onemkl sunmatrix_onemkldense_examples - EXAMPLES_DEPENDENCIES - test_sunmatrix.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h - CMAKE_TEMPLATE - cmakelists_CXX_ex.in - SUNDIALS_TARGETS - nvecsycl - sunmatrixonemkldense - OTHER_TARGETS - MKL::MKL_DPCPP - DESTINATION - sunmatrix/onemkldense - ) + sundials_install_examples( + sunmatrix_onemkl sunmatrix_onemkldense_examples + EXAMPLES_DEPENDENCIES test_sunmatrix.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c + ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h + CMAKE_TEMPLATE cmakelists_CXX_ex.in + SUNDIALS_TARGETS nvecsycl sunmatrixonemkldense + OTHER_TARGETS MKL::MKL_DPCPP + DESTINATION sunmatrix/onemkldense) endif() diff --git a/examples/sunmatrix/slunrloc/CMakeLists.txt b/examples/sunmatrix/slunrloc/CMakeLists.txt index 94f96cf354..5e71ed0580 100644 --- a/examples/sunmatrix/slunrloc/CMakeLists.txt +++ b/examples/sunmatrix/slunrloc/CMakeLists.txt @@ -14,22 +14,19 @@ # CMakeLists.txt file for slunrloc_sunmatrix examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;nodes\;type" where the -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;nodes\;type" where the 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS SUNMatrix wrapper of the SuperLU SLU_NR_loc # SuperMatrix. set(sunmatrix_slunrloc_examples - "test_sunmatrix_slunrloc.cpp\;100 1 1 0 0\;1\;\;" - "test_sunmatrix_slunrloc.cpp\;400 2 1 0 0\;2\;\;" - "test_sunmatrix_slunrloc.cpp\;600 3 1 0 0\;3\;\;" - "test_sunmatrix_slunrloc.cpp\;1000 1 4 0 0\;4\;\;" -) + "test_sunmatrix_slunrloc.cpp\;100 1 1 0 0\;1\;\;" + "test_sunmatrix_slunrloc.cpp\;400 2 1 0 0\;2\;\;" + "test_sunmatrix_slunrloc.cpp\;600 3 1 0 0\;3\;\;" + "test_sunmatrix_slunrloc.cpp\;1000 1 4 0 0\;4\;\;") # Dependencies for sunmatrix examples -set(sunmatrix_slunrloc_dependencies - test_sunmatrix - ) +set(sunmatrix_slunrloc_dependencies test_sunmatrix) # Add the build and install targets for each example foreach(example_tuple ${sunmatrix_slunrloc_examples}) @@ -42,12 +39,11 @@ foreach(example_tuple ${sunmatrix_slunrloc_examples}) # extract the file name without extension get_filename_component(example_target ${example} NAME_WE) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example_target}) # example source files - add_executable(${example_target} ${example} - ../test_sunmatrix.c) + add_executable(${example_target} ${example} ../test_sunmatrix.c) # folder to organize targets in an IDE set_target_properties(${example_target} PROPERTIES FOLDER "Examples") @@ -55,13 +51,10 @@ foreach(example_tuple ${sunmatrix_slunrloc_examples}) target_include_directories(${example_target} PRIVATE . ..) # libraries to link against - target_link_libraries(${example_target} - PRIVATE - MPI::MPI_CXX - sundials_sunmatrixslunrloc - sundials_sunmatrixdense - sundials_nvecparallel - sundials_nvecserial) + target_link_libraries( + ${example_target} + PRIVATE MPI::MPI_CXX sundials_sunmatrixslunrloc sundials_sunmatrixdense + sundials_nvecparallel sundials_nvecserial) endif() # check if example args are provided and set the test name @@ -69,18 +62,21 @@ foreach(example_tuple ${sunmatrix_slunrloc_examples}) if("${number_of_nodes}" STREQUAL "") set(test_name ${example_target}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_nodes}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_nodes}) endif() else() if("${number_of_nodes}" STREQUAL "") string(REGEX REPLACE " " "_" test_name ${example_target}_${example_args}) else() - string(REGEX REPLACE " " "_" test_name ${example_target}_${number_of_nodes}_${example_args}) + string(REGEX REPLACE " " "_" test_name + ${example_target}_${number_of_nodes}_${example_args}) endif() endif() # add example to regression tests - sundials_add_test(${test_name} ${example_target} + sundials_add_test( + ${test_name} ${example_target} TEST_ARGS ${example_args} MPI_NPROCS ${number_of_nodes} EXAMPLE_TYPE ${example_type} @@ -98,21 +94,13 @@ endif() if(EXAMPLES_INSTALL) - sundials_install_examples(sunmatrix_slunrloc sunmatrix_slunrloc_examples - EXAMPLES_DEPENDENCIES - test_sunmatrix.c - EXTRA_FILES - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c - ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h - CMAKE_TEMPLATE - cmakelists_${_ex_lang}_MPI_ex.in - SUNDIALS_TARGETS - nvecserial - nvecparallel - sunmatrixdense - sunmatrixslunrloc - DESTINATION - sunmatrix/slunrloc - ) + sundials_install_examples( + sunmatrix_slunrloc sunmatrix_slunrloc_examples + EXAMPLES_DEPENDENCIES test_sunmatrix.c + EXTRA_FILES ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.c + ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.h + CMAKE_TEMPLATE cmakelists_${_ex_lang}_MPI_ex.in + SUNDIALS_TARGETS nvecserial nvecparallel sunmatrixdense sunmatrixslunrloc + DESTINATION sunmatrix/slunrloc) endif() diff --git a/examples/sunmatrix/sparse/CMakeLists.txt b/examples/sunmatrix/sparse/CMakeLists.txt index ee04a96b8d..9e2ad0d9db 100644 --- a/examples/sunmatrix/sparse/CMakeLists.txt +++ b/examples/sunmatrix/sparse/CMakeLists.txt @@ -15,28 +15,24 @@ # CMakeLists.txt file for sparse sunmatrix examples # --------------------------------------------------------------- -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Examples using SUNDIALS sparse matrix set(sunmatrix_sparse_examples - "test_sunmatrix_sparse\;400 400 0 0\;" - "test_sunmatrix_sparse\;450 450 1 0\;" - "test_sunmatrix_sparse\;200 1000 0 0\;" - "test_sunmatrix_sparse\;6000 350 0 0\;" - "test_sunmatrix_sparse\;500 5000 1 0\;" - "test_sunmatrix_sparse\;4000 800 1 0\;" -) + "test_sunmatrix_sparse\;400 400 0 0\;" + "test_sunmatrix_sparse\;450 450 1 0\;" + "test_sunmatrix_sparse\;200 1000 0 0\;" + "test_sunmatrix_sparse\;6000 350 0 0\;" + "test_sunmatrix_sparse\;500 5000 1 0\;" + "test_sunmatrix_sparse\;4000 800 1 0\;") # Dependencies for sunmatrix examples -set(sunmatrix_sparse_dependencies - test_sunmatrix - ) +set(sunmatrix_sparse_dependencies test_sunmatrix) # If building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(sunmatrix_sparse_fortran_examples - "test_fsunmatrix_sparse_mod\;\;") +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(sunmatrix_sparse_fortran_examples "test_fsunmatrix_sparse_mod\;\;") endif() # Add source directory to include directories @@ -50,8 +46,8 @@ foreach(example_tuple ${sunmatrix_sparse_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c ../test_sunmatrix.c) @@ -60,12 +56,9 @@ foreach(example_tuple ${sunmatrix_sparse_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} - sundials_nvecserial - sundials_sunmatrixdense - sundials_sunmatrixband - sundials_sunmatrixsparse - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries( + ${example} sundials_nvecserial sundials_sunmatrixdense + sundials_sunmatrixband sundials_sunmatrixsparse ${EXE_EXTRA_LINK_LIBS}) endif() # check if example args are provided and set the test name @@ -76,17 +69,16 @@ foreach(example_tuple ${sunmatrix_sparse_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) # install example source files if(EXAMPLES_INSTALL) - install(FILES ${example}.c - ../test_sunmatrix.c - ../test_sunmatrix.h - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/sparse) + install(FILES ${example}.c ../test_sunmatrix.c ../test_sunmatrix.h + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/sparse) endif() endforeach(example_tuple ${sunmatrix_sparse_examples}) @@ -99,13 +91,16 @@ foreach(example_tuple ${sunmatrix_sparse_fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) - add_executable(${example} ${example}.f90 + add_executable( + ${example} + ${example}.f90 ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90 ${SUNDIALS_SOURCE_DIR}/examples/sunmatrix/test_sunmatrix.f90) @@ -113,7 +108,8 @@ foreach(example_tuple ${sunmatrix_sparse_fortran_examples}) set_target_properties(${example} PROPERTIES FOLDER "Examples") # libraries to link against - target_link_libraries(${example} + target_link_libraries( + ${example} sundials_nvecserial sundials_fnvecserial_mod sundials_sunmatrixdense @@ -133,7 +129,8 @@ foreach(example_tuple ${sunmatrix_sparse_fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) @@ -149,47 +146,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunmatrixsparse") set(LIBS "${LIBS} -lsundials_sunmatrixdense -lsundials_sunmatrixband") - # Set the link directory for the dense and band sunmatrix libraries - # The generated CMakeLists.txt does not use find_library() locate them + # Set the link directory for the dense and band sunmatrix libraries The + # generated CMakeLists.txt does not use find_library() locate them set(EXTRA_LIBS_DIR "${libdir}") examples2string(sunmatrix_sparse_examples EXAMPLES) examples2string(sunmatrix_sparse_dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/CMakeLists.txt @ONLY) # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/sparse - ) + install(FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/CMakeLists.txt + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/sparse) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunmatrix/sparse/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunmatrix/sparse - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunnonlinsol/CMakeLists.txt b/examples/sunnonlinsol/CMakeLists.txt index 1ddeaa93d9..e6e1866860 100644 --- a/examples/sunnonlinsol/CMakeLists.txt +++ b/examples/sunnonlinsol/CMakeLists.txt @@ -24,5 +24,5 @@ add_subdirectory(newton) add_subdirectory(fixedpoint) if(BUILD_SUNNONLINSOL_PETSCSNES) - add_subdirectory(petsc) -endif() \ No newline at end of file + add_subdirectory(petsc) +endif() diff --git a/examples/sunnonlinsol/fixedpoint/CMakeLists.txt b/examples/sunnonlinsol/fixedpoint/CMakeLists.txt index 834af69c2e..240259040a 100644 --- a/examples/sunnonlinsol/fixedpoint/CMakeLists.txt +++ b/examples/sunnonlinsol/fixedpoint/CMakeLists.txt @@ -14,21 +14,17 @@ # CMakeLists.txt file for sunnonlinsol fixedpoint examples # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Example programs set(examples - "test_sunnonlinsol_fixedpoint\;\;" - "test_sunnonlinsol_fixedpoint\;2\;" - "test_sunnonlinsol_fixedpoint\;2 0.5\;" -) + "test_sunnonlinsol_fixedpoint\;\;" "test_sunnonlinsol_fixedpoint\;2\;" + "test_sunnonlinsol_fixedpoint\;2 0.5\;") # if building F2003 tests -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(fortran_examples - "test_fsunnonlinsol_fixedpoint_mod\;\;" - ) +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(fortran_examples "test_fsunnonlinsol_fixedpoint_mod\;\;") endif() # Add source directory to include directories @@ -53,8 +49,8 @@ foreach(example_tuple ${examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -74,14 +70,15 @@ foreach(example_tuple ${examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) if(EXAMPLES_INSTALL) install(FILES ${example}.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/fixedpoint) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/fixedpoint) endif() endforeach(example_tuple ${examples}) @@ -94,15 +91,17 @@ foreach(example_tuple ${fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 - ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90) + add_executable( + ${example} ${example}.f90 + ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -119,14 +118,14 @@ foreach(example_tuple ${fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach(example_tuple ${fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -136,46 +135,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunnonlinsolfixedpoint") set(LIBS "${LIBS} -lsundials_sunmatrixdense -lsundials_sunlinsoldense") - # Set the link directory for the dense sunmatrix and linear solver library - # The generated CMakeLists.txt does not use find_library() locate it + # Set the link directory for the dense sunmatrix and linear solver library The + # generated CMakeLists.txt does not use find_library() locate it set(EXTRA_LIBS_DIR "${libdir}") examples2string(examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/fixedpoint - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/fixedpoint) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/fixedpoint/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/fixedpoint - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunnonlinsol/newton/CMakeLists.txt b/examples/sunnonlinsol/newton/CMakeLists.txt index 2f3413bd0b..d440789afb 100644 --- a/examples/sunnonlinsol/newton/CMakeLists.txt +++ b/examples/sunnonlinsol/newton/CMakeLists.txt @@ -14,18 +14,14 @@ # CMakeLists.txt file for sunnonlinsol Newton examples # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Example programs -set(examples - "test_sunnonlinsol_newton\;\;" -) - -if (BUILD_FORTRAN_MODULE_INTERFACE) - set(fortran_examples - "test_fsunnonlinsol_newton_mod\;\;" - ) +set(examples "test_sunnonlinsol_newton\;\;") + +if(BUILD_FORTRAN_MODULE_INTERFACE) + set(fortran_examples "test_fsunnonlinsol_newton_mod\;\;") endif() # Add source directory to include directories @@ -54,8 +50,8 @@ foreach(example_tuple ${examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -75,14 +71,15 @@ foreach(example_tuple ${examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) if(EXAMPLES_INSTALL) install(FILES ${example}.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/newton) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/newton) endif() endforeach(example_tuple ${examples}) @@ -95,15 +92,17 @@ foreach(example_tuple ${fortran_examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # build fortran modules into a unique directory to avoid naming collisions - set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) + set(CMAKE_Fortran_MODULE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir) # example source files - add_executable(${example} ${example}.f90 - ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90) + add_executable( + ${example} ${example}.f90 + ${SUNDIALS_SOURCE_DIR}/examples/utilities/test_utilities.f90) # folder to organize targets in an IDE set_target_properties(${example} PROPERTIES FOLDER "Examples") @@ -120,14 +119,14 @@ foreach(example_tuple ${fortran_examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) endforeach(example_tuple ${fortran_examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -137,46 +136,40 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunnonlinsolnewton") set(LIBS "${LIBS} -lsundials_sunmatrixdense -lsundials_sunlinsoldense") - # Set the link directory for the dense sunmatrix and linear solver library - # The generated CMakeLists.txt does not use find_library() locate it + # Set the link directory for the dense sunmatrix and linear solver library The + # generated CMakeLists.txt does not use find_library() locate it set(EXTRA_LIBS_DIR "${libdir}") examples2string(examples EXAMPLES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/newton - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/newton) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/newton/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/newton - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/examples/sunnonlinsol/petsc/CMakeLists.txt b/examples/sunnonlinsol/petsc/CMakeLists.txt index 59a5dbd2c0..7146134ea8 100644 --- a/examples/sunnonlinsol/petsc/CMakeLists.txt +++ b/examples/sunnonlinsol/petsc/CMakeLists.txt @@ -14,13 +14,11 @@ # CMakeLists.txt file for sunnonlinsol PetscSNES tests # ------------------------------------------------------------------------------ -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases +# Example lists are tuples "name\;args\;type" where the type is 'develop' for +# examples excluded from 'make test' in releases # Example programs -set(examples - "test_sunnonlinsol_petscsnes\;\;" -) +set(examples "test_sunnonlinsol_petscsnes\;\;") if(MPI_C_COMPILER) # use MPI wrapper as the compiler @@ -45,8 +43,8 @@ foreach(example_tuple ${examples}) list(GET example_tuple 1 example_args) list(GET example_tuple 2 example_type) - # check if this example has already been added, only need to add - # example source files once for testing with different inputs + # check if this example has already been added, only need to add example + # source files once for testing with different inputs if(NOT TARGET ${example}) # example source files add_executable(${example} ${example}.c) @@ -66,19 +64,19 @@ foreach(example_tuple ${examples}) endif() # add example to regression tests - sundials_add_test(${test_name} ${example} + sundials_add_test( + ${test_name} ${example} TEST_ARGS ${example_args} EXAMPLE_TYPE ${example_type} NODIFF) if(EXAMPLES_INSTALL) install(FILES ${example}.c - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/petscsnes) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/petscsnes) endif() endforeach(example_tuple ${examples}) - if(EXAMPLES_INSTALL) # Install the README file @@ -88,47 +86,41 @@ if(EXAMPLES_INSTALL) set(SOLVER_LIB "sundials_sunnonlinsolpetscsnes") set(LIBS "${LIBS}") - # Set the link directory for the dense sunmatrix and linear solver library - # The generated CMakeLists.txt does not use find_library() locate it + # Set the link directory for the dense sunmatrix and linear solver library The + # generated CMakeLists.txt does not use find_library() locate it set(EXTRA_LIBS_DIR "${libdir}") examples2string(examples EXAMPLES) examples2string(dependencies EXAMPLES_DEPENDENCIES) # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. + # CMakeLists.txt file for building the examples. This file can then be used + # as a template for the user's own programs. # generate CMakelists.txt in the binary directory configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/CMakeLists.txt - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/CMakeLists.txt @ONLY) # install CMakelists.txt install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/petscsnes - ) + DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/petscsnes) # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. + # building the examples. This makefile can then be used as a template for the + # user's own programs. if(UNIX) # generate Makefile and place it in the binary dir configure_file( ${PROJECT_SOURCE_DIR}/examples/templates/makefile_petsc_C_ex.in - ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/Makefile_ex - @ONLY - ) + ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/Makefile_ex @ONLY) # install the configured Makefile_ex as Makefile install( FILES ${PROJECT_BINARY_DIR}/examples/sunnonlinsol/petscsnes/Makefile_ex DESTINATION ${EXAMPLES_INSTALL_PATH}/sunnonlinsol/petscsnes - RENAME Makefile - ) + RENAME Makefile) endif() endif() diff --git a/scripts/format.sh b/scripts/format.sh index 38011b85c0..1c3c553e25 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -10,8 +10,8 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------------------------- -# This script will use clang-tidy and clang-format to format C/C++ code and -# fprettify for Fortran code. +# This script will use clang-format to format C/C++ code, fprettify for Fortran +# code, cmake-format for CMake files, and black for Python code. # # Usage: # ./format.sh @@ -27,9 +27,12 @@ fi paths=( "$@" ) find "${paths[@]}" -iname '*.h' -o -iname '*.hpp' -o \ - -iname '*.c' -o -iname '*.cpp' -o \ - -iname '*.cuh' -o -iname '*.cu' | grep -v fmod | xargs clang-format -i + -iname '*.c' -o -iname '*.cpp' -o \ + -iname '*.cuh' -o -iname '*.cu' | grep -v fmod | xargs clang-format -i find "${paths[@]}" -iname '*.f90' | grep -v fmod | xargs fprettify --indent 2 --enable-replacements --c-relations +find "${paths[@]}" \( -iname '*.cmake' -o -iname 'CMakeLists.txt' \) \ + -exec cmake-format -i {} ';' + find "${paths[@]}" -iname '*.py' -exec black {} ';' diff --git a/src/arkode/CMakeLists.txt b/src/arkode/CMakeLists.txt index 267bc89a33..f8a0f4be63 100644 --- a/src/arkode/CMakeLists.txt +++ b/src/arkode/CMakeLists.txt @@ -18,62 +18,57 @@ install(CODE "MESSAGE(\"\nInstall ARKODE\n\")") # Add variable arkode_SOURCES with the sources for the ARKODE library set(arkode_SOURCES - arkode_adapt.c - arkode_arkstep_io.c - arkode_arkstep_nls.c - arkode_arkstep.c - arkode_bandpre.c - arkode_bbdpre.c - arkode_butcher_dirk.c - arkode_butcher_erk.c - arkode_butcher.c - arkode_erkstep_io.c - arkode_erkstep.c - arkode_interp.c - arkode_io.c - arkode_ls.c - arkode_mri_tables.c - arkode_mristep_io.c - arkode_mristep_nls.c - arkode_mristep.c - arkode_relaxation.c - arkode_root.c - arkode_sprkstep_io.c - arkode_sprkstep.c - arkode_sprk.c - arkode_user_controller.c - arkode.c -) + arkode_adapt.c + arkode_arkstep_io.c + arkode_arkstep_nls.c + arkode_arkstep.c + arkode_bandpre.c + arkode_bbdpre.c + arkode_butcher_dirk.c + arkode_butcher_erk.c + arkode_butcher.c + arkode_erkstep_io.c + arkode_erkstep.c + arkode_interp.c + arkode_io.c + arkode_ls.c + arkode_mri_tables.c + arkode_mristep_io.c + arkode_mristep_nls.c + arkode_mristep.c + arkode_relaxation.c + arkode_root.c + arkode_sprkstep_io.c + arkode_sprkstep.c + arkode_sprk.c + arkode_user_controller.c + arkode.c) # Add variable arkode_HEADERS with the exported ARKODE header files set(arkode_HEADERS - arkode.h - arkode_arkstep.h - arkode_bandpre.h - arkode_bbdpre.h - arkode_butcher.h - arkode_butcher_dirk.h - arkode_butcher_erk.h - arkode_erkstep.h - arkode_ls.h - arkode_mristep.h - arkode_sprk.h - arkode_sprkstep.h -) + arkode.h + arkode_arkstep.h + arkode_bandpre.h + arkode_bbdpre.h + arkode_butcher.h + arkode_butcher_dirk.h + arkode_butcher_erk.h + arkode_erkstep.h + arkode_ls.h + arkode_mristep.h + arkode_sprk.h + arkode_sprkstep.h) # Add prefix with complete path to the ARKODE header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/arkode/ arkode_HEADERS) # Create the sundials_arkode library -sundials_add_library(sundials_arkode - SOURCES - ${arkode_SOURCES} - HEADERS - ${arkode_HEADERS} - INCLUDE_SUBDIR - arkode - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_arkode + SOURCES ${arkode_SOURCES} + HEADERS ${arkode_HEADERS} + INCLUDE_SUBDIR arkode + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -91,13 +86,9 @@ sundials_add_library(sundials_arkode sundials_sunlinsolpcg_obj sundials_sunnonlinsolnewton_obj sundials_sunnonlinsolfixedpoint_obj - OUTPUT_NAME - sundials_arkode - VERSION - ${arkodelib_VERSION} - SOVERSION - ${arkodelib_SOVERSION} -) + OUTPUT_NAME sundials_arkode + VERSION ${arkodelib_VERSION} + SOVERSION ${arkodelib_SOVERSION}) # Finished ARKODE message(STATUS "Added ARKODE module") diff --git a/src/arkode/fmod_int32/CMakeLists.txt b/src/arkode/fmod_int32/CMakeLists.txt index 32e5c935d7..4ae3e19a54 100644 --- a/src/arkode/fmod_int32/CMakeLists.txt +++ b/src/arkode/fmod_int32/CMakeLists.txt @@ -27,11 +27,10 @@ set(arkode_SOURCES farkode_mristep_mod.c) # Create the library -sundials_add_f2003_library(sundials_farkode_mod - SOURCES - ${arkode_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_farkode_mod + SOURCES ${arkode_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunadaptcontrollersoderlind_mod_obj @@ -48,12 +47,8 @@ sundials_add_f2003_library(sundials_farkode_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_farkode_mod - VERSION - ${arkodelib_VERSION} - SOVERSION - ${arkodelib_SOVERSION} -) + OUTPUT_NAME sundials_farkode_mod + VERSION ${arkodelib_VERSION} + SOVERSION ${arkodelib_SOVERSION}) message(STATUS "Added ARKODE F2003 interface") diff --git a/src/arkode/fmod_int64/CMakeLists.txt b/src/arkode/fmod_int64/CMakeLists.txt index 32e5c935d7..4ae3e19a54 100644 --- a/src/arkode/fmod_int64/CMakeLists.txt +++ b/src/arkode/fmod_int64/CMakeLists.txt @@ -27,11 +27,10 @@ set(arkode_SOURCES farkode_mristep_mod.c) # Create the library -sundials_add_f2003_library(sundials_farkode_mod - SOURCES - ${arkode_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_farkode_mod + SOURCES ${arkode_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunadaptcontrollersoderlind_mod_obj @@ -48,12 +47,8 @@ sundials_add_f2003_library(sundials_farkode_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_farkode_mod - VERSION - ${arkodelib_VERSION} - SOVERSION - ${arkodelib_SOVERSION} -) + OUTPUT_NAME sundials_farkode_mod + VERSION ${arkodelib_VERSION} + SOVERSION ${arkodelib_SOVERSION}) message(STATUS "Added ARKODE F2003 interface") diff --git a/src/arkode/xbraid/CMakeLists.txt b/src/arkode/xbraid/CMakeLists.txt index 8d700848c1..e9e469ae82 100644 --- a/src/arkode/xbraid/CMakeLists.txt +++ b/src/arkode/xbraid/CMakeLists.txt @@ -18,25 +18,16 @@ install(CODE "MESSAGE(\"\nInstall ARKODE XBraid interface\n\")") # Create the sundials_arkode_xbraid library -sundials_add_library(sundials_arkode_xbraid - SOURCES - arkode_xbraid.c - ${SUNDIALS_SOURCE_DIR}/src/sundials/sundials_xbraid.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/arkode/arkode_xbraid.h - INCLUDE_SUBDIR - arkode - LINK_LIBRARIES - PUBLIC sundials_arkode SUNDIALS::XBRAID MPI::MPI_C - INCLUDE_DIRECTORIES - PRIVATE ../ - OUTPUT_NAME - sundials_arkode_xbraid - VERSION - ${arkodelib_VERSION} - SOVERSION - ${arkodelib_SOVERSION} -) +sundials_add_library( + sundials_arkode_xbraid + SOURCES arkode_xbraid.c ${SUNDIALS_SOURCE_DIR}/src/sundials/sundials_xbraid.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/arkode/arkode_xbraid.h + INCLUDE_SUBDIR arkode + LINK_LIBRARIES PUBLIC sundials_arkode SUNDIALS::XBRAID MPI::MPI_C + INCLUDE_DIRECTORIES PRIVATE ../ + OUTPUT_NAME sundials_arkode_xbraid + VERSION ${arkodelib_VERSION} + SOVERSION ${arkodelib_SOVERSION}) # Finished message(STATUS "Added ARKODE Xbraid interface") diff --git a/src/cvode/CMakeLists.txt b/src/cvode/CMakeLists.txt index 7a3e01613a..7301a5bb11 100644 --- a/src/cvode/CMakeLists.txt +++ b/src/cvode/CMakeLists.txt @@ -19,25 +19,18 @@ install(CODE "MESSAGE(\"\nInstall CVODE\n\")") # Add variable cvode_SOURCES with the sources for the CVODE library set(cvode_SOURCES - cvode.c - cvode_bandpre.c - cvode_bbdpre.c - cvode_diag.c - cvode_io.c - cvode_ls.c - cvode_nls.c - cvode_proj.c - ) + cvode.c + cvode_bandpre.c + cvode_bbdpre.c + cvode_diag.c + cvode_io.c + cvode_ls.c + cvode_nls.c + cvode_proj.c) # Add variable cvode_HEADERS with the exported CVODE header files -set(cvode_HEADERS - cvode.h - cvode_bandpre.h - cvode_bbdpre.h - cvode_diag.h - cvode_ls.h - cvode_proj.h - ) +set(cvode_HEADERS cvode.h cvode_bandpre.h cvode_bbdpre.h cvode_diag.h + cvode_ls.h cvode_proj.h) # Add prefix with complete path to the CVODE header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/cvode/ cvode_HEADERS) @@ -47,70 +40,47 @@ if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) if(BUILD_NVECTOR_CUDA) - set_source_files_properties(cvode_fused_gpu.cpp PROPERTIES - LANGUAGE CUDA) + set_source_files_properties(cvode_fused_gpu.cpp PROPERTIES LANGUAGE CUDA) - sundials_add_library(sundials_cvode_fused_cuda - SOURCES - cvode_fused_gpu.cpp - COMPILE_DEFINITIONS - PRIVATE USE_CUDA - LINK_LIBRARIES - PUBLIC sundials_core - PRIVATE sundials_nveccuda - OUTPUT_NAME - sundials_cvode_fused_cuda - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} - ) + sundials_add_library( + sundials_cvode_fused_cuda + SOURCES cvode_fused_gpu.cpp + COMPILE_DEFINITIONS PRIVATE USE_CUDA + LINK_LIBRARIES PUBLIC sundials_core PRIVATE sundials_nveccuda + OUTPUT_NAME sundials_cvode_fused_cuda + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) endif() if(BUILD_NVECTOR_HIP) - sundials_add_library(sundials_cvode_fused_hip - SOURCES - cvode_fused_gpu.cpp - COMPILE_DEFINITIONS - PRIVATE USE_HIP - LINK_LIBRARIES - PUBLIC sundials_core - PRIVATE sundials_nvechip - OUTPUT_NAME - sundials_cvode_fused_hip - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} - ) + sundials_add_library( + sundials_cvode_fused_hip + SOURCES cvode_fused_gpu.cpp + COMPILE_DEFINITIONS PRIVATE USE_HIP + LINK_LIBRARIES PUBLIC sundials_core PRIVATE sundials_nvechip + OUTPUT_NAME sundials_cvode_fused_hip + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) endif() - sundials_add_library(sundials_cvode_fused_stubs - SOURCES - cvode_fused_stubs.c - LINK_LIBRARIES - PUBLIC sundials_core - OUTPUT_NAME - sundials_cvode_fused_stubs - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} - ) + sundials_add_library( + sundials_cvode_fused_stubs + SOURCES cvode_fused_stubs.c + LINK_LIBRARIES PUBLIC sundials_core + OUTPUT_NAME sundials_cvode_fused_stubs + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) set(_fused_link_lib sundials_cvode_fused_stubs) endif() # Create the library -sundials_add_library(sundials_cvode - SOURCES - ${cvode_SOURCES} - HEADERS - ${cvode_HEADERS} - INCLUDE_SUBDIR - cvode - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_cvode + SOURCES ${cvode_SOURCES} + HEADERS ${cvode_HEADERS} + INCLUDE_SUBDIR cvode + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -126,16 +96,11 @@ sundials_add_library(sundials_cvode sundials_sunlinsolpcg_obj sundials_sunnonlinsolnewton_obj sundials_sunnonlinsolfixedpoint_obj - LINK_LIBRARIES - # Link to stubs so examples work. - PRIVATE ${_fused_link_lib} - OUTPUT_NAME - sundials_cvode - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} -) + LINK_LIBRARIES # Link to stubs so examples work. + PRIVATE ${_fused_link_lib} + OUTPUT_NAME sundials_cvode + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) # Finished CVODE message(STATUS "Added CVODE module") diff --git a/src/cvode/fmod_int32/CMakeLists.txt b/src/cvode/fmod_int32/CMakeLists.txt index e27c43ae02..38581e558f 100644 --- a/src/cvode/fmod_int32/CMakeLists.txt +++ b/src/cvode/fmod_int32/CMakeLists.txt @@ -17,11 +17,10 @@ set(cvode_SOURCES fcvode_mod.f90 fcvode_mod.c) # Create the library -sundials_add_f2003_library(sundials_fcvode_mod - SOURCES - ${cvode_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fcvode_mod + SOURCES ${cvode_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -36,12 +35,8 @@ sundials_add_f2003_library(sundials_fcvode_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fcvode_mod - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} -) + OUTPUT_NAME sundials_fcvode_mod + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) message(STATUS "Added CVODE F2003 interface") diff --git a/src/cvode/fmod_int64/CMakeLists.txt b/src/cvode/fmod_int64/CMakeLists.txt index e27c43ae02..38581e558f 100644 --- a/src/cvode/fmod_int64/CMakeLists.txt +++ b/src/cvode/fmod_int64/CMakeLists.txt @@ -17,11 +17,10 @@ set(cvode_SOURCES fcvode_mod.f90 fcvode_mod.c) # Create the library -sundials_add_f2003_library(sundials_fcvode_mod - SOURCES - ${cvode_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fcvode_mod + SOURCES ${cvode_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -36,12 +35,8 @@ sundials_add_f2003_library(sundials_fcvode_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fcvode_mod - VERSION - ${cvodelib_VERSION} - SOVERSION - ${cvodelib_SOVERSION} -) + OUTPUT_NAME sundials_fcvode_mod + VERSION ${cvodelib_VERSION} + SOVERSION ${cvodelib_SOVERSION}) message(STATUS "Added CVODE F2003 interface") diff --git a/src/cvodes/CMakeLists.txt b/src/cvodes/CMakeLists.txt index 1879c49614..388ed2f57d 100644 --- a/src/cvodes/CMakeLists.txt +++ b/src/cvodes/CMakeLists.txt @@ -19,44 +19,34 @@ install(CODE "MESSAGE(\"\nInstall CVODES\n\")") # Add variable cvodes_SOURCES with the sources for the CVODES library set(cvodes_SOURCES - cvodea.c - cvodea_io.c - cvodes.c - cvodes_bandpre.c - cvodes_bbdpre.c - cvodes_diag.c - cvodes_io.c - cvodes_ls.c - cvodes_nls.c - cvodes_nls_sim.c - cvodes_nls_stg.c - cvodes_nls_stg1.c - cvodes_proj.c - ) + cvodea.c + cvodea_io.c + cvodes.c + cvodes_bandpre.c + cvodes_bbdpre.c + cvodes_diag.c + cvodes_io.c + cvodes_ls.c + cvodes_nls.c + cvodes_nls_sim.c + cvodes_nls_stg.c + cvodes_nls_stg1.c + cvodes_proj.c) # Add variable cvodes_HEADERS with the exported CVODES header files -set(cvodes_HEADERS - cvodes.h - cvodes_bandpre.h - cvodes_bbdpre.h - cvodes_diag.h - cvodes_ls.h - cvodes_proj.h - ) +set(cvodes_HEADERS cvodes.h cvodes_bandpre.h cvodes_bbdpre.h cvodes_diag.h + cvodes_ls.h cvodes_proj.h) # Add prefix with complete path to the CVODES header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/cvodes/ cvodes_HEADERS) # Create the library -sundials_add_library(sundials_cvodes - SOURCES - ${cvodes_SOURCES} - HEADERS - ${cvodes_HEADERS} - INCLUDE_SUBDIR - cvodes - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_cvodes + SOURCES ${cvodes_SOURCES} + HEADERS ${cvodes_HEADERS} + INCLUDE_SUBDIR cvodes + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -72,13 +62,9 @@ sundials_add_library(sundials_cvodes sundials_sunlinsolpcg_obj sundials_sunnonlinsolnewton_obj sundials_sunnonlinsolfixedpoint_obj - OUTPUT_NAME - sundials_cvodes - VERSION - ${cvodeslib_VERSION} - SOVERSION - ${cvodeslib_SOVERSION} -) + OUTPUT_NAME sundials_cvodes + VERSION ${cvodeslib_VERSION} + SOVERSION ${cvodeslib_SOVERSION}) # Finished CVODES message(STATUS "Added CVODES module") diff --git a/src/cvodes/fmod_int32/CMakeLists.txt b/src/cvodes/fmod_int32/CMakeLists.txt index 031ac9c6f9..100a28feed 100644 --- a/src/cvodes/fmod_int32/CMakeLists.txt +++ b/src/cvodes/fmod_int32/CMakeLists.txt @@ -16,11 +16,10 @@ set(cvodes_SOURCES fcvodes_mod.f90 fcvodes_mod.c) # Create the library -sundials_add_f2003_library(sundials_fcvodes_mod - SOURCES - ${cvodes_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fcvodes_mod + SOURCES ${cvodes_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -35,12 +34,8 @@ sundials_add_f2003_library(sundials_fcvodes_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fcvodes_mod - VERSION - ${cvodeslib_VERSION} - SOVERSION - ${cvodeslib_SOVERSION} -) + OUTPUT_NAME sundials_fcvodes_mod + VERSION ${cvodeslib_VERSION} + SOVERSION ${cvodeslib_SOVERSION}) message(STATUS "Added CVODES F2003 interface") diff --git a/src/cvodes/fmod_int64/CMakeLists.txt b/src/cvodes/fmod_int64/CMakeLists.txt index 031ac9c6f9..100a28feed 100644 --- a/src/cvodes/fmod_int64/CMakeLists.txt +++ b/src/cvodes/fmod_int64/CMakeLists.txt @@ -16,11 +16,10 @@ set(cvodes_SOURCES fcvodes_mod.f90 fcvodes_mod.c) # Create the library -sundials_add_f2003_library(sundials_fcvodes_mod - SOURCES - ${cvodes_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fcvodes_mod + SOURCES ${cvodes_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -35,12 +34,8 @@ sundials_add_f2003_library(sundials_fcvodes_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fcvodes_mod - VERSION - ${cvodeslib_VERSION} - SOVERSION - ${cvodeslib_SOVERSION} -) + OUTPUT_NAME sundials_fcvodes_mod + VERSION ${cvodeslib_VERSION} + SOVERSION ${cvodeslib_SOVERSION}) message(STATUS "Added CVODES F2003 interface") diff --git a/src/ida/CMakeLists.txt b/src/ida/CMakeLists.txt index 8a7e5ae25e..d8985eef26 100644 --- a/src/ida/CMakeLists.txt +++ b/src/ida/CMakeLists.txt @@ -18,35 +18,21 @@ install(CODE "MESSAGE(\"\nInstall IDA\n\")") # Add variable ida_SOURCES with the sources for the IDA library -set(ida_SOURCES - ida.c - ida_bbdpre.c - ida_ic.c - ida_io.c - ida_ls.c - ida_nls.c - ) +set(ida_SOURCES ida.c ida_bbdpre.c ida_ic.c ida_io.c ida_ls.c ida_nls.c) # Add variable ida_HEADERS with the exported IDA header files -set(ida_HEADERS - ida.h - ida_bbdpre.h - ida_ls.h - ) +set(ida_HEADERS ida.h ida_bbdpre.h ida_ls.h) # Add prefix with complete path to the IDA header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/ida/ ida_HEADERS) # Create the library -sundials_add_library(sundials_ida - SOURCES - ${ida_SOURCES} - HEADERS - ${ida_HEADERS} - INCLUDE_SUBDIR - ida - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_ida + SOURCES ${ida_SOURCES} + HEADERS ${ida_HEADERS} + INCLUDE_SUBDIR ida + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -62,13 +48,9 @@ sundials_add_library(sundials_ida sundials_sunlinsolpcg_obj sundials_sunnonlinsolnewton_obj sundials_sunnonlinsolfixedpoint_obj - OUTPUT_NAME - sundials_ida - VERSION - ${idalib_VERSION} - SOVERSION - ${idalib_SOVERSION} -) + OUTPUT_NAME sundials_ida + VERSION ${idalib_VERSION} + SOVERSION ${idalib_SOVERSION}) # Finished IDA message(STATUS "Added IDA module") diff --git a/src/ida/fmod_int32/CMakeLists.txt b/src/ida/fmod_int32/CMakeLists.txt index e305f237d0..928acaa4a5 100644 --- a/src/ida/fmod_int32/CMakeLists.txt +++ b/src/ida/fmod_int32/CMakeLists.txt @@ -17,11 +17,10 @@ set(ida_SOURCES fida_mod.f90 fida_mod.c) # Create the library -sundials_add_f2003_library(sundials_fida_mod - SOURCES - ${ida_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fida_mod + SOURCES ${ida_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -36,12 +35,8 @@ sundials_add_f2003_library(sundials_fida_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fida_mod - VERSION - ${idalib_VERSION} - SOVERSION - ${idalib_SOVERSION} -) + OUTPUT_NAME sundials_fida_mod + VERSION ${idalib_VERSION} + SOVERSION ${idalib_SOVERSION}) message(STATUS "Added IDA F2003 interface") diff --git a/src/ida/fmod_int64/CMakeLists.txt b/src/ida/fmod_int64/CMakeLists.txt index e305f237d0..928acaa4a5 100644 --- a/src/ida/fmod_int64/CMakeLists.txt +++ b/src/ida/fmod_int64/CMakeLists.txt @@ -17,11 +17,10 @@ set(ida_SOURCES fida_mod.f90 fida_mod.c) # Create the library -sundials_add_f2003_library(sundials_fida_mod - SOURCES - ${ida_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fida_mod + SOURCES ${ida_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -36,12 +35,8 @@ sundials_add_f2003_library(sundials_fida_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fida_mod - VERSION - ${idalib_VERSION} - SOVERSION - ${idalib_SOVERSION} -) + OUTPUT_NAME sundials_fida_mod + VERSION ${idalib_VERSION} + SOVERSION ${idalib_SOVERSION}) message(STATUS "Added IDA F2003 interface") diff --git a/src/idas/CMakeLists.txt b/src/idas/CMakeLists.txt index a5ed8b4739..21ebab4869 100644 --- a/src/idas/CMakeLists.txt +++ b/src/idas/CMakeLists.txt @@ -19,38 +19,30 @@ install(CODE "MESSAGE(\"\nInstall IDAS\n\")") # Add variable idas_SOURCES with the sources for the IDAS library set(idas_SOURCES - idas.c - idaa.c - idas_io.c - idas_ic.c - idaa_io.c - idas_ls.c - idas_bbdpre.c - idas_nls.c - idas_nls_sim.c - idas_nls_stg.c - ) + idas.c + idaa.c + idas_io.c + idas_ic.c + idaa_io.c + idas_ls.c + idas_bbdpre.c + idas_nls.c + idas_nls_sim.c + idas_nls_stg.c) # Add variable idas_HEADERS with the exported IDAS header files -set(idas_HEADERS - idas.h - idas_bbdpre.h - idas_ls.h - ) +set(idas_HEADERS idas.h idas_bbdpre.h idas_ls.h) # Add prefix with complete path to the IDAS header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/idas/ idas_HEADERS) # Create the library -sundials_add_library(sundials_idas - SOURCES - ${idas_SOURCES} - HEADERS - ${idas_HEADERS} - INCLUDE_SUBDIR - idas - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_idas + SOURCES ${idas_SOURCES} + HEADERS ${idas_HEADERS} + INCLUDE_SUBDIR idas + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -66,13 +58,9 @@ sundials_add_library(sundials_idas sundials_sunlinsolpcg_obj sundials_sunnonlinsolnewton_obj sundials_sunnonlinsolfixedpoint_obj - OUTPUT_NAME - sundials_idas - VERSION - ${idaslib_VERSION} - SOVERSION - ${idaslib_SOVERSION} -) + OUTPUT_NAME sundials_idas + VERSION ${idaslib_VERSION} + SOVERSION ${idaslib_SOVERSION}) # Finished IDAS message(STATUS "Added IDAS module") diff --git a/src/idas/fmod_int32/CMakeLists.txt b/src/idas/fmod_int32/CMakeLists.txt index a6abe6516b..5db3a92327 100644 --- a/src/idas/fmod_int32/CMakeLists.txt +++ b/src/idas/fmod_int32/CMakeLists.txt @@ -16,11 +16,10 @@ set(idas_SOURCES fidas_mod.f90 fidas_mod.c) # Create the library -sundials_add_f2003_library(sundials_fidas_mod - SOURCES - ${idas_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fidas_mod + SOURCES ${idas_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -35,11 +34,7 @@ sundials_add_f2003_library(sundials_fidas_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fidas_mod - VERSION - ${idaslib_VERSION} - SOVERSION - ${idaslib_SOVERSION} -) + OUTPUT_NAME sundials_fidas_mod + VERSION ${idaslib_VERSION} + SOVERSION ${idaslib_SOVERSION}) message(STATUS "Added IDAS F2003 interface") diff --git a/src/idas/fmod_int64/CMakeLists.txt b/src/idas/fmod_int64/CMakeLists.txt index a6abe6516b..5db3a92327 100644 --- a/src/idas/fmod_int64/CMakeLists.txt +++ b/src/idas/fmod_int64/CMakeLists.txt @@ -16,11 +16,10 @@ set(idas_SOURCES fidas_mod.f90 fidas_mod.c) # Create the library -sundials_add_f2003_library(sundials_fidas_mod - SOURCES - ${idas_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fidas_mod + SOURCES ${idas_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -35,11 +34,7 @@ sundials_add_f2003_library(sundials_fidas_mod sundials_fsunlinsolpcg_mod_obj sundials_fsunnonlinsolnewton_mod_obj sundials_fsunnonlinsolfixedpoint_mod_obj - OUTPUT_NAME - sundials_fidas_mod - VERSION - ${idaslib_VERSION} - SOVERSION - ${idaslib_SOVERSION} -) + OUTPUT_NAME sundials_fidas_mod + VERSION ${idaslib_VERSION} + SOVERSION ${idaslib_SOVERSION}) message(STATUS "Added IDAS F2003 interface") diff --git a/src/kinsol/CMakeLists.txt b/src/kinsol/CMakeLists.txt index 7306c3f449..cc03b1511d 100644 --- a/src/kinsol/CMakeLists.txt +++ b/src/kinsol/CMakeLists.txt @@ -18,33 +18,21 @@ install(CODE "MESSAGE(\"\nInstall KINSOL\n\")") # Add variable kinsol_SOURCES with the sources for the KINSOL library -set(kinsol_SOURCES - kinsol.c - kinsol_bbdpre.c - kinsol_io.c - kinsol_ls.c - ) +set(kinsol_SOURCES kinsol.c kinsol_bbdpre.c kinsol_io.c kinsol_ls.c) # Add variable kinsol_HEADERS with the exported KINSOL header files -set(kinsol_HEADERS - kinsol.h - kinsol_bbdpre.h - kinsol_ls.h - ) +set(kinsol_HEADERS kinsol.h kinsol_bbdpre.h kinsol_ls.h) # Add prefix with complete path to the KINSOL header files add_prefix(${SUNDIALS_SOURCE_DIR}/include/kinsol/ kinsol_HEADERS) # Create the library -sundials_add_library(sundials_kinsol - SOURCES - ${kinsol_SOURCES} - HEADERS - ${kinsol_HEADERS} - INCLUDE_SUBDIR - kinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_kinsol + SOURCES ${kinsol_SOURCES} + HEADERS ${kinsol_HEADERS} + INCLUDE_SUBDIR kinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES sundials_sunmemsys_obj sundials_nvecserial_obj @@ -58,13 +46,9 @@ sundials_add_library(sundials_kinsol sundials_sunlinsolspgmr_obj sundials_sunlinsolsptfqmr_obj sundials_sunlinsolpcg_obj - OUTPUT_NAME - sundials_kinsol - VERSION - ${kinsollib_VERSION} - SOVERSION - ${kinsollib_SOVERSION} -) + OUTPUT_NAME sundials_kinsol + VERSION ${kinsollib_VERSION} + SOVERSION ${kinsollib_SOVERSION}) # Finished KINSOL message(STATUS "Added KINSOL module") diff --git a/src/kinsol/fmod_int32/CMakeLists.txt b/src/kinsol/fmod_int32/CMakeLists.txt index a154a8b865..8f127375de 100644 --- a/src/kinsol/fmod_int32/CMakeLists.txt +++ b/src/kinsol/fmod_int32/CMakeLists.txt @@ -17,11 +17,10 @@ set(kinsol_SOURCES fkinsol_mod.f90 fkinsol_mod.c) # Create the library -sundials_add_f2003_library(sundials_fkinsol_mod - SOURCES - ${kinsol_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fkinsol_mod + SOURCES ${kinsol_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -34,12 +33,8 @@ sundials_add_f2003_library(sundials_fkinsol_mod sundials_fsunlinsolspgmr_mod_obj sundials_fsunlinsolsptfqmr_mod_obj sundials_fsunlinsolpcg_mod_obj - OUTPUT_NAME - sundials_fkinsol_mod - VERSION - ${kinsollib_VERSION} - SOVERSION - ${kinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fkinsol_mod + VERSION ${kinsollib_VERSION} + SOVERSION ${kinsollib_SOVERSION}) message(STATUS "Added KINSOL F2003 interface") diff --git a/src/kinsol/fmod_int64/CMakeLists.txt b/src/kinsol/fmod_int64/CMakeLists.txt index a154a8b865..8f127375de 100644 --- a/src/kinsol/fmod_int64/CMakeLists.txt +++ b/src/kinsol/fmod_int64/CMakeLists.txt @@ -17,11 +17,10 @@ set(kinsol_SOURCES fkinsol_mod.f90 fkinsol_mod.c) # Create the library -sundials_add_f2003_library(sundials_fkinsol_mod - SOURCES - ${kinsol_SOURCES} - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fkinsol_mod + SOURCES ${kinsol_SOURCES} + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES sundials_fnvecserial_mod_obj sundials_fsunmatrixband_mod_obj @@ -34,12 +33,8 @@ sundials_add_f2003_library(sundials_fkinsol_mod sundials_fsunlinsolspgmr_mod_obj sundials_fsunlinsolsptfqmr_mod_obj sundials_fsunlinsolpcg_mod_obj - OUTPUT_NAME - sundials_fkinsol_mod - VERSION - ${kinsollib_VERSION} - SOVERSION - ${kinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fkinsol_mod + VERSION ${kinsollib_VERSION} + SOVERSION ${kinsollib_SOVERSION}) message(STATUS "Added KINSOL F2003 interface") diff --git a/src/nvector/CMakeLists.txt b/src/nvector/CMakeLists.txt index 182a2bc3c8..5c9c1307ef 100644 --- a/src/nvector/CMakeLists.txt +++ b/src/nvector/CMakeLists.txt @@ -75,18 +75,20 @@ if(BUILD_NVECTOR_KOKKOS) add_library(sundials_nveckokkos INTERFACE) target_link_libraries(sundials_nveckokkos INTERFACE sundials_core) if(ENABLE_HIP) - target_link_libraries(sundials_nveckokkos INTERFACE - Kokkos::kokkos hip::device) + target_link_libraries(sundials_nveckokkos INTERFACE Kokkos::kokkos + hip::device) else() - target_link_libraries(sundials_nveckokkos INTERFACE - Kokkos::kokkos) + target_link_libraries(sundials_nveckokkos INTERFACE Kokkos::kokkos) endif() - target_include_directories(sundials_nveckokkos INTERFACE - $ - $ - $ - $) + target_include_directories( + sundials_nveckokkos + INTERFACE $ + $ + $ + $) install(FILES ${PROJECT_SOURCE_DIR}/include/nvector/nvector_kokkos.hpp - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nvector") - set(_SUNDIALS_INSTALLED_COMPONENTS "nveckokkos;${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nvector") + set(_SUNDIALS_INSTALLED_COMPONENTS + "nveckokkos;${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() diff --git a/src/nvector/cuda/CMakeLists.txt b/src/nvector/cuda/CMakeLists.txt index 8452b9eef2..117373035c 100644 --- a/src/nvector/cuda/CMakeLists.txt +++ b/src/nvector/cuda/CMakeLists.txt @@ -17,23 +17,15 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_CUDA\n\")") # Create the library -sundials_add_library(sundials_nveccuda - SOURCES - nvector_cuda.cu - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_cuda.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_sunmemcuda_obj - OUTPUT_NAME - sundials_nveccuda - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_nveccuda + SOURCES nvector_cuda.cu + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_cuda.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_sunmemcuda_obj + OUTPUT_NAME sundials_nveccuda + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_CUDA module") diff --git a/src/nvector/hip/CMakeLists.txt b/src/nvector/hip/CMakeLists.txt index 71736301ee..71ef53f40f 100644 --- a/src/nvector/hip/CMakeLists.txt +++ b/src/nvector/hip/CMakeLists.txt @@ -17,25 +17,16 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_HIP\n\")") # Create the library -sundials_add_library(sundials_nvechip - SOURCES - nvector_hip.hip.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_hip.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_sunmemhip_obj - LINK_LIBRARIES - PUBLIC hip::device - OUTPUT_NAME - sundials_nvechip - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_nvechip + SOURCES nvector_hip.hip.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_hip.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_sunmemhip_obj + LINK_LIBRARIES PUBLIC hip::device + OUTPUT_NAME sundials_nvechip + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_HIP module") diff --git a/src/nvector/manyvector/CMakeLists.txt b/src/nvector/manyvector/CMakeLists.txt index 4080f60ffc..e5bd67c722 100644 --- a/src/nvector/manyvector/CMakeLists.txt +++ b/src/nvector/manyvector/CMakeLists.txt @@ -19,22 +19,15 @@ if(BUILD_NVECTOR_MANYVECTOR) install(CODE "MESSAGE(\"\nInstall NVECTOR_MANYVECTOR\n\")") - sundials_add_library(sundials_nvecmanyvector - SOURCES - nvector_manyvector.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_manyvector.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OUTPUT_NAME - sundials_nvecmanyvector - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_library( + sundials_nvecmanyvector + SOURCES nvector_manyvector.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_manyvector.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OUTPUT_NAME sundials_nvecmanyvector + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MANYVECTOR module") endif() @@ -52,24 +45,16 @@ if(BUILD_NVECTOR_MPIMANYVECTOR) endif() # Create the sundials_nvecmpimanyvector library - sundials_add_library(sundials_nvecmpimanyvector - SOURCES - nvector_manyvector.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpimanyvector.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - COMPILE_DEFINITIONS - PRIVATE MANYVECTOR_BUILD_WITH_MPI - OUTPUT_NAME - sundials_nvecmpimanyvector - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_library( + sundials_nvecmpimanyvector + SOURCES nvector_manyvector.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpimanyvector.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + COMPILE_DEFINITIONS PRIVATE MANYVECTOR_BUILD_WITH_MPI + OUTPUT_NAME sundials_nvecmpimanyvector + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIMANYVECTOR module") endif() diff --git a/src/nvector/manyvector/fmod_int32/CMakeLists.txt b/src/nvector/manyvector/fmod_int32/CMakeLists.txt index 8033da01f7..2908e42e37 100644 --- a/src/nvector/manyvector/fmod_int32/CMakeLists.txt +++ b/src/nvector/manyvector/fmod_int32/CMakeLists.txt @@ -15,18 +15,13 @@ # --------------------------------------------------------------- if(BUILD_NVECTOR_MANYVECTOR) - sundials_add_f2003_library(sundials_fnvecmanyvector_mod - SOURCES - fnvector_manyvector_mod.f90 fnvector_manyvector_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fnvecmanyvector_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_f2003_library( + sundials_fnvecmanyvector_mod + SOURCES fnvector_manyvector_mod.f90 fnvector_manyvector_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fnvecmanyvector_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MANYVECTOR F2003 Interface") endif() @@ -44,18 +39,13 @@ if(BUILD_NVECTOR_MPIMANYVECTOR) set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) endif() - sundials_add_f2003_library(sundials_fnvecmpimanyvector_mod - SOURCES - fnvector_mpimanyvector_mod.f90 fnvector_mpimanyvector_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fnvecmpimanyvector_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_f2003_library( + sundials_fnvecmpimanyvector_mod + SOURCES fnvector_mpimanyvector_mod.f90 fnvector_mpimanyvector_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fnvecmpimanyvector_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIMANYVECTOR F2003 Interface") endif() diff --git a/src/nvector/manyvector/fmod_int64/CMakeLists.txt b/src/nvector/manyvector/fmod_int64/CMakeLists.txt index 8033da01f7..2908e42e37 100644 --- a/src/nvector/manyvector/fmod_int64/CMakeLists.txt +++ b/src/nvector/manyvector/fmod_int64/CMakeLists.txt @@ -15,18 +15,13 @@ # --------------------------------------------------------------- if(BUILD_NVECTOR_MANYVECTOR) - sundials_add_f2003_library(sundials_fnvecmanyvector_mod - SOURCES - fnvector_manyvector_mod.f90 fnvector_manyvector_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fnvecmanyvector_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_f2003_library( + sundials_fnvecmanyvector_mod + SOURCES fnvector_manyvector_mod.f90 fnvector_manyvector_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fnvecmanyvector_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MANYVECTOR F2003 Interface") endif() @@ -44,18 +39,13 @@ if(BUILD_NVECTOR_MPIMANYVECTOR) set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) endif() - sundials_add_f2003_library(sundials_fnvecmpimanyvector_mod - SOURCES - fnvector_mpimanyvector_mod.f90 fnvector_mpimanyvector_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fnvecmpimanyvector_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} - ) + sundials_add_f2003_library( + sundials_fnvecmpimanyvector_mod + SOURCES fnvector_mpimanyvector_mod.f90 fnvector_mpimanyvector_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fnvecmpimanyvector_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIMANYVECTOR F2003 Interface") endif() diff --git a/src/nvector/mpiplusx/CMakeLists.txt b/src/nvector/mpiplusx/CMakeLists.txt index 1be179696d..98f3fa36dc 100644 --- a/src/nvector/mpiplusx/CMakeLists.txt +++ b/src/nvector/mpiplusx/CMakeLists.txt @@ -25,24 +25,16 @@ elseif(MPI_C_FOUND) endif() # Create the library -sundials_add_library(sundials_nvecmpiplusx - SOURCES - nvector_mpiplusx.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpiplusx.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_nvecmpimanyvector_obj - OUTPUT_NAME - sundials_nvecmpiplusx - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_nvecmpiplusx + SOURCES nvector_mpiplusx.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpiplusx.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_nvecmpimanyvector_obj + OUTPUT_NAME sundials_nvecmpiplusx + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIPLUSX module") diff --git a/src/nvector/mpiplusx/fmod_int32/CMakeLists.txt b/src/nvector/mpiplusx/fmod_int32/CMakeLists.txt index d068b3609f..aaa836eba9 100644 --- a/src/nvector/mpiplusx/fmod_int32/CMakeLists.txt +++ b/src/nvector/mpiplusx/fmod_int32/CMakeLists.txt @@ -26,18 +26,13 @@ if(MPI_Fortran_COMPILER) set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) endif() -sundials_add_f2003_library(sundials_fnvecmpiplusx_mod - SOURCES - fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecmpiplusx_mod + SOURCES fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecmpiplusx_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecmpiplusx_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIPLUSX F2003 interface") diff --git a/src/nvector/mpiplusx/fmod_int64/CMakeLists.txt b/src/nvector/mpiplusx/fmod_int64/CMakeLists.txt index d068b3609f..aaa836eba9 100644 --- a/src/nvector/mpiplusx/fmod_int64/CMakeLists.txt +++ b/src/nvector/mpiplusx/fmod_int64/CMakeLists.txt @@ -26,18 +26,13 @@ if(MPI_Fortran_COMPILER) set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) endif() -sundials_add_f2003_library(sundials_fnvecmpiplusx_mod - SOURCES - fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecmpiplusx_mod + SOURCES fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecmpiplusx_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecmpiplusx_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_MPIPLUSX F2003 interface") diff --git a/src/nvector/openmp/CMakeLists.txt b/src/nvector/openmp/CMakeLists.txt index 9cbc2f35fe..bb3387b8f1 100644 --- a/src/nvector/openmp/CMakeLists.txt +++ b/src/nvector/openmp/CMakeLists.txt @@ -17,25 +17,17 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_OPENMP\n\")") # Create the library -sundials_add_library(sundials_nvecopenmp - SOURCES - nvector_openmp.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmp.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecopenmp + SOURCES nvector_openmp.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmp.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC OpenMP::OpenMP_C - OUTPUT_NAME - sundials_nvecopenmp - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC OpenMP::OpenMP_C + OUTPUT_NAME sundials_nvecopenmp + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_OPENMP module") diff --git a/src/nvector/openmp/fmod_int32/CMakeLists.txt b/src/nvector/openmp/fmod_int32/CMakeLists.txt index 31f4363b84..6510270db2 100644 --- a/src/nvector/openmp/fmod_int32/CMakeLists.txt +++ b/src/nvector/openmp/fmod_int32/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 openmp NVECTOR object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fnvecopenmp_mod - SOURCES - fnvector_openmp_mod.f90 fnvector_openmp_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecopenmp_mod + SOURCES fnvector_openmp_mod.f90 fnvector_openmp_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecopenmp_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecopenmp_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_OPENMP F2003 interface") diff --git a/src/nvector/openmp/fmod_int64/CMakeLists.txt b/src/nvector/openmp/fmod_int64/CMakeLists.txt index 31f4363b84..6510270db2 100644 --- a/src/nvector/openmp/fmod_int64/CMakeLists.txt +++ b/src/nvector/openmp/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 openmp NVECTOR object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fnvecopenmp_mod - SOURCES - fnvector_openmp_mod.f90 fnvector_openmp_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecopenmp_mod + SOURCES fnvector_openmp_mod.f90 fnvector_openmp_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecopenmp_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecopenmp_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_OPENMP F2003 interface") diff --git a/src/nvector/openmpdev/CMakeLists.txt b/src/nvector/openmpdev/CMakeLists.txt index 015a3ecbcf..fb3d7f988b 100644 --- a/src/nvector/openmpdev/CMakeLists.txt +++ b/src/nvector/openmpdev/CMakeLists.txt @@ -17,24 +17,16 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_OPENMPDEV\n\")") # Create the library -sundials_add_library(sundials_nvecopenmpdev - SOURCES - nvector_openmpdev.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmpdev.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecopenmpdev + SOURCES nvector_openmpdev.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmpdev.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC OpenMP::OpenMP_C - OUTPUT_NAME - sundials_nvecopenmpdev - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC OpenMP::OpenMP_C + OUTPUT_NAME sundials_nvecopenmpdev + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_OPENMPDEV module") diff --git a/src/nvector/parallel/CMakeLists.txt b/src/nvector/parallel/CMakeLists.txt index 55effd6b9a..df960a9a77 100644 --- a/src/nvector/parallel/CMakeLists.txt +++ b/src/nvector/parallel/CMakeLists.txt @@ -25,23 +25,16 @@ else() endif() # Create the library -sundials_add_library(sundials_nvecparallel - SOURCES - nvector_parallel.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parallel.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecparallel + SOURCES nvector_parallel.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parallel.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_nvecparallel - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_nvecparallel + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PARALLEL module") diff --git a/src/nvector/parallel/fmod_int32/CMakeLists.txt b/src/nvector/parallel/fmod_int32/CMakeLists.txt index 3b4031b8c9..98c301b871 100644 --- a/src/nvector/parallel/fmod_int32/CMakeLists.txt +++ b/src/nvector/parallel/fmod_int32/CMakeLists.txt @@ -32,18 +32,13 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -sundials_add_f2003_library(sundials_fnvecparallel_mod - SOURCES - fnvector_parallel_mod.f90 fnvector_parallel_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecparallel_mod + SOURCES fnvector_parallel_mod.f90 fnvector_parallel_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecparallel_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecparallel_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PARALLEL F2003 interface") diff --git a/src/nvector/parallel/fmod_int64/CMakeLists.txt b/src/nvector/parallel/fmod_int64/CMakeLists.txt index 3b4031b8c9..98c301b871 100644 --- a/src/nvector/parallel/fmod_int64/CMakeLists.txt +++ b/src/nvector/parallel/fmod_int64/CMakeLists.txt @@ -32,18 +32,13 @@ else() include_directories(${MPI_INCLUDE_PATH}) endif() -sundials_add_f2003_library(sundials_fnvecparallel_mod - SOURCES - fnvector_parallel_mod.f90 fnvector_parallel_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecparallel_mod + SOURCES fnvector_parallel_mod.f90 fnvector_parallel_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecparallel_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecparallel_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PARALLEL F2003 interface") diff --git a/src/nvector/parhyp/CMakeLists.txt b/src/nvector/parhyp/CMakeLists.txt index f4ef295681..56724e1c9d 100644 --- a/src/nvector/parhyp/CMakeLists.txt +++ b/src/nvector/parhyp/CMakeLists.txt @@ -17,26 +17,16 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_PARHYP\n\")") # Create the library -sundials_add_library(sundials_nvecparhyp - SOURCES - nvector_parhyp.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parhyp.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecparhyp + SOURCES nvector_parhyp.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parhyp.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC - SUNDIALS::HYPRE - MPI::MPI_C - OUTPUT_NAME - sundials_nvecparhyp - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC SUNDIALS::HYPRE MPI::MPI_C + OUTPUT_NAME sundials_nvecparhyp + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PARHYP module") diff --git a/src/nvector/petsc/CMakeLists.txt b/src/nvector/petsc/CMakeLists.txt index 34fe418818..ed3dcab60e 100644 --- a/src/nvector/petsc/CMakeLists.txt +++ b/src/nvector/petsc/CMakeLists.txt @@ -25,24 +25,16 @@ else() endif() # Create the library -sundials_add_library(sundials_nvecpetsc - SOURCES - nvector_petsc.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_petsc.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecpetsc + SOURCES nvector_petsc.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_petsc.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC SUNDIALS::PETSC - OUTPUT_NAME - sundials_nvecpetsc - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC SUNDIALS::PETSC + OUTPUT_NAME sundials_nvecpetsc + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PETSC module") diff --git a/src/nvector/pthreads/CMakeLists.txt b/src/nvector/pthreads/CMakeLists.txt index 2aafa31e4a..447f1c91e5 100644 --- a/src/nvector/pthreads/CMakeLists.txt +++ b/src/nvector/pthreads/CMakeLists.txt @@ -17,25 +17,17 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_PTHREADS\n\")") # Create the library -sundials_add_library(sundials_nvecpthreads - SOURCES - nvector_pthreads.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_pthreads.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecpthreads + SOURCES nvector_pthreads.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_pthreads.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PRIVATE Threads::Threads - OUTPUT_NAME - sundials_nvecpthreads - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PRIVATE Threads::Threads + OUTPUT_NAME sundials_nvecpthreads + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PTHREADS module") diff --git a/src/nvector/pthreads/fmod_int32/CMakeLists.txt b/src/nvector/pthreads/fmod_int32/CMakeLists.txt index e43ebc9c08..5fcf786118 100644 --- a/src/nvector/pthreads/fmod_int32/CMakeLists.txt +++ b/src/nvector/pthreads/fmod_int32/CMakeLists.txt @@ -16,18 +16,13 @@ set(nvecpthreads_SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c) -sundials_add_f2003_library(sundials_fnvecpthreads_mod - SOURCES - fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecpthreads_mod + SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecpthreads_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecpthreads_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PTHREADS F2003 interface") diff --git a/src/nvector/pthreads/fmod_int64/CMakeLists.txt b/src/nvector/pthreads/fmod_int64/CMakeLists.txt index e43ebc9c08..5fcf786118 100644 --- a/src/nvector/pthreads/fmod_int64/CMakeLists.txt +++ b/src/nvector/pthreads/fmod_int64/CMakeLists.txt @@ -16,18 +16,13 @@ set(nvecpthreads_SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c) -sundials_add_f2003_library(sundials_fnvecpthreads_mod - SOURCES - fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecpthreads_mod + SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecpthreads_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecpthreads_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_PTHREADS F2003 interface") diff --git a/src/nvector/raja/CMakeLists.txt b/src/nvector/raja/CMakeLists.txt index 1dbfd8197a..247f8bf424 100644 --- a/src/nvector/raja/CMakeLists.txt +++ b/src/nvector/raja/CMakeLists.txt @@ -14,7 +14,9 @@ # CMakeLists.txt file for the RAJA NVECTOR library # --------------------------------------------------------------- -install(CODE "MESSAGE(\"\nInstall NVECTOR_RAJA with ${SUNDIALS_RAJA_BACKENDS} backend(s)\n\")") +install( + CODE "MESSAGE(\"\nInstall NVECTOR_RAJA with ${SUNDIALS_RAJA_BACKENDS} backend(s)\n\")" +) if(SUNDIALS_RAJA_BACKENDS MATCHES "CUDA") set(_sunmemlib sundials_sunmemcuda_obj) @@ -33,31 +35,20 @@ elseif(SUNDIALS_RAJA_BACKENDS MATCHES "SYCL") endif() # Create the library -sundials_add_library(sundials_nvecraja - SOURCES - nvector_raja.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_raja.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - ${_sunmemlib} - LINK_LIBRARIES - PUBLIC ${_hip_lib_or_not} RAJA - COMPILE_OPTIONS - PUBLIC $<$:--expt-extended-lambda> - COMPILE_DEFINITIONS - PRIVATE ${_compile_defs} - COMPILE_FEATURES - PUBLIC ${_cxx_std} - OUTPUT_NAME - ${_lib_output_name} - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_nvecraja + SOURCES nvector_raja.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_raja.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES ${_sunmemlib} + LINK_LIBRARIES PUBLIC ${_hip_lib_or_not} RAJA + COMPILE_OPTIONS PUBLIC $<$:--expt-extended-lambda> + COMPILE_DEFINITIONS PRIVATE ${_compile_defs} + COMPILE_FEATURES PUBLIC ${_cxx_std} + OUTPUT_NAME ${_lib_output_name} + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) -message(STATUS "Added NVECTOR_RAJA module with ${SUNDIALS_RAJA_BACKENDS} backend") +message( + STATUS "Added NVECTOR_RAJA module with ${SUNDIALS_RAJA_BACKENDS} backend") diff --git a/src/nvector/serial/CMakeLists.txt b/src/nvector/serial/CMakeLists.txt index c8e867daa8..976b8440f2 100644 --- a/src/nvector/serial/CMakeLists.txt +++ b/src/nvector/serial/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_SERIAL\n\")") # Create the sundials_nvecserial library -sundials_add_library(sundials_nvecserial - SOURCES - nvector_serial.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_serial.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvecserial + SOURCES nvector_serial.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_serial.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_nvecserial - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_nvecserial + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_SERIAL module") diff --git a/src/nvector/serial/fmod_int32/CMakeLists.txt b/src/nvector/serial/fmod_int32/CMakeLists.txt index ebf2ec0182..fbfc2e3344 100644 --- a/src/nvector/serial/fmod_int32/CMakeLists.txt +++ b/src/nvector/serial/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 serial NVECTOR object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fnvecserial_mod - SOURCES - fnvector_serial_mod.f90 fnvector_serial_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fnvecserial_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fnvecserial_mod + SOURCES fnvector_serial_mod.f90 fnvector_serial_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fnvecserial_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_SERIAL F2003 interface") diff --git a/src/nvector/serial/fmod_int64/CMakeLists.txt b/src/nvector/serial/fmod_int64/CMakeLists.txt index 293239b9fb..e52f2ae867 100644 --- a/src/nvector/serial/fmod_int64/CMakeLists.txt +++ b/src/nvector/serial/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 serial NVECTOR object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fnvecserial_mod - SOURCES - fnvector_serial_mod.f90 fnvector_serial_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fnvecserial_mod + SOURCES fnvector_serial_mod.f90 fnvector_serial_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fnvecserial_mod - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + OUTPUT_NAME sundials_fnvecserial_mod + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_SERIAL F2003 interface") diff --git a/src/nvector/sycl/CMakeLists.txt b/src/nvector/sycl/CMakeLists.txt index 47fac19d77..51dc3ddc8c 100644 --- a/src/nvector/sycl/CMakeLists.txt +++ b/src/nvector/sycl/CMakeLists.txt @@ -17,25 +17,16 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_SYCL\n\")") # Create the library -sundials_add_library(sundials_nvecsycl - SOURCES - nvector_sycl.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_sycl.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_sunmemsycl_obj - COMPILE_FEATURES - PUBLIC cxx_std_17 - OUTPUT_NAME - sundials_nvecsycl - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_nvecsycl + SOURCES nvector_sycl.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_sycl.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_sunmemsycl_obj + COMPILE_FEATURES PUBLIC cxx_std_17 + OUTPUT_NAME sundials_nvecsycl + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added NVECTOR_SYCL module") diff --git a/src/nvector/trilinos/CMakeLists.txt b/src/nvector/trilinos/CMakeLists.txt index 8b98960d0c..d2d119cb3e 100644 --- a/src/nvector/trilinos/CMakeLists.txt +++ b/src/nvector/trilinos/CMakeLists.txt @@ -18,35 +18,29 @@ install(CODE "MESSAGE(\"\nInstall NVECTOR_Trilinos\n\")") # Set Trilinos compilers/flags set(CMAKE_CXX_COMPILER ${Trilinos_INTERFACE_CXX_COMPILER}) -set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") +set(CMAKE_C_COMPILER ${Trilinos_INTERFACE_C_COMPILER}) +set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${Trilinos_INTERFACE_CXX_COMPILER_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Trilinos_INTERFACE_C_COMPILER_FLAGS}") # Create the library -sundials_add_library(sundials_nvectrilinos - SOURCES - nvector_trilinos.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_trilinos.h - INCLUDE_SUBDIR - nvector - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_nvectrilinos + SOURCES nvector_trilinos.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_trilinos.h + INCLUDE_SUBDIR nvector + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC SUNDIALS::TRILINOS - OUTPUT_NAME - sundials_nvectrilinos - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC SUNDIALS::TRILINOS + OUTPUT_NAME sundials_nvectrilinos + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) # Install the exported NVECTRILINOS CXX header files in a separate subdirectory -install(FILES - ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorInterface.hpp - ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorKernels.hpp - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nvector/trilinos") +install( + FILES + ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorInterface.hpp + ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorKernels.hpp + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nvector/trilinos") message(STATUS "Added NVECTOR_Trilinos module") diff --git a/src/sunadaptcontroller/imexgus/CMakeLists.txt b/src/sunadaptcontroller/imexgus/CMakeLists.txt index 8bbef68cdf..91367cf3ba 100644 --- a/src/sunadaptcontroller/imexgus/CMakeLists.txt +++ b/src/sunadaptcontroller/imexgus/CMakeLists.txt @@ -13,17 +13,14 @@ # --------------------------------------------------------------- # Create a library out of the generic sundials modules -sundials_add_library(sundials_sunadaptcontrollerimexgus - SOURCES - sunadaptcontroller_imexgus.c +sundials_add_library( + sundials_sunadaptcontrollerimexgus + SOURCES sunadaptcontroller_imexgus.c HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_imexgus.h - LINK_LIBRARIES - PUBLIC sundials_core - INCLUDE_SUBDIR - sunadaptcontroller - OBJECT_LIB_ONLY -) + LINK_LIBRARIES PUBLIC sundials_core + INCLUDE_SUBDIR sunadaptcontroller + OBJECT_LIB_ONLY) # Add F2003 module if the interface is enabled if(BUILD_FORTRAN_MODULE_INTERFACE) diff --git a/src/sunadaptcontroller/imexgus/fmod_int32/CMakeLists.txt b/src/sunadaptcontroller/imexgus/fmod_int32/CMakeLists.txt index 0c4142417c..8fe6e45f40 100644 --- a/src/sunadaptcontroller/imexgus/fmod_int32/CMakeLists.txt +++ b/src/sunadaptcontroller/imexgus/fmod_int32/CMakeLists.txt @@ -12,14 +12,10 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunadaptcontrollerimexgus_mod - SOURCES - fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunadaptcontrollerimexgus_mod - OBJECT_LIB_ONLY -) +sundials_add_f2003_library( + sundials_fsunadaptcontrollerimexgus_mod + SOURCES fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunadaptcontrollerimexgus_mod OBJECT_LIB_ONLY) message(STATUS "Added SUNAdaptController_ImExGus F2003 interface") diff --git a/src/sunadaptcontroller/imexgus/fmod_int64/CMakeLists.txt b/src/sunadaptcontroller/imexgus/fmod_int64/CMakeLists.txt index 0c4142417c..8fe6e45f40 100644 --- a/src/sunadaptcontroller/imexgus/fmod_int64/CMakeLists.txt +++ b/src/sunadaptcontroller/imexgus/fmod_int64/CMakeLists.txt @@ -12,14 +12,10 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunadaptcontrollerimexgus_mod - SOURCES - fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunadaptcontrollerimexgus_mod - OBJECT_LIB_ONLY -) +sundials_add_f2003_library( + sundials_fsunadaptcontrollerimexgus_mod + SOURCES fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunadaptcontrollerimexgus_mod OBJECT_LIB_ONLY) message(STATUS "Added SUNAdaptController_ImExGus F2003 interface") diff --git a/src/sunadaptcontroller/soderlind/CMakeLists.txt b/src/sunadaptcontroller/soderlind/CMakeLists.txt index 50cf7330bc..9c2613703c 100644 --- a/src/sunadaptcontroller/soderlind/CMakeLists.txt +++ b/src/sunadaptcontroller/soderlind/CMakeLists.txt @@ -13,17 +13,14 @@ # --------------------------------------------------------------- # Create a library out of the generic sundials modules -sundials_add_library(sundials_sunadaptcontrollersoderlind - SOURCES - sunadaptcontroller_soderlind.c +sundials_add_library( + sundials_sunadaptcontrollersoderlind + SOURCES sunadaptcontroller_soderlind.c HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_soderlind.h - LINK_LIBRARIES - PUBLIC sundials_core - INCLUDE_SUBDIR - sunadaptcontroller - OBJECT_LIB_ONLY -) + LINK_LIBRARIES PUBLIC sundials_core + INCLUDE_SUBDIR sunadaptcontroller + OBJECT_LIB_ONLY) # Add F2003 module if the interface is enabled if(BUILD_FORTRAN_MODULE_INTERFACE) diff --git a/src/sunadaptcontroller/soderlind/fmod_int32/CMakeLists.txt b/src/sunadaptcontroller/soderlind/fmod_int32/CMakeLists.txt index cdf9d3825e..81863c3a8c 100644 --- a/src/sunadaptcontroller/soderlind/fmod_int32/CMakeLists.txt +++ b/src/sunadaptcontroller/soderlind/fmod_int32/CMakeLists.txt @@ -12,14 +12,11 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunadaptcontrollersoderlind_mod - SOURCES - fsunadaptcontroller_soderlind_mod.f90 fsunadaptcontroller_soderlind_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunadaptcontrollersoderlind_mod - OBJECT_LIB_ONLY -) +sundials_add_f2003_library( + sundials_fsunadaptcontrollersoderlind_mod + SOURCES fsunadaptcontroller_soderlind_mod.f90 + fsunadaptcontroller_soderlind_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunadaptcontrollersoderlind_mod OBJECT_LIB_ONLY) message(STATUS "Added SUNAdaptController_Soderlind F2003 interface") diff --git a/src/sunadaptcontroller/soderlind/fmod_int64/CMakeLists.txt b/src/sunadaptcontroller/soderlind/fmod_int64/CMakeLists.txt index cdf9d3825e..81863c3a8c 100644 --- a/src/sunadaptcontroller/soderlind/fmod_int64/CMakeLists.txt +++ b/src/sunadaptcontroller/soderlind/fmod_int64/CMakeLists.txt @@ -12,14 +12,11 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunadaptcontrollersoderlind_mod - SOURCES - fsunadaptcontroller_soderlind_mod.f90 fsunadaptcontroller_soderlind_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunadaptcontrollersoderlind_mod - OBJECT_LIB_ONLY -) +sundials_add_f2003_library( + sundials_fsunadaptcontrollersoderlind_mod + SOURCES fsunadaptcontroller_soderlind_mod.f90 + fsunadaptcontroller_soderlind_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunadaptcontrollersoderlind_mod OBJECT_LIB_ONLY) message(STATUS "Added SUNAdaptController_Soderlind F2003 interface") diff --git a/src/sundials/CMakeLists.txt b/src/sundials/CMakeLists.txt index b8a19e2ff2..cf31cb497e 100644 --- a/src/sundials/CMakeLists.txt +++ b/src/sundials/CMakeLists.txt @@ -14,45 +14,44 @@ # CMakeLists.txt file for the generic SUNDIALS modules # --------------------------------------------------------------- -# From here we only install the generic SUNDIALS headers. -# The implementations themselves are incorporated in the individual SUNDIALS solver libraries. +# From here we only install the generic SUNDIALS headers. The implementations +# themselves are incorporated in the individual SUNDIALS solver libraries. install(CODE "MESSAGE(\"\nInstall shared components\n\")") # Add variable sundials_HEADERS with the exported SUNDIALS header files set(sundials_HEADERS - sundials_adaptcontroller.h - sundials_band.h - sundials_base.hpp - sundials_context.h - sundials_context.hpp - sundials_convertibleto.hpp - sundials_core.h - sundials_core.hpp - sundials_dense.h - sundials_direct.h - sundials_errors.h - sundials_futils.h - sundials_iterative.h - sundials_linearsolver.h - sundials_linearsolver.hpp - sundials_logger.h - sundials_math.h - sundials_matrix.h - sundials_matrix.hpp - sundials_memory.h - sundials_memory.hpp - sundials_mpi_types.h - sundials_nonlinearsolver.h - sundials_nonlinearsolver.hpp - sundials_nvector.h - sundials_nvector.hpp - sundials_profiler.h - sundials_profiler.hpp - sundials_types_deprecated.h - sundials_types.h - sundials_version.h - ) + sundials_adaptcontroller.h + sundials_band.h + sundials_base.hpp + sundials_context.h + sundials_context.hpp + sundials_convertibleto.hpp + sundials_core.h + sundials_core.hpp + sundials_dense.h + sundials_direct.h + sundials_errors.h + sundials_futils.h + sundials_iterative.h + sundials_linearsolver.h + sundials_linearsolver.hpp + sundials_logger.h + sundials_math.h + sundials_matrix.h + sundials_matrix.hpp + sundials_memory.h + sundials_memory.hpp + sundials_mpi_types.h + sundials_nonlinearsolver.h + sundials_nonlinearsolver.hpp + sundials_nvector.h + sundials_nvector.hpp + sundials_profiler.h + sundials_profiler.hpp + sundials_types_deprecated.h + sundials_types.h + sundials_version.h) if(ENABLE_MPI) list(APPEND sundials_HEADERS sundials_mpi_errors.h) @@ -79,26 +78,25 @@ endif() add_prefix(${SUNDIALS_SOURCE_DIR}/include/sundials/ sundials_HEADERS) set(sundials_SOURCES - sundials_adaptcontroller.c - sundials_band.c - sundials_context.c - sundials_dense.c - sundials_direct.c - sundials_errors.c - sundials_futils.c - sundials_hashmap.c - sundials_iterative.c - sundials_linearsolver.c - sundials_logger.c - sundials_math.c - sundials_matrix.c - sundials_memory.c - sundials_nonlinearsolver.c - sundials_nvector_senswrapper.c - sundials_nvector.c - sundials_profiler.c - sundials_version.c - ) + sundials_adaptcontroller.c + sundials_band.c + sundials_context.c + sundials_dense.c + sundials_direct.c + sundials_errors.c + sundials_futils.c + sundials_hashmap.c + sundials_iterative.c + sundials_linearsolver.c + sundials_logger.c + sundials_math.c + sundials_matrix.c + sundials_memory.c + sundials_nonlinearsolver.c + sundials_nvector_senswrapper.c + sundials_nvector.c + sundials_profiler.c + sundials_version.c) if(ENABLE_MPI) list(APPEND sundials_SOURCES sundials_mpi_errors.c) @@ -108,12 +106,10 @@ endif() add_prefix(${SUNDIALS_SOURCE_DIR}/src/sundials/ sundials_SOURCES) if(ENABLE_MPI) - set(_link_mpi_if_needed PUBLIC - MPI::MPI_C - $<$:MPI::MPI_CXX>) + set(_link_mpi_if_needed PUBLIC MPI::MPI_C + $<$:MPI::MPI_CXX>) endif() - if(SUNDIALS_BUILD_WITH_PROFILING) if(ENABLE_CALIPER) set(_link_caliper_if_needed PUBLIC caliper) @@ -124,42 +120,34 @@ if(SUNDIALS_BUILD_WITH_PROFILING) endif() # Create a library out of the generic sundials modules -sundials_add_library(sundials_core - SOURCES - ${sundials_SOURCES} - HEADERS - ${sundials_HEADERS} - INCLUDE_SUBDIR - sundials - LINK_LIBRARIES - ${_link_mpi_if_needed} - OUTPUT_NAME - sundials_core - VERSION - ${sundialslib_VERSION} - SOVERSION - ${sundialslib_SOVERSION} -) +sundials_add_library( + sundials_core + SOURCES ${sundials_SOURCES} + HEADERS ${sundials_HEADERS} + INCLUDE_SUBDIR sundials + LINK_LIBRARIES ${_link_mpi_if_needed} + OUTPUT_NAME sundials_core + VERSION ${sundialslib_VERSION} + SOVERSION ${sundialslib_SOVERSION}) # Install private headers -install(FILES - ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_context_impl.h - ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_errors_impl.h +install( + FILES ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_context_impl.h + ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_errors_impl.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials/priv") if(ENABLE_MPI) - install(FILES - ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_mpi_errors_impl.h + install( + FILES + ${SUNDIALS_SOURCE_DIR}/include/sundials/priv/sundials_mpi_errors_impl.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sundials/priv") endif() # SUNDIALS_EXPORT macro include(GenerateExportHeader) generate_export_header( - sundials_core BASE_NAME SUNDIALS - EXPORT_FILE_NAME - "${PROJECT_BINARY_DIR}/include/sundials/sundials_export.h" -) + sundials_core BASE_NAME SUNDIALS EXPORT_FILE_NAME + "${PROJECT_BINARY_DIR}/include/sundials/sundials_export.h") # Add F2003 module if the interface is enabled if(BUILD_FORTRAN_MODULE_INTERFACE) diff --git a/src/sundials/fmod_int32/CMakeLists.txt b/src/sundials/fmod_int32/CMakeLists.txt index 957328e8ff..b9a43aeded 100644 --- a/src/sundials/fmod_int32/CMakeLists.txt +++ b/src/sundials/fmod_int32/CMakeLists.txt @@ -14,12 +14,6 @@ # CMakeLists.txt file for the F2003 SUNDIALS object library # --------------------------------------------------------------- -set(sundials_SOURCES - fsundials_core_mod.c - fsundials_core_mod.f90 - ) +set(sundials_SOURCES fsundials_core_mod.c fsundials_core_mod.f90) -sundials_add_f2003_library(sundials_fcore_mod - SOURCES - ${sundials_SOURCES} -) +sundials_add_f2003_library(sundials_fcore_mod SOURCES ${sundials_SOURCES}) diff --git a/src/sundials/fmod_int64/CMakeLists.txt b/src/sundials/fmod_int64/CMakeLists.txt index 957328e8ff..b9a43aeded 100644 --- a/src/sundials/fmod_int64/CMakeLists.txt +++ b/src/sundials/fmod_int64/CMakeLists.txt @@ -14,12 +14,6 @@ # CMakeLists.txt file for the F2003 SUNDIALS object library # --------------------------------------------------------------- -set(sundials_SOURCES - fsundials_core_mod.c - fsundials_core_mod.f90 - ) +set(sundials_SOURCES fsundials_core_mod.c fsundials_core_mod.f90) -sundials_add_f2003_library(sundials_fcore_mod - SOURCES - ${sundials_SOURCES} -) +sundials_add_f2003_library(sundials_fcore_mod SOURCES ${sundials_SOURCES}) diff --git a/src/sunlinsol/CMakeLists.txt b/src/sunlinsol/CMakeLists.txt index a39352ec6a..976a77a2a5 100644 --- a/src/sunlinsol/CMakeLists.txt +++ b/src/sunlinsol/CMakeLists.txt @@ -33,14 +33,17 @@ if(BUILD_SUNLINSOL_GINKGO) message(STATUS "Added BUILD_SUNLINSOL_GINKGO module") add_library(sundials_sunlinsolginkgo INTERFACE) target_link_libraries(sundials_sunlinsolginkgo INTERFACE sundials_core) - target_include_directories(sundials_sunlinsolginkgo INTERFACE - $ - $ - $ - $) + target_include_directories( + sundials_sunlinsolginkgo + INTERFACE $ + $ + $ + $) install(FILES ${PROJECT_SOURCE_DIR}/include/sunlinsol/sunlinsol_ginkgo.hpp - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunlinsol") - set(_SUNDIALS_INSTALLED_COMPONENTS "sunlinsolginkgo;${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunlinsol") + set(_SUNDIALS_INSTALLED_COMPONENTS + "sunlinsolginkgo;${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() if(BUILD_SUNLINSOL_KLU) @@ -51,16 +54,21 @@ if(BUILD_SUNLINSOL_KOKKOSDENSE) install(CODE "MESSAGE(\"\nInstall SUNLINSOL_KOKKOSDENSE\n\")") message(STATUS "Added BUILD_SUNLINSOL_KOKKOSDENSE module") add_library(sundials_sunlinsolkokkosdense INTERFACE) - target_link_libraries(sundials_sunlinsolkokkosdense INTERFACE - sundials_core Kokkos::kokkos Kokkos::kokkoskernels) - target_include_directories(sundials_sunlinsolkokkosdense INTERFACE - $ - $ - $ - $) - install(FILES ${PROJECT_SOURCE_DIR}/include/sunlinsol/sunlinsol_kokkosdense.hpp + target_link_libraries( + sundials_sunlinsolkokkosdense INTERFACE sundials_core Kokkos::kokkos + Kokkos::kokkoskernels) + target_include_directories( + sundials_sunlinsolkokkosdense + INTERFACE $ + $ + $ + $) + install( + FILES ${PROJECT_SOURCE_DIR}/include/sunlinsol/sunlinsol_kokkosdense.hpp DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunlinsol") - set(_SUNDIALS_INSTALLED_COMPONENTS "sunlinsolkokkosdense;${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + set(_SUNDIALS_INSTALLED_COMPONENTS + "sunlinsolkokkosdense;${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() if(BUILD_SUNLINSOL_LAPACKBAND) diff --git a/src/sunlinsol/band/CMakeLists.txt b/src/sunlinsol/band/CMakeLists.txt index 0b2035e0ef..2fd2ffadf3 100644 --- a/src/sunlinsol/band/CMakeLists.txt +++ b/src/sunlinsol/band/CMakeLists.txt @@ -18,25 +18,17 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_BAND\n\")") # Add the library -sundials_add_library(sundials_sunlinsolband - SOURCES - sunlinsol_band.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_band.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolband + SOURCES sunlinsol_band.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_band.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixband - OUTPUT_NAME - sundials_sunlinsolband - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixband + OUTPUT_NAME sundials_sunlinsolband + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_BAND module") diff --git a/src/sunlinsol/band/fmod_int32/CMakeLists.txt b/src/sunlinsol/band/fmod_int32/CMakeLists.txt index 8b6e38724e..4a348ffb70 100644 --- a/src/sunlinsol/band/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/band/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 band SUNLinearSolver object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolband_mod - SOURCES - fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixband_mod sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolband_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolband_mod + SOURCES fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c + LINK_LIBRARIES PUBLIC sundials_fsunmatrixband_mod sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolband_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_BAND F2003 interface") diff --git a/src/sunlinsol/band/fmod_int64/CMakeLists.txt b/src/sunlinsol/band/fmod_int64/CMakeLists.txt index 250f17c914..759321d170 100644 --- a/src/sunlinsol/band/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/band/fmod_int64/CMakeLists.txt @@ -14,20 +14,14 @@ # CMakeLists.txt file for the F2003 band SUNLinearSolver object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolband_mod - SOURCES - fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolband_mod + SOURCES fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixband_mod - OUTPUT_NAME - sundials_fsunlinsolband_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_fsunmatrixband_mod + OUTPUT_NAME sundials_fsunlinsolband_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_BAND F2003 interface") diff --git a/src/sunlinsol/cusolversp/CMakeLists.txt b/src/sunlinsol/cusolversp/CMakeLists.txt index 830ddb0ab9..2663fc77dc 100644 --- a/src/sunlinsol/cusolversp/CMakeLists.txt +++ b/src/sunlinsol/cusolversp/CMakeLists.txt @@ -16,25 +16,18 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_CUSOLVERSP\n\")") -sundials_add_library(sundials_sunlinsolcusolversp - SOURCES - sunlinsol_cusolversp_batchqr.cu +sundials_add_library( + sundials_sunlinsolcusolversp + SOURCES sunlinsol_cusolversp_batchqr.cu HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_cusolversp_batchqr.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixcusparse CUDA::cusolver - PRIVATE CUDA::cusparse - OUTPUT_NAME - sundials_sunlinsolcusolversp - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixcusparse CUDA::cusolver PRIVATE + CUDA::cusparse + OUTPUT_NAME sundials_sunlinsolcusolversp + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_CUSOLVERSP module") diff --git a/src/sunlinsol/dense/CMakeLists.txt b/src/sunlinsol/dense/CMakeLists.txt index 1661deca42..27eb05e6f8 100644 --- a/src/sunlinsol/dense/CMakeLists.txt +++ b/src/sunlinsol/dense/CMakeLists.txt @@ -18,25 +18,17 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_DENSE\n\")") # Add the sunlinsol_dense library -sundials_add_library(sundials_sunlinsoldense - SOURCES - sunlinsol_dense.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_dense.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsoldense + SOURCES sunlinsol_dense.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_dense.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixdense - OUTPUT_NAME - sundials_sunlinsoldense - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixdense + OUTPUT_NAME sundials_sunlinsoldense + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_DENSE module") diff --git a/src/sunlinsol/dense/fmod_int32/CMakeLists.txt b/src/sunlinsol/dense/fmod_int32/CMakeLists.txt index 3a1329e120..eb904dc764 100644 --- a/src/sunlinsol/dense/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/dense/fmod_int32/CMakeLists.txt @@ -14,16 +14,11 @@ # CMakeLists.txt file for the F2003 dense SUNLinearSolver object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsoldense_mod - SOURCES - fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsoldense_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsoldense_mod + SOURCES fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c + LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsoldense_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_DENSE F2003 interface") diff --git a/src/sunlinsol/dense/fmod_int64/CMakeLists.txt b/src/sunlinsol/dense/fmod_int64/CMakeLists.txt index 61bdf87108..8a6401a143 100644 --- a/src/sunlinsol/dense/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/dense/fmod_int64/CMakeLists.txt @@ -14,19 +14,13 @@ # CMakeLists.txt file for the F2003 dense SUNLinearSolver object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsoldense_mod - SOURCES - fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsoldense_mod + SOURCES fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixdense_mod - OUTPUT_NAME - sundials_fsunlinsoldense_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod + OUTPUT_NAME sundials_fsunlinsoldense_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_DENSE F2003 interface") diff --git a/src/sunlinsol/klu/CMakeLists.txt b/src/sunlinsol/klu/CMakeLists.txt index c78a547deb..781a60819d 100644 --- a/src/sunlinsol/klu/CMakeLists.txt +++ b/src/sunlinsol/klu/CMakeLists.txt @@ -17,25 +17,17 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_KLU\n\")") # Add the library -sundials_add_library(sundials_sunlinsolklu - SOURCES - sunlinsol_klu.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_klu.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolklu + SOURCES sunlinsol_klu.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_klu.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixsparse SUNDIALS::KLU - OUTPUT_NAME - sundials_sunlinsolklu - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse SUNDIALS::KLU + OUTPUT_NAME sundials_sunlinsolklu + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_KLU module") diff --git a/src/sunlinsol/klu/fmod_int32/CMakeLists.txt b/src/sunlinsol/klu/fmod_int32/CMakeLists.txt index 4a0323d921..04a6624e77 100644 --- a/src/sunlinsol/klu/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/klu/fmod_int32/CMakeLists.txt @@ -14,20 +14,14 @@ # CMakeLists.txt file for the F2003 KLU SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolklu_mod - SOURCES - fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolklu_mod + SOURCES fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixsparse_mod - OUTPUT_NAME - sundials_fsunlinsolklu_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_fsunmatrixsparse_mod + OUTPUT_NAME sundials_fsunlinsolklu_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_KLU F2003 interface") diff --git a/src/sunlinsol/klu/fmod_int64/CMakeLists.txt b/src/sunlinsol/klu/fmod_int64/CMakeLists.txt index 683f76cc3b..c24c56f863 100644 --- a/src/sunlinsol/klu/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/klu/fmod_int64/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 KLU SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolklu_mod - SOURCES - fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixsparse_mod sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolklu_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolklu_mod + SOURCES fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c + LINK_LIBRARIES PUBLIC sundials_fsunmatrixsparse_mod sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolklu_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_KLU F2003 interface") diff --git a/src/sunlinsol/lapackband/CMakeLists.txt b/src/sunlinsol/lapackband/CMakeLists.txt index 8cba988623..4da37454dd 100644 --- a/src/sunlinsol/lapackband/CMakeLists.txt +++ b/src/sunlinsol/lapackband/CMakeLists.txt @@ -17,24 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_LAPACKBAND\n\")") # Add the library -sundials_add_library(sundials_sunlinsollapackband - SOURCES - sunlinsol_lapackband.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackband.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsollapackband + SOURCES sunlinsol_lapackband.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackband.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixband "${LAPACK_LIBRARIES}" - OUTPUT_NAME - sundials_sunlinsollapackband - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixband "${LAPACK_LIBRARIES}" + OUTPUT_NAME sundials_sunlinsollapackband + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_LAPACKBAND module") diff --git a/src/sunlinsol/lapackdense/CMakeLists.txt b/src/sunlinsol/lapackdense/CMakeLists.txt index 41ab2a5fa7..f8161667f3 100644 --- a/src/sunlinsol/lapackdense/CMakeLists.txt +++ b/src/sunlinsol/lapackdense/CMakeLists.txt @@ -17,25 +17,17 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_LAPACKDENSE\n\")") # Add the library -sundials_add_library(sundials_sunlinsollapackdense - SOURCES - sunlinsol_lapackdense.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackdense.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsollapackdense + SOURCES sunlinsol_lapackdense.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackdense.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_sunmatrixdense "${LAPACK_LIBRARIES}" - OUTPUT_NAME - sundials_sunlinsollapackdense - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixdense "${LAPACK_LIBRARIES}" + OUTPUT_NAME sundials_sunlinsollapackdense + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_LAPACKDENSE module") diff --git a/src/sunlinsol/lapackdense/fmod_int32/CMakeLists.txt b/src/sunlinsol/lapackdense/fmod_int32/CMakeLists.txt index 72b9d5acda..ed20a78200 100644 --- a/src/sunlinsol/lapackdense/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/lapackdense/fmod_int32/CMakeLists.txt @@ -15,16 +15,11 @@ # object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsollapackdense_mod - SOURCES - fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsollapackdense_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsollapackdense_mod + SOURCES fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c + LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsollapackdense_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_LAPACKDENSE F2003 interface") diff --git a/src/sunlinsol/lapackdense/fmod_int64/CMakeLists.txt b/src/sunlinsol/lapackdense/fmod_int64/CMakeLists.txt index 12bcb2fae2..b2eb2b329b 100644 --- a/src/sunlinsol/lapackdense/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/lapackdense/fmod_int64/CMakeLists.txt @@ -15,19 +15,13 @@ # object library # ---------------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsollapackdense_mod - SOURCES - fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsollapackdense_mod + SOURCES fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_fsunmatrixdense_mod - OUTPUT_NAME - sundials_fsunlinsollapackdense_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod + OUTPUT_NAME sundials_fsunlinsollapackdense_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_LAPACKDENSE F2003 interface") diff --git a/src/sunlinsol/magmadense/CMakeLists.txt b/src/sunlinsol/magmadense/CMakeLists.txt index 4fbaaaf49f..2928669307 100644 --- a/src/sunlinsol/magmadense/CMakeLists.txt +++ b/src/sunlinsol/magmadense/CMakeLists.txt @@ -23,24 +23,16 @@ elseif(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") endif() # Add the sunlinsol_magmadense library -sundials_add_library(sundials_sunlinsolmagmadense - SOURCES - sunlinsol_magmadense.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_magmadense.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolmagmadense + SOURCES sunlinsol_magmadense.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_magmadense.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC SUNDIALS::MAGMA ${_libs_needed} - OUTPUT_NAME - sundials_sunlinsolmagmadense - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC SUNDIALS::MAGMA ${_libs_needed} + OUTPUT_NAME sundials_sunlinsolmagmadense + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_MAGMADENSE module") diff --git a/src/sunlinsol/onemkldense/CMakeLists.txt b/src/sunlinsol/onemkldense/CMakeLists.txt index ccf16f5740..9fbecb5886 100644 --- a/src/sunlinsol/onemkldense/CMakeLists.txt +++ b/src/sunlinsol/onemkldense/CMakeLists.txt @@ -15,28 +15,19 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_ONEMKLDENSE\n\")") # Add the sunlinsol_onemkldense library -sundials_add_library(sundials_sunlinsolonemkldense - SOURCES - sunlinsol_onemkldense.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_onemkldense.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolonemkldense + SOURCES sunlinsol_onemkldense.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_onemkldense.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - COMPILE_FEATURES - PUBLIC cxx_std_17 - INCLUDE_DIRECTORIES - PUBLIC ${MKL_INCLUDE_DIR} - LINK_LIBRARIES - PUBLIC MKL::MKL_DPCPP sundials_sunmatrixonemkldense sundials_nvecsycl - OUTPUT_NAME - sundials_sunlinsolonemkldense - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + COMPILE_FEATURES PUBLIC cxx_std_17 + INCLUDE_DIRECTORIES PUBLIC ${MKL_INCLUDE_DIR} + LINK_LIBRARIES PUBLIC MKL::MKL_DPCPP sundials_sunmatrixonemkldense + sundials_nvecsycl + OUTPUT_NAME sundials_sunlinsolonemkldense + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNLINSOL_ONEMKLDENSE module") diff --git a/src/sunlinsol/pcg/CMakeLists.txt b/src/sunlinsol/pcg/CMakeLists.txt index e8e37003f2..9a872e3e73 100644 --- a/src/sunlinsol/pcg/CMakeLists.txt +++ b/src/sunlinsol/pcg/CMakeLists.txt @@ -18,23 +18,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_PCG\n\")") # Add the sunlinsol_pcg library -sundials_add_library(sundials_sunlinsolpcg - SOURCES - sunlinsol_pcg.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_pcg.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolpcg + SOURCES sunlinsol_pcg.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_pcg.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunlinsolpcg - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunlinsolpcg + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_PCG module") diff --git a/src/sunlinsol/pcg/fmod_int32/CMakeLists.txt b/src/sunlinsol/pcg/fmod_int32/CMakeLists.txt index e863f286ee..b89dc76f74 100644 --- a/src/sunlinsol/pcg/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/pcg/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 PCG SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolpcg_mod - SOURCES - fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolpcg_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolpcg_mod + SOURCES fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolpcg_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_PCG F2003 interface") diff --git a/src/sunlinsol/pcg/fmod_int64/CMakeLists.txt b/src/sunlinsol/pcg/fmod_int64/CMakeLists.txt index 535741e7d6..ad5985e0b8 100644 --- a/src/sunlinsol/pcg/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/pcg/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 PCG SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolpcg_mod - SOURCES - fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolpcg_mod + SOURCES fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunlinsolpcg_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunlinsolpcg_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_PCG F2003 interface") diff --git a/src/sunlinsol/spbcgs/CMakeLists.txt b/src/sunlinsol/spbcgs/CMakeLists.txt index 331c788606..71f4118a63 100644 --- a/src/sunlinsol/spbcgs/CMakeLists.txt +++ b/src/sunlinsol/spbcgs/CMakeLists.txt @@ -18,23 +18,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPBCGS\n\")") # Add the sunlinsol_spbcgs library -sundials_add_library(sundials_sunlinsolspbcgs - SOURCES - sunlinsol_spbcgs.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spbcgs.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolspbcgs + SOURCES sunlinsol_spbcgs.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spbcgs.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunlinsolspbcgs - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunlinsolspbcgs + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPBCGS module") diff --git a/src/sunlinsol/spbcgs/fmod_int32/CMakeLists.txt b/src/sunlinsol/spbcgs/fmod_int32/CMakeLists.txt index d05fdd7d0c..23db9490eb 100644 --- a/src/sunlinsol/spbcgs/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/spbcgs/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 SPBCGS SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolspbcgs_mod - SOURCES - fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolspbcgs_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolspbcgs_mod + SOURCES fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolspbcgs_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPBCGS F2003 interface") diff --git a/src/sunlinsol/spbcgs/fmod_int64/CMakeLists.txt b/src/sunlinsol/spbcgs/fmod_int64/CMakeLists.txt index d1b588396f..903402f4de 100644 --- a/src/sunlinsol/spbcgs/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/spbcgs/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 SPBCGS SUNLinearSolver object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunlinsolspbcgs_mod - SOURCES - fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolspbcgs_mod + SOURCES fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunlinsolspbcgs_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunlinsolspbcgs_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPBCGS F2003 interface") diff --git a/src/sunlinsol/spfgmr/CMakeLists.txt b/src/sunlinsol/spfgmr/CMakeLists.txt index 38b9d784e9..fc2765c584 100644 --- a/src/sunlinsol/spfgmr/CMakeLists.txt +++ b/src/sunlinsol/spfgmr/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPFGMR\n\")") # Add the sunlinsol_spfgmr library -sundials_add_library(sundials_sunlinsolspfgmr - SOURCES - sunlinsol_spfgmr.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spfgmr.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolspfgmr + SOURCES sunlinsol_spfgmr.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spfgmr.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunlinsolspfgmr - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunlinsolspfgmr + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPFGMR module") diff --git a/src/sunlinsol/spfgmr/fmod_int32/CMakeLists.txt b/src/sunlinsol/spfgmr/fmod_int32/CMakeLists.txt index c2cbd50123..4d52831daa 100644 --- a/src/sunlinsol/spfgmr/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/spfgmr/fmod_int32/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 SPFGMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolspfgmr_mod - SOURCES - fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolspfgmr_mod + SOURCES fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunlinsolspfgmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunlinsolspfgmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPFGMR F2003 interface") diff --git a/src/sunlinsol/spfgmr/fmod_int64/CMakeLists.txt b/src/sunlinsol/spfgmr/fmod_int64/CMakeLists.txt index 4a236368f8..335cb9a895 100644 --- a/src/sunlinsol/spfgmr/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/spfgmr/fmod_int64/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 SPFGMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolspfgmr_mod - SOURCES - fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolspfgmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolspfgmr_mod + SOURCES fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolspfgmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPFGMR F2003 interface") diff --git a/src/sunlinsol/spgmr/CMakeLists.txt b/src/sunlinsol/spgmr/CMakeLists.txt index 712f07731a..d6a36526b0 100644 --- a/src/sunlinsol/spgmr/CMakeLists.txt +++ b/src/sunlinsol/spgmr/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPGMR\n\")") # Add the sunlinsol_spgmr library -sundials_add_library(sundials_sunlinsolspgmr - SOURCES - sunlinsol_spgmr.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spgmr.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolspgmr + SOURCES sunlinsol_spgmr.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spgmr.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunlinsolspgmr - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunlinsolspgmr + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPGMR module") diff --git a/src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt b/src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt index 9ea74e0e45..b359729811 100644 --- a/src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 SPGMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolspgmr_mod - SOURCES - fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolspgmr_mod + SOURCES fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunlinsolspgmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunlinsolspgmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPGMR F2003 interface") diff --git a/src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt b/src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt index 005f891f6c..bfbb2e11ad 100644 --- a/src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 SPGMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolspgmr_mod - SOURCES - fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolspgmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolspgmr_mod + SOURCES fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolspgmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPGMR F2003 interface") diff --git a/src/sunlinsol/sptfqmr/CMakeLists.txt b/src/sunlinsol/sptfqmr/CMakeLists.txt index 60bb70ef1f..8eb8a9795f 100644 --- a/src/sunlinsol/sptfqmr/CMakeLists.txt +++ b/src/sunlinsol/sptfqmr/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPTFQMR\n\")") # Add the sunlinsol_sptfqmr library -sundials_add_library(sundials_sunlinsolsptfqmr - SOURCES - sunlinsol_sptfqmr.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_sptfqmr.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolsptfqmr + SOURCES sunlinsol_sptfqmr.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_sptfqmr.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunlinsolsptfqmr - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunlinsolsptfqmr + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPTFQMR module") diff --git a/src/sunlinsol/sptfqmr/fmod_int32/CMakeLists.txt b/src/sunlinsol/sptfqmr/fmod_int32/CMakeLists.txt index ff3dc41956..f38d135a57 100644 --- a/src/sunlinsol/sptfqmr/fmod_int32/CMakeLists.txt +++ b/src/sunlinsol/sptfqmr/fmod_int32/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 SPTFQMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolsptfqmr_mod - SOURCES - fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunlinsolsptfqmr_mod + SOURCES fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunlinsolsptfqmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunlinsolsptfqmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPTFQMR F2003 interface") diff --git a/src/sunlinsol/sptfqmr/fmod_int64/CMakeLists.txt b/src/sunlinsol/sptfqmr/fmod_int64/CMakeLists.txt index 2aa92f9022..00ac061002 100644 --- a/src/sunlinsol/sptfqmr/fmod_int64/CMakeLists.txt +++ b/src/sunlinsol/sptfqmr/fmod_int64/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 SPTFQMR SUNLinearSolver object library # ------------------------------------------------------------------------ -sundials_add_f2003_library(sundials_fsunlinsolsptfqmr_mod - SOURCES - fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunlinsolsptfqmr_mod - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunlinsolsptfqmr_mod + SOURCES fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunlinsolsptfqmr_mod + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SPTFQMR F2003 interface") diff --git a/src/sunlinsol/superludist/CMakeLists.txt b/src/sunlinsol/superludist/CMakeLists.txt index ecff5b1e52..acd34e103e 100644 --- a/src/sunlinsol/superludist/CMakeLists.txt +++ b/src/sunlinsol/superludist/CMakeLists.txt @@ -17,30 +17,19 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SUPERLUDIST\n\")") # Add the library -sundials_add_library(sundials_sunlinsolsuperludist - SOURCES - sunlinsol_superludist.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superludist.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolsuperludist + SOURCES sunlinsol_superludist.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superludist.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES LINK_LIBRARIES - PUBLIC - sundials_sunmatrixslunrloc - SUNDIALS::SUPERLUDIST - $,OpenMP::OpenMP_C,> - MPI::MPI_C - COMPILE_OPTIONS - PRIVATE ${_compile_options} - OUTPUT_NAME - sundials_sunlinsolsuperludist - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + PUBLIC sundials_sunmatrixslunrloc SUNDIALS::SUPERLUDIST + $,OpenMP::OpenMP_C,> MPI::MPI_C + COMPILE_OPTIONS PRIVATE ${_compile_options} + OUTPUT_NAME sundials_sunlinsolsuperludist + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SUPERLUDIST module") diff --git a/src/sunlinsol/superlumt/CMakeLists.txt b/src/sunlinsol/superlumt/CMakeLists.txt index c4b665bb47..745fde598a 100644 --- a/src/sunlinsol/superlumt/CMakeLists.txt +++ b/src/sunlinsol/superlumt/CMakeLists.txt @@ -16,8 +16,7 @@ install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SUPERLUMT\n\")") -# Include OpenMP flags if SuperLU_MT is using OpenMP, -# otherwise we use threads. +# Include OpenMP flags if SuperLU_MT is using OpenMP, otherwise we use threads. if(SUPERLUMT_THREAD_TYPE STREQUAL "OPENMP") set(_threads OpenMP::OpenMP_C) else() @@ -25,26 +24,16 @@ else() endif() # Add the library -sundials_add_library(sundials_sunlinsolsuperlumt - SOURCES - sunlinsol_superlumt.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superlumt.h - INCLUDE_SUBDIR - sunlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunlinsolsuperlumt + SOURCES sunlinsol_superlumt.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superlumt.h + INCLUDE_SUBDIR sunlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC - sundials_sunmatrixsparse - SUNDIALS::SUPERLUMT ${_threads} - OUTPUT_NAME - sundials_sunlinsolsuperlumt - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse SUNDIALS::SUPERLUMT ${_threads} + OUTPUT_NAME sundials_sunlinsolsuperlumt + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_SOVERSION}) message(STATUS "Added SUNLINSOL_SUPERLUMT module") diff --git a/src/sunmatrix/CMakeLists.txt b/src/sunmatrix/CMakeLists.txt index eec6be4f72..f9f9ce95da 100644 --- a/src/sunmatrix/CMakeLists.txt +++ b/src/sunmatrix/CMakeLists.txt @@ -29,30 +29,38 @@ if(BUILD_SUNMATRIX_GINKGO) message(STATUS "Added BUILD_SUNMATRIX_GINKGO module") add_library(sundials_sunmatrixginkgo INTERFACE) target_link_libraries(sundials_sunmatrixginkgo INTERFACE sundials_core) - target_include_directories(sundials_sunmatrixginkgo INTERFACE - $ - $ - $ - $) + target_include_directories( + sundials_sunmatrixginkgo + INTERFACE $ + $ + $ + $) install(FILES ${PROJECT_SOURCE_DIR}/include/sunmatrix/sunmatrix_ginkgo.hpp - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunmatrix") - set(_SUNDIALS_INSTALLED_COMPONENTS "sunmatrixginkgo;${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunmatrix") + set(_SUNDIALS_INSTALLED_COMPONENTS + "sunmatrixginkgo;${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() if(BUILD_SUNMATRIX_KOKKOSDENSE) install(CODE "MESSAGE(\"\nInstall SUNMATRIX_KOKKOSDENSE\n\")") message(STATUS "Added BUILD_SUNMATRIX_KOKKOSDENSE module") add_library(sundials_sunmatrixkokkosdense INTERFACE) - target_link_libraries(sundials_sunmatrixkokkosdense INTERFACE - sundials_core Kokkos::kokkos Kokkos::kokkoskernels) - target_include_directories(sundials_sunmatrixkokkosdense INTERFACE - $ - $ - $ - $) - install(FILES ${PROJECT_SOURCE_DIR}/include/sunmatrix/sunmatrix_kokkosdense.hpp + target_link_libraries( + sundials_sunmatrixkokkosdense INTERFACE sundials_core Kokkos::kokkos + Kokkos::kokkoskernels) + target_include_directories( + sundials_sunmatrixkokkosdense + INTERFACE $ + $ + $ + $) + install( + FILES ${PROJECT_SOURCE_DIR}/include/sunmatrix/sunmatrix_kokkosdense.hpp DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sunmatrix") - set(_SUNDIALS_INSTALLED_COMPONENTS "sunmatrixkokkosdense;${_SUNDIALS_INSTALLED_COMPONENTS}" CACHE INTERNAL "" FORCE) + set(_SUNDIALS_INSTALLED_COMPONENTS + "sunmatrixkokkosdense;${_SUNDIALS_INSTALLED_COMPONENTS}" + CACHE INTERNAL "" FORCE) endif() if(BUILD_SUNMATRIX_MAGMADENSE) diff --git a/src/sunmatrix/band/CMakeLists.txt b/src/sunmatrix/band/CMakeLists.txt index 240fcf7ed4..3cbb540a45 100644 --- a/src/sunmatrix/band/CMakeLists.txt +++ b/src/sunmatrix/band/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNMATRIX_BAND\n\")") # Add the sunmatrix_band library -sundials_add_library(sundials_sunmatrixband - SOURCES - sunmatrix_band.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_band.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunmatrixband + SOURCES sunmatrix_band.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_band.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunmatrixband - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_sunmatrixband + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_BAND module") diff --git a/src/sunmatrix/band/fmod_int32/CMakeLists.txt b/src/sunmatrix/band/fmod_int32/CMakeLists.txt index 6026568af8..44e9fc667a 100644 --- a/src/sunmatrix/band/fmod_int32/CMakeLists.txt +++ b/src/sunmatrix/band/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 band SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixband_mod - SOURCES - fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunmatrixband_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunmatrixband_mod + SOURCES fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunmatrixband_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_BAND F2003 interface") diff --git a/src/sunmatrix/band/fmod_int64/CMakeLists.txt b/src/sunmatrix/band/fmod_int64/CMakeLists.txt index 465260d783..2c4bac0524 100644 --- a/src/sunmatrix/band/fmod_int64/CMakeLists.txt +++ b/src/sunmatrix/band/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 band SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixband_mod - SOURCES - fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunmatrixband_mod + SOURCES fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunmatrixband_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_fsunmatrixband_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_BAND F2003 interface") diff --git a/src/sunmatrix/cusparse/CMakeLists.txt b/src/sunmatrix/cusparse/CMakeLists.txt index b1bf8a069a..d56ebf3566 100644 --- a/src/sunmatrix/cusparse/CMakeLists.txt +++ b/src/sunmatrix/cusparse/CMakeLists.txt @@ -17,25 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNMATRIX_CUSPARSE\n\")") # Add the library -sundials_add_library(sundials_sunmatrixcusparse - SOURCES - sunmatrix_cusparse.cu - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_cusparse.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_sunmemcuda_obj - LINK_LIBRARIES - PUBLIC CUDA::cusparse CUDA::cusolver - OUTPUT_NAME - sundials_sunmatrixcusparse - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) +sundials_add_library( + sundials_sunmatrixcusparse + SOURCES sunmatrix_cusparse.cu + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_cusparse.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_sunmemcuda_obj + LINK_LIBRARIES PUBLIC CUDA::cusparse CUDA::cusolver + OUTPUT_NAME sundials_sunmatrixcusparse + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_CUSPARSE module") diff --git a/src/sunmatrix/dense/CMakeLists.txt b/src/sunmatrix/dense/CMakeLists.txt index e9e1b9ad85..83b3e993b1 100644 --- a/src/sunmatrix/dense/CMakeLists.txt +++ b/src/sunmatrix/dense/CMakeLists.txt @@ -18,23 +18,16 @@ install(CODE "MESSAGE(\"\nInstall SUNMATRIX_DENSE\n\")") # Add the sunmatrix_dense library -sundials_add_library(sundials_sunmatrixdense - SOURCES - sunmatrix_dense.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_dense.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunmatrixdense + SOURCES sunmatrix_dense.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_dense.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunmatrixdense - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_sunmatrixdense + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_DENSE module") diff --git a/src/sunmatrix/dense/fmod_int32/CMakeLists.txt b/src/sunmatrix/dense/fmod_int32/CMakeLists.txt index 987102b9f6..1bd612002e 100644 --- a/src/sunmatrix/dense/fmod_int32/CMakeLists.txt +++ b/src/sunmatrix/dense/fmod_int32/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 dense SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixdense_mod - SOURCES - fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunmatrixdense_mod + SOURCES fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunmatrixdense_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_fsunmatrixdense_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_DENSE F2003 interface") diff --git a/src/sunmatrix/dense/fmod_int64/CMakeLists.txt b/src/sunmatrix/dense/fmod_int64/CMakeLists.txt index 6b11defa31..a4baea3b35 100644 --- a/src/sunmatrix/dense/fmod_int64/CMakeLists.txt +++ b/src/sunmatrix/dense/fmod_int64/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 dense SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixdense_mod - SOURCES - fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunmatrixdense_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunmatrixdense_mod + SOURCES fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunmatrixdense_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_DENSE F2003 interface") diff --git a/src/sunmatrix/magmadense/CMakeLists.txt b/src/sunmatrix/magmadense/CMakeLists.txt index 07eb539943..256cb6b3ab 100644 --- a/src/sunmatrix/magmadense/CMakeLists.txt +++ b/src/sunmatrix/magmadense/CMakeLists.txt @@ -12,7 +12,9 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -install(CODE "MESSAGE(\"\nInstall SUNMATRIX_MAGMADENSE with ${SUNDIALS_MAGMA_BACKENDS} backend(s)\n\")") +install( + CODE "MESSAGE(\"\nInstall SUNMATRIX_MAGMADENSE with ${SUNDIALS_MAGMA_BACKENDS} backend(s)\n\")" +) if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") set_source_files_properties(sunmatrix_magmadense.cpp PROPERTIES LANGUAGE CUDA) @@ -23,26 +25,20 @@ elseif(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") endif() # Add the sunmatrix_magmadense library -sundials_add_library(sundials_sunmatrixmagmadense - SOURCES - sunmatrix_magmadense.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_magmadense.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunmatrixmagmadense + SOURCES sunmatrix_magmadense.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_magmadense.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - INCLUDE_DIRECTORIES - PUBLIC ${MAGMA_INCLUDE_DIR} - LINK_LIBRARIES - PUBLIC SUNDIALS::MAGMA ${_libs_needed} - OUTPUT_NAME - sundials_sunmatrixmagmadense - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + INCLUDE_DIRECTORIES PUBLIC ${MAGMA_INCLUDE_DIR} + LINK_LIBRARIES PUBLIC SUNDIALS::MAGMA ${_libs_needed} + OUTPUT_NAME sundials_sunmatrixmagmadense + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) -message(STATUS "Added SUNMATRIX_MAGMADENSE module with ${SUNDIALS_MAGMA_BACKENDS} backend(s)") +message( + STATUS + "Added SUNMATRIX_MAGMADENSE module with ${SUNDIALS_MAGMA_BACKENDS} backend(s)" +) diff --git a/src/sunmatrix/onemkldense/CMakeLists.txt b/src/sunmatrix/onemkldense/CMakeLists.txt index c9547a8cf6..b6ab57855a 100644 --- a/src/sunmatrix/onemkldense/CMakeLists.txt +++ b/src/sunmatrix/onemkldense/CMakeLists.txt @@ -15,29 +15,18 @@ install(CODE "MESSAGE(\"\nInstall SUNMATRIX_ONEMKLDENSE\n\")") # Create the library -sundials_add_library(sundials_sunmatrixonemkldense - SOURCES - sunmatrix_onemkldense.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_onemkldense.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIBRARIES - sundials_sunmemsycl_obj - COMPILE_FEATURES - PUBLIC cxx_std_17 - INCLUDE_DIRECTORIES - PUBLIC ${MKL_INCLUDE_DIR} - LINK_LIBRARIES - PUBLIC MKL::MKL_DPCPP - OUTPUT_NAME - sundials_sunmatrixonemkldense - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) +sundials_add_library( + sundials_sunmatrixonemkldense + SOURCES sunmatrix_onemkldense.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_onemkldense.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIBRARIES sundials_sunmemsycl_obj + COMPILE_FEATURES PUBLIC cxx_std_17 + INCLUDE_DIRECTORIES PUBLIC ${MKL_INCLUDE_DIR} + LINK_LIBRARIES PUBLIC MKL::MKL_DPCPP + OUTPUT_NAME sundials_sunmatrixonemkldense + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added SUNMATRIX_ONEMKLDENSE module") diff --git a/src/sunmatrix/slunrloc/CMakeLists.txt b/src/sunmatrix/slunrloc/CMakeLists.txt index 73f9857870..7d49a136c8 100644 --- a/src/sunmatrix/slunrloc/CMakeLists.txt +++ b/src/sunmatrix/slunrloc/CMakeLists.txt @@ -21,27 +21,18 @@ set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) # Add the library -sundials_add_library(sundials_sunmatrixslunrloc - SOURCES - sunmatrix_slunrloc.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_slunrloc.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunmatrixslunrloc + SOURCES sunmatrix_slunrloc.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_slunrloc.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC SUNDIALS::SUPERLUDIST - $,OpenMP::OpenMP_C,> - COMPILE_OPTIONS - PRIVATE ${_compile_options} - OUTPUT_NAME - sundials_sunmatrixslunrloc - VERSION - ${sunlinsollib_VERSION} - SOVERSION - ${sunlinsollib_VERSION} -) + LINK_LIBRARIES PUBLIC SUNDIALS::SUPERLUDIST + $,OpenMP::OpenMP_C,> + COMPILE_OPTIONS PRIVATE ${_compile_options} + OUTPUT_NAME sundials_sunmatrixslunrloc + VERSION ${sunlinsollib_VERSION} + SOVERSION ${sunlinsollib_VERSION}) message(STATUS "Added SUNMATRIX_SLUNRLOC module") diff --git a/src/sunmatrix/sparse/CMakeLists.txt b/src/sunmatrix/sparse/CMakeLists.txt index 3ca9363150..8795ae3cdf 100644 --- a/src/sunmatrix/sparse/CMakeLists.txt +++ b/src/sunmatrix/sparse/CMakeLists.txt @@ -18,23 +18,16 @@ install(CODE "MESSAGE(\"\nInstall SUNMATRIX_SPARSE\n\")") # Add the sunmatrix_sparse library -sundials_add_library(sundials_sunmatrixsparse - SOURCES - sunmatrix_sparse.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_sparse.h - INCLUDE_SUBDIR - sunmatrix - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunmatrixsparse + SOURCES sunmatrix_sparse.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_sparse.h + INCLUDE_SUBDIR sunmatrix + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunmatrixsparse - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_sunmatrixsparse + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_SPARSE module") diff --git a/src/sunmatrix/sparse/fmod_int32/CMakeLists.txt b/src/sunmatrix/sparse/fmod_int32/CMakeLists.txt index 407bddff70..e9792d9e35 100644 --- a/src/sunmatrix/sparse/fmod_int32/CMakeLists.txt +++ b/src/sunmatrix/sparse/fmod_int32/CMakeLists.txt @@ -14,17 +14,12 @@ # CMakeLists.txt file for the F2003 sparse SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixsparse_mod - SOURCES - fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunmatrixsparse_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunmatrixsparse_mod + SOURCES fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunmatrixsparse_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_SPARSE F2003 interface") diff --git a/src/sunmatrix/sparse/fmod_int64/CMakeLists.txt b/src/sunmatrix/sparse/fmod_int64/CMakeLists.txt index fb0ed79b4c..e7d02abf11 100644 --- a/src/sunmatrix/sparse/fmod_int64/CMakeLists.txt +++ b/src/sunmatrix/sparse/fmod_int64/CMakeLists.txt @@ -14,18 +14,13 @@ # CMakeLists.txt file for the F2003 sparse SUNMatrix object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunmatrixsparse_mod - SOURCES - fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunmatrixsparse_mod + SOURCES fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunmatrixsparse_mod - VERSION - ${sunmatrixlib_VERSION} - SOVERSION - ${sunmatrixlib_SOVERSION} -) + OUTPUT_NAME sundials_fsunmatrixsparse_mod + VERSION ${sunmatrixlib_VERSION} + SOVERSION ${sunmatrixlib_SOVERSION}) message(STATUS "Added SUNMATRIX_SPARSE F2003 interface") diff --git a/src/sunmemory/cuda/CMakeLists.txt b/src/sunmemory/cuda/CMakeLists.txt index bd20b95824..6dadcc8e4b 100644 --- a/src/sunmemory/cuda/CMakeLists.txt +++ b/src/sunmemory/cuda/CMakeLists.txt @@ -13,14 +13,10 @@ # --------------------------------------------------------------- # Create a library out of the generic sundials modules -sundials_add_library(sundials_sunmemcuda - SOURCES - sundials_cuda_memory.cu - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_cuda.h - LINK_LIBRARIES - PUBLIC sundials_core - INCLUDE_SUBDIR - sunmemory - OBJECT_LIB_ONLY -) +sundials_add_library( + sundials_sunmemcuda + SOURCES sundials_cuda_memory.cu + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_cuda.h + LINK_LIBRARIES PUBLIC sundials_core + INCLUDE_SUBDIR sunmemory + OBJECT_LIB_ONLY) diff --git a/src/sunmemory/hip/CMakeLists.txt b/src/sunmemory/hip/CMakeLists.txt index 64c650dae3..eda739ebc6 100644 --- a/src/sunmemory/hip/CMakeLists.txt +++ b/src/sunmemory/hip/CMakeLists.txt @@ -13,15 +13,10 @@ # --------------------------------------------------------------- # Create a library out of the generic sundials modules -sundials_add_library(sundials_sunmemhip - SOURCES - sundials_hip_memory.hip.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_hip.h - INCLUDE_SUBDIR - sunmemory - LINK_LIBRARIES - PUBLIC sundials_core - PRIVATE hip::device - OBJECT_LIB_ONLY -) +sundials_add_library( + sundials_sunmemhip + SOURCES sundials_hip_memory.hip.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_hip.h + INCLUDE_SUBDIR sunmemory + LINK_LIBRARIES PUBLIC sundials_core PRIVATE hip::device + OBJECT_LIB_ONLY) diff --git a/src/sunmemory/sycl/CMakeLists.txt b/src/sunmemory/sycl/CMakeLists.txt index b425e09745..46dd11eb4d 100644 --- a/src/sunmemory/sycl/CMakeLists.txt +++ b/src/sunmemory/sycl/CMakeLists.txt @@ -13,14 +13,10 @@ # --------------------------------------------------------------- # Create library -sundials_add_library(sundials_sunmemsycl - SOURCES - sundials_sycl_memory.cpp - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_sycl.h - INCLUDE_SUBDIR - sunmemory - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIB_ONLY -) +sundials_add_library( + sundials_sunmemsycl + SOURCES sundials_sycl_memory.cpp + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_sycl.h + INCLUDE_SUBDIR sunmemory + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIB_ONLY) diff --git a/src/sunmemory/system/CMakeLists.txt b/src/sunmemory/system/CMakeLists.txt index 70157d78d8..d3368974a1 100644 --- a/src/sunmemory/system/CMakeLists.txt +++ b/src/sunmemory/system/CMakeLists.txt @@ -13,14 +13,10 @@ # --------------------------------------------------------------- # Create a library out of the generic sundials modules -sundials_add_library(sundials_sunmemsys - SOURCES - sundials_system_memory.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_system.h - INCLUDE_SUBDIR - sunmemory - LINK_LIBRARIES - PUBLIC sundials_core - OBJECT_LIB_ONLY -) +sundials_add_library( + sundials_sunmemsys + SOURCES sundials_system_memory.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_system.h + INCLUDE_SUBDIR sunmemory + LINK_LIBRARIES PUBLIC sundials_core + OBJECT_LIB_ONLY) diff --git a/src/sunnonlinsol/fixedpoint/CMakeLists.txt b/src/sunnonlinsol/fixedpoint/CMakeLists.txt index 257fe8f97b..82821d35ce 100644 --- a/src/sunnonlinsol/fixedpoint/CMakeLists.txt +++ b/src/sunnonlinsol/fixedpoint/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNNONLINSOL_FIXEDPOINT\n\")") # Add the library -sundials_add_library(sundials_sunnonlinsolfixedpoint - SOURCES - sunnonlinsol_fixedpoint.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_fixedpoint.h - INCLUDE_SUBDIR - sunnonlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunnonlinsolfixedpoint + SOURCES sunnonlinsol_fixedpoint.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_fixedpoint.h + INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunnonlinsolfixedpoint - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunnonlinsolfixedpoint + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_FIXEDPOINT module") diff --git a/src/sunnonlinsol/fixedpoint/fmod_int32/CMakeLists.txt b/src/sunnonlinsol/fixedpoint/fmod_int32/CMakeLists.txt index bb2f0097b6..2b695d6ba3 100644 --- a/src/sunnonlinsol/fixedpoint/fmod_int32/CMakeLists.txt +++ b/src/sunnonlinsol/fixedpoint/fmod_int32/CMakeLists.txt @@ -15,18 +15,13 @@ # object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunnonlinsolfixedpoint_mod - SOURCES - fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunnonlinsolfixedpoint_mod + SOURCES fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunnonlinsolfixedpoint_mod - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunnonlinsolfixedpoint_mod + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_FIXEDPOINT F2003 interface") diff --git a/src/sunnonlinsol/fixedpoint/fmod_int64/CMakeLists.txt b/src/sunnonlinsol/fixedpoint/fmod_int64/CMakeLists.txt index 6e24d5269c..4b064101b2 100644 --- a/src/sunnonlinsol/fixedpoint/fmod_int64/CMakeLists.txt +++ b/src/sunnonlinsol/fixedpoint/fmod_int64/CMakeLists.txt @@ -15,17 +15,12 @@ # object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunnonlinsolfixedpoint_mod - SOURCES - fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunnonlinsolfixedpoint_mod - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunnonlinsolfixedpoint_mod + SOURCES fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunnonlinsolfixedpoint_mod + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_FIXEDPOINT F2003 interface") diff --git a/src/sunnonlinsol/newton/CMakeLists.txt b/src/sunnonlinsol/newton/CMakeLists.txt index 718b026d3f..2664fe18e2 100644 --- a/src/sunnonlinsol/newton/CMakeLists.txt +++ b/src/sunnonlinsol/newton/CMakeLists.txt @@ -17,23 +17,16 @@ install(CODE "MESSAGE(\"\nInstall SUNNONLINSOL_NEWTON\n\")") # Add the library -sundials_add_library(sundials_sunnonlinsolnewton - SOURCES - sunnonlinsol_newton.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_newton.h - INCLUDE_SUBDIR - sunnonlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunnonlinsolnewton + SOURCES sunnonlinsol_newton.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_newton.h + INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - OUTPUT_NAME - sundials_sunnonlinsolnewton - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_sunnonlinsolnewton + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_NEWTON module") diff --git a/src/sunnonlinsol/newton/fmod_int32/CMakeLists.txt b/src/sunnonlinsol/newton/fmod_int32/CMakeLists.txt index 883fac35ed..6851b86153 100644 --- a/src/sunnonlinsol/newton/fmod_int32/CMakeLists.txt +++ b/src/sunnonlinsol/newton/fmod_int32/CMakeLists.txt @@ -15,17 +15,12 @@ # object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunnonlinsolnewton_mod - SOURCES - fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod - OUTPUT_NAME - sundials_fsunnonlinsolnewton_mod - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) +sundials_add_f2003_library( + sundials_fsunnonlinsolnewton_mod + SOURCES fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod + OUTPUT_NAME sundials_fsunnonlinsolnewton_mod + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_NEWTON F2003 interface") diff --git a/src/sunnonlinsol/newton/fmod_int64/CMakeLists.txt b/src/sunnonlinsol/newton/fmod_int64/CMakeLists.txt index 46be1ab585..25108f7457 100644 --- a/src/sunnonlinsol/newton/fmod_int64/CMakeLists.txt +++ b/src/sunnonlinsol/newton/fmod_int64/CMakeLists.txt @@ -15,18 +15,13 @@ # object library # --------------------------------------------------------------- -sundials_add_f2003_library(sundials_fsunnonlinsolnewton_mod - SOURCES - fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c - LINK_LIBRARIES - PUBLIC sundials_fcore_mod +sundials_add_f2003_library( + sundials_fsunnonlinsolnewton_mod + SOURCES fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c + LINK_LIBRARIES PUBLIC sundials_fcore_mod OBJECT_LIBRARIES - OUTPUT_NAME - sundials_fsunnonlinsolnewton_mod - VERSION - ${sunnonlinsollib_VERSION} - SOVERSION - ${sunnonlinsollib_SOVERSION} -) + OUTPUT_NAME sundials_fsunnonlinsolnewton_mod + VERSION ${sunnonlinsollib_VERSION} + SOVERSION ${sunnonlinsollib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_NEWTON F2003 interface") diff --git a/src/sunnonlinsol/petscsnes/CMakeLists.txt b/src/sunnonlinsol/petscsnes/CMakeLists.txt index 4334d0a654..909dbecad5 100644 --- a/src/sunnonlinsol/petscsnes/CMakeLists.txt +++ b/src/sunnonlinsol/petscsnes/CMakeLists.txt @@ -24,24 +24,16 @@ else() endif() # Create the library -sundials_add_library(sundials_sunnonlinsolpetscsnes - SOURCES - sunnonlinsol_petscsnes.c - HEADERS - ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_petscsnes.h - INCLUDE_SUBDIR - sunnonlinsol - LINK_LIBRARIES - PUBLIC sundials_core +sundials_add_library( + sundials_sunnonlinsolpetscsnes + SOURCES sunnonlinsol_petscsnes.c + HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_petscsnes.h + INCLUDE_SUBDIR sunnonlinsol + LINK_LIBRARIES PUBLIC sundials_core OBJECT_LIBRARIES - LINK_LIBRARIES - PUBLIC sundials_nvecpetsc SUNDIALS::PETSC - OUTPUT_NAME - sundials_sunnonlinsolpetscsnes - VERSION - ${nveclib_VERSION} - SOVERSION - ${nveclib_SOVERSION} -) + LINK_LIBRARIES PUBLIC sundials_nvecpetsc SUNDIALS::PETSC + OUTPUT_NAME sundials_sunnonlinsolpetscsnes + VERSION ${nveclib_VERSION} + SOVERSION ${nveclib_SOVERSION}) message(STATUS "Added SUNNONLINSOL_PETSCSNES module") diff --git a/test/unit_tests/arkode/CMakeLists.txt b/test/unit_tests/arkode/CMakeLists.txt index 7c06a015f5..a758ab3131 100644 --- a/test/unit_tests/arkode/CMakeLists.txt +++ b/test/unit_tests/arkode/CMakeLists.txt @@ -32,4 +32,3 @@ endif() if(BUILD_FORTRAN_MODULE_INTERFACE) add_subdirectory(F2003_serial) endif() - diff --git a/test/unit_tests/arkode/CXX_parallel/CMakeLists.txt b/test/unit_tests/arkode/CXX_parallel/CMakeLists.txt index 90661c5a22..825141646a 100644 --- a/test/unit_tests/arkode/CXX_parallel/CMakeLists.txt +++ b/test/unit_tests/arkode/CXX_parallel/CMakeLists.txt @@ -15,11 +15,9 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;tasks\;args" -if (NOT SUNDIALS_PRECISION MATCHES "SINGLE") - set(unit_tests - "ark_test_heat2D_mri.cpp\;2\;0" - "ark_test_heat2D_mri.cpp\;4\;1" - ) +if(NOT SUNDIALS_PRECISION MATCHES "SINGLE") + set(unit_tests "ark_test_heat2D_mri.cpp\;2\;0" + "ark_test_heat2D_mri.cpp\;4\;1") endif() # Add the build and install targets for each test @@ -33,8 +31,8 @@ foreach(test_tuple ${unit_tests}) # Extract the file name without extension get_filename_component(test_target ${test} NAME_WE) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test_target}) # test source files @@ -43,17 +41,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test_target} - MPI::MPI_CXX - sundials_arkode - sundials_nvecparallel - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} MPI::MPI_CXX sundials_arkode + sundials_nvecparallel ${EXE_EXTRA_LINK_LIBS}) endif() @@ -71,12 +66,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - MPI_NPROCS ${number_of_tasks} - ${diff_output}) + MPI_NPROCS ${number_of_tasks} ${diff_output}) endforeach() diff --git a/test/unit_tests/arkode/CXX_serial/CMakeLists.txt b/test/unit_tests/arkode/CXX_serial/CMakeLists.txt index 0d2bc15460..c1f22fc6bc 100644 --- a/test/unit_tests/arkode/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/arkode/CXX_serial/CMakeLists.txt @@ -16,33 +16,32 @@ # List of test tuples of the form "name\;args" set(unit_tests - "ark_test_analytic_sys_mri.cpp\;0" - "ark_test_analytic_sys_mri.cpp\;1" - "ark_test_dahlquist_ark.cpp\;0 -1 0" - "ark_test_dahlquist_ark.cpp\;0 0 0" - "ark_test_dahlquist_ark.cpp\;0 0 1" - "ark_test_dahlquist_ark.cpp\;0 1 0" - "ark_test_dahlquist_ark.cpp\;0 1 1" - "ark_test_dahlquist_ark.cpp\;1 -1 0" - "ark_test_dahlquist_ark.cpp\;1 0 0" - "ark_test_dahlquist_ark.cpp\;1 0 1" - "ark_test_dahlquist_ark.cpp\;1 1 0" - "ark_test_dahlquist_ark.cpp\;1 1 1" - "ark_test_dahlquist_ark.cpp\;2 -1 0" - "ark_test_dahlquist_ark.cpp\;2 0 0" - "ark_test_dahlquist_ark.cpp\;2 0 1" - "ark_test_dahlquist_ark.cpp\;2 1 0" - "ark_test_dahlquist_ark.cpp\;2 1 1" - "ark_test_dahlquist_erk.cpp\;-1" - "ark_test_dahlquist_erk.cpp\;0" - "ark_test_dahlquist_erk.cpp\;1" - "ark_test_dahlquist_mri.cpp\;-1" - "ark_test_dahlquist_mri.cpp\;0" - "ark_test_dahlquist_mri.cpp\;1" - "ark_test_butcher.cpp\;" - "ark_test_getjac.cpp\;" - "ark_test_getjac_mri.cpp\;" -) + "ark_test_analytic_sys_mri.cpp\;0" + "ark_test_analytic_sys_mri.cpp\;1" + "ark_test_dahlquist_ark.cpp\;0 -1 0" + "ark_test_dahlquist_ark.cpp\;0 0 0" + "ark_test_dahlquist_ark.cpp\;0 0 1" + "ark_test_dahlquist_ark.cpp\;0 1 0" + "ark_test_dahlquist_ark.cpp\;0 1 1" + "ark_test_dahlquist_ark.cpp\;1 -1 0" + "ark_test_dahlquist_ark.cpp\;1 0 0" + "ark_test_dahlquist_ark.cpp\;1 0 1" + "ark_test_dahlquist_ark.cpp\;1 1 0" + "ark_test_dahlquist_ark.cpp\;1 1 1" + "ark_test_dahlquist_ark.cpp\;2 -1 0" + "ark_test_dahlquist_ark.cpp\;2 0 0" + "ark_test_dahlquist_ark.cpp\;2 0 1" + "ark_test_dahlquist_ark.cpp\;2 1 0" + "ark_test_dahlquist_ark.cpp\;2 1 1" + "ark_test_dahlquist_erk.cpp\;-1" + "ark_test_dahlquist_erk.cpp\;0" + "ark_test_dahlquist_erk.cpp\;1" + "ark_test_dahlquist_mri.cpp\;-1" + "ark_test_dahlquist_mri.cpp\;0" + "ark_test_dahlquist_mri.cpp\;1" + "ark_test_butcher.cpp\;" + "ark_test_getjac.cpp\;" + "ark_test_getjac_mri.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -65,15 +64,16 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # We explicitly choose which object libraries to link to and link in the # arkode objects so that we have access to private functions w/o changing # their visibility in the installed libraries. - target_link_libraries(${test_target} + target_link_libraries( + ${test_target} $ sundials_sunmemsys_obj sundials_nvecserial_obj @@ -105,13 +105,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/arkode/C_serial/CMakeLists.txt b/test/unit_tests/arkode/C_serial/CMakeLists.txt index 720e4e6019..6794a213b4 100644 --- a/test/unit_tests/arkode/C_serial/CMakeLists.txt +++ b/test/unit_tests/arkode/C_serial/CMakeLists.txt @@ -16,24 +16,23 @@ # List of test tuples of the form "name\;args" set(ARKODE_unit_tests - "ark_test_arkstepsetforcing\;1 0" - "ark_test_arkstepsetforcing\;1 1" - "ark_test_arkstepsetforcing\;1 2" - "ark_test_arkstepsetforcing\;1 3" - "ark_test_arkstepsetforcing\;1 4" - "ark_test_arkstepsetforcing\;1 5" - "ark_test_arkstepsetforcing\;1 3 2.0 10.0" - "ark_test_arkstepsetforcing\;1 3 2.0 10.0 2.0 8.0" - "ark_test_arkstepsetforcing\;1 3 2.0 10.0 1.0 5.0" - "ark_test_getuserdata\;" - "ark_test_innerstepper\;" - "ark_test_interp\;-100" - "ark_test_interp\;-10000" - "ark_test_interp\;-1000000" - "ark_test_mass\;" - "ark_test_reset\;" - "ark_test_tstop\;" - ) + "ark_test_arkstepsetforcing\;1 0" + "ark_test_arkstepsetforcing\;1 1" + "ark_test_arkstepsetforcing\;1 2" + "ark_test_arkstepsetforcing\;1 3" + "ark_test_arkstepsetforcing\;1 4" + "ark_test_arkstepsetforcing\;1 5" + "ark_test_arkstepsetforcing\;1 3 2.0 10.0" + "ark_test_arkstepsetforcing\;1 3 2.0 10.0 2.0 8.0" + "ark_test_arkstepsetforcing\;1 3 2.0 10.0 1.0 5.0" + "ark_test_getuserdata\;" + "ark_test_innerstepper\;" + "ark_test_interp\;-100" + "ark_test_interp\;-10000" + "ark_test_interp\;-1000000" + "ark_test_mass\;" + "ark_test_reset\;" + "ark_test_tstop\;") # Add the build and install targets for each test foreach(test_tuple ${ARKODE_unit_tests}) @@ -42,8 +41,8 @@ foreach(test_tuple ${ARKODE_unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -52,15 +51,15 @@ foreach(test_tuple ${ARKODE_unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # We explicitly choose which object libraries to link to and link in the # arkode objects so that we have access to private functions w/o changing # their visibility in the installed libraries. - target_link_libraries(${test} + target_link_libraries( + ${test} $ sundials_sunmemsys_obj sundials_nvecserial_obj diff --git a/test/unit_tests/arkode/F2003_serial/CMakeLists.txt b/test/unit_tests/arkode/F2003_serial/CMakeLists.txt index 1125ac771d..ab48e3a4c3 100644 --- a/test/unit_tests/arkode/F2003_serial/CMakeLists.txt +++ b/test/unit_tests/arkode/F2003_serial/CMakeLists.txt @@ -15,19 +15,16 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(ARKODE_unit_tests - "ark_test_table_f2003\;" - ) +set(ARKODE_unit_tests "ark_test_table_f2003\;") foreach(test_tuple ${ARKODE_unit_tests}) - # parse the test tuple list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -36,9 +33,7 @@ foreach(test_tuple ${ARKODE_unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # libraries to link against - target_link_libraries(${test} - sundials_farkode_mod - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_farkode_mod ${EXE_EXTRA_LINK_LIBS}) endif() @@ -56,4 +51,3 @@ foreach(test_tuple ${ARKODE_unit_tests}) endforeach() message(STATUS "Added ARKODE F2003 serial unit tests") - diff --git a/test/unit_tests/arkode/gtest/CMakeLists.txt b/test/unit_tests/arkode/gtest/CMakeLists.txt index 0d6871f63b..071faee5c0 100644 --- a/test/unit_tests/arkode/gtest/CMakeLists.txt +++ b/test/unit_tests/arkode/gtest/CMakeLists.txt @@ -13,37 +13,31 @@ # include location of public and private header files add_executable(test_arkode_error_handling test_arkode_error_handling.cpp) -target_include_directories(test_arkode_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_arkode_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) -# We explicitly choose which object libraries to link to and link in the -# ARKODE objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_arkode_error_handling - PRIVATE - $ - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - sundials_sunadaptcontrollerimexgus_obj - sundials_sunadaptcontrollersoderlind_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the ARKODE +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_arkode_error_handling + PRIVATE $ + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + sundials_sunadaptcontrollerimexgus_obj + sundials_sunadaptcontrollersoderlind_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the ARKODE library since it does not pick -# that up from $. +# Tell CMake that we depend on the ARKODE library since it does not pick that up +# from $. add_dependencies(test_arkode_error_handling sundials_arkode_obj) -target_link_libraries(test_arkode_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_arkode_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_arkode_error_handling) diff --git a/test/unit_tests/cvode/CMakeLists.txt b/test/unit_tests/cvode/CMakeLists.txt index b0ac9c4ad9..13c49d32f1 100644 --- a/test/unit_tests/cvode/CMakeLists.txt +++ b/test/unit_tests/cvode/CMakeLists.txt @@ -20,7 +20,7 @@ add_subdirectory(C_serial) # C++ unit tests if(CXX_FOUND) add_subdirectory(CXX_serial) - if (SUNDIALS_TEST_ENABLE_GTEST) + if(SUNDIALS_TEST_ENABLE_GTEST) add_subdirectory(gtest) endif() endif() diff --git a/test/unit_tests/cvode/CXX_serial/CMakeLists.txt b/test/unit_tests/cvode/CXX_serial/CMakeLists.txt index 30a48464c5..9c5cec05b6 100644 --- a/test/unit_tests/cvode/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/cvode/CXX_serial/CMakeLists.txt @@ -16,19 +16,18 @@ # List of test tuples of the form "name\;args" set(unit_tests - "cv_test_kpr.cpp\;" - "cv_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" - "cv_test_kpr.cpp\;--eta_max_fs 2" - "cv_test_kpr.cpp\;--eta_min_es 2 --small_nst 5" - "cv_test_kpr.cpp\;--eta_min_gs 2" - "cv_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" - "cv_test_kpr.cpp\;--eta_min_ef 0.5" - "cv_test_kpr.cpp\;--eta_max_ef 0.1 --small_nef 1" - "cv_test_kpr.cpp\;--eta_cf 0.5" - "cv_test_kpr.cpp\;--dgmax_lsetup 0.0" - "cv_test_kpr.cpp\;--dgmax_jbad 1.0" - "cv_test_getjac.cpp\;" -) + "cv_test_kpr.cpp\;" + "cv_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" + "cv_test_kpr.cpp\;--eta_max_fs 2" + "cv_test_kpr.cpp\;--eta_min_es 2 --small_nst 5" + "cv_test_kpr.cpp\;--eta_min_gs 2" + "cv_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" + "cv_test_kpr.cpp\;--eta_min_ef 0.5" + "cv_test_kpr.cpp\;--eta_max_ef 0.1 --small_nef 1" + "cv_test_kpr.cpp\;--eta_cf 0.5" + "cv_test_kpr.cpp\;--dgmax_lsetup 0.0" + "cv_test_kpr.cpp\;--dgmax_jbad 1.0" + "cv_test_getjac.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -51,16 +50,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # Libraries to link against - target_link_libraries(${test_target} - sundials_cvode - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} sundials_cvode sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -78,13 +75,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/cvode/C_serial/CMakeLists.txt b/test/unit_tests/cvode/C_serial/CMakeLists.txt index 2c9708d32c..cf406d87b7 100644 --- a/test/unit_tests/cvode/C_serial/CMakeLists.txt +++ b/test/unit_tests/cvode/C_serial/CMakeLists.txt @@ -15,10 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "cv_test_getuserdata\;" - "cv_test_tstop\;" - ) +set(unit_tests "cv_test_getuserdata\;" "cv_test_tstop\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -27,8 +24,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -37,16 +34,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_cvode - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_cvode sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/cvode/gtest/CMakeLists.txt b/test/unit_tests/cvode/gtest/CMakeLists.txt index df16114295..43574de435 100644 --- a/test/unit_tests/cvode/gtest/CMakeLists.txt +++ b/test/unit_tests/cvode/gtest/CMakeLists.txt @@ -13,40 +13,34 @@ # include location of public and private header files add_executable(test_cvode_error_handling test_cvode_error_handling.cpp) -target_include_directories(test_cvode_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_cvode_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) set(_fused_link_lib sundials_cvode_fused_stubs_obj) endif() -# We explicitly choose which object libraries to link to and link in the -# cvode objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_cvode_error_handling - PRIVATE - $ - ${_fused_link_lib} - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the cvode +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_cvode_error_handling + PRIVATE $ + ${_fused_link_lib} + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the CVODE library since it does not pick -# that up from $. +# Tell CMake that we depend on the CVODE library since it does not pick that up +# from $. add_dependencies(test_cvode_error_handling sundials_cvode_obj) -target_link_libraries(test_cvode_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_cvode_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_cvode_error_handling) diff --git a/test/unit_tests/cvodes/CXX_serial/CMakeLists.txt b/test/unit_tests/cvodes/CXX_serial/CMakeLists.txt index b6988e1e54..5c635050ef 100644 --- a/test/unit_tests/cvodes/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/cvodes/CXX_serial/CMakeLists.txt @@ -16,19 +16,18 @@ # List of test tuples of the form "name\;args" set(unit_tests - "cvs_test_kpr.cpp\;" - "cvs_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" - "cvs_test_kpr.cpp\;--eta_max_fs 2" - "cvs_test_kpr.cpp\;--eta_min_es 2 --small_nst 5" - "cvs_test_kpr.cpp\;--eta_min_gs 2" - "cvs_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" - "cvs_test_kpr.cpp\;--eta_min_ef 0.5" - "cvs_test_kpr.cpp\;--eta_max_ef 0.1 --small_nef 1" - "cvs_test_kpr.cpp\;--eta_cf 0.5" - "cvs_test_kpr.cpp\;--dgmax_lsetup 0.0" - "cvs_test_kpr.cpp\;--dgmax_jbad 1.0" - "cvs_test_getjac.cpp\;" -) + "cvs_test_kpr.cpp\;" + "cvs_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" + "cvs_test_kpr.cpp\;--eta_max_fs 2" + "cvs_test_kpr.cpp\;--eta_min_es 2 --small_nst 5" + "cvs_test_kpr.cpp\;--eta_min_gs 2" + "cvs_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" + "cvs_test_kpr.cpp\;--eta_min_ef 0.5" + "cvs_test_kpr.cpp\;--eta_max_ef 0.1 --small_nef 1" + "cvs_test_kpr.cpp\;--eta_cf 0.5" + "cvs_test_kpr.cpp\;--dgmax_lsetup 0.0" + "cvs_test_kpr.cpp\;--dgmax_jbad 1.0" + "cvs_test_getjac.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -51,16 +50,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # Libraries to link against - target_link_libraries(${test_target} - sundials_cvodes - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} sundials_cvodes sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -78,13 +75,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/cvodes/C_serial/CMakeLists.txt b/test/unit_tests/cvodes/C_serial/CMakeLists.txt index 1b0c39e951..cebc506bed 100644 --- a/test/unit_tests/cvodes/C_serial/CMakeLists.txt +++ b/test/unit_tests/cvodes/C_serial/CMakeLists.txt @@ -15,10 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "cvs_test_getuserdata\;" - "cvs_test_tstop\;" - ) +set(unit_tests "cvs_test_getuserdata\;" "cvs_test_tstop\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -27,8 +24,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -37,16 +34,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_cvodes - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_cvodes sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/cvodes/gtest/CMakeLists.txt b/test/unit_tests/cvodes/gtest/CMakeLists.txt index c3ccf0b7b4..92739e4f19 100644 --- a/test/unit_tests/cvodes/gtest/CMakeLists.txt +++ b/test/unit_tests/cvodes/gtest/CMakeLists.txt @@ -13,35 +13,29 @@ # include location of public and private header files add_executable(test_cvodes_error_handling test_cvodes_error_handling.cpp) -target_include_directories(test_cvodes_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_cvodes_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) -# We explicitly choose which object libraries to link to and link in the -# cvode objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_cvodes_error_handling - PRIVATE - $ - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the cvode +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_cvodes_error_handling + PRIVATE $ + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the CVODE library since it does not pick -# that up from $. +# Tell CMake that we depend on the CVODE library since it does not pick that up +# from $. add_dependencies(test_cvodes_error_handling sundials_cvodes_obj) -target_link_libraries(test_cvodes_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_cvodes_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_cvodes_error_handling) diff --git a/test/unit_tests/ida/CXX_serial/CMakeLists.txt b/test/unit_tests/ida/CXX_serial/CMakeLists.txt index f97d03edf3..503f525543 100644 --- a/test/unit_tests/ida/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/ida/CXX_serial/CMakeLists.txt @@ -16,16 +16,15 @@ # List of test tuples of the form "name\;args" set(unit_tests - "ida_test_kpr.cpp\;" - "ida_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" - "ida_test_kpr.cpp\;--eta_max_fs 2" - "ida_test_kpr.cpp\;--eta_min 2" - "ida_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" - "ida_test_kpr.cpp\;--eta_min_ef 0.5" - "ida_test_kpr.cpp\;--eta_cf 0.5" - "ida_test_kpr.cpp\;--dcj 0.9" - "ida_test_getjac.cpp\;" -) + "ida_test_kpr.cpp\;" + "ida_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" + "ida_test_kpr.cpp\;--eta_max_fs 2" + "ida_test_kpr.cpp\;--eta_min 2" + "ida_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" + "ida_test_kpr.cpp\;--eta_min_ef 0.5" + "ida_test_kpr.cpp\;--eta_cf 0.5" + "ida_test_kpr.cpp\;--dcj 0.9" + "ida_test_getjac.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -48,16 +47,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # Libraries to link against - target_link_libraries(${test_target} - sundials_ida - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} sundials_ida sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -75,13 +72,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/ida/C_serial/CMakeLists.txt b/test/unit_tests/ida/C_serial/CMakeLists.txt index a6bcb567c2..202a88fe58 100644 --- a/test/unit_tests/ida/C_serial/CMakeLists.txt +++ b/test/unit_tests/ida/C_serial/CMakeLists.txt @@ -15,10 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "ida_test_getuserdata\;" - "ida_test_tstop\;" - ) +set(unit_tests "ida_test_getuserdata\;" "ida_test_tstop\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -27,8 +24,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -37,16 +34,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_ida - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_ida sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/ida/gtest/CMakeLists.txt b/test/unit_tests/ida/gtest/CMakeLists.txt index cb57cde05f..38c5a3e92b 100644 --- a/test/unit_tests/ida/gtest/CMakeLists.txt +++ b/test/unit_tests/ida/gtest/CMakeLists.txt @@ -13,35 +13,29 @@ # include location of public and private header files add_executable(test_ida_error_handling test_ida_error_handling.cpp) -target_include_directories(test_ida_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_ida_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) -# We explicitly choose which object libraries to link to and link in the -# ida objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_ida_error_handling - PRIVATE - $ - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the ida +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_ida_error_handling + PRIVATE $ + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the IDA library since it does not pick -# that up from $. +# Tell CMake that we depend on the IDA library since it does not pick that up +# from $. add_dependencies(test_ida_error_handling sundials_ida_obj) -target_link_libraries(test_ida_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_ida_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_ida_error_handling) diff --git a/test/unit_tests/idas/CXX_serial/CMakeLists.txt b/test/unit_tests/idas/CXX_serial/CMakeLists.txt index 6aa818b999..6f1e59c892 100644 --- a/test/unit_tests/idas/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/idas/CXX_serial/CMakeLists.txt @@ -16,15 +16,14 @@ # List of test tuples of the form "name\;args" set(unit_tests - "idas_test_kpr.cpp\;" - "idas_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" - "idas_test_kpr.cpp\;--eta_min 2" - "idas_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" - "idas_test_kpr.cpp\;--eta_min_ef 0.5" - "idas_test_kpr.cpp\;--eta_cf 0.5" - "idas_test_kpr.cpp\;--dcj 0.9" - "idas_test_getjac.cpp\;" -) + "idas_test_kpr.cpp\;" + "idas_test_kpr.cpp\;--eta_min_fx 1.0 --eta_max_fx 2.0" + "idas_test_kpr.cpp\;--eta_min 2" + "idas_test_kpr.cpp\;--eta_min_fx 1.0 --eta_min 0.5" + "idas_test_kpr.cpp\;--eta_min_ef 0.5" + "idas_test_kpr.cpp\;--eta_cf 0.5" + "idas_test_kpr.cpp\;--dcj 0.9" + "idas_test_getjac.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -47,16 +46,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # Libraries to link against - target_link_libraries(${test_target} - sundials_idas - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} sundials_idas sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -74,13 +71,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/idas/C_serial/CMakeLists.txt b/test/unit_tests/idas/C_serial/CMakeLists.txt index 1cef7d6e72..16f9384ee6 100644 --- a/test/unit_tests/idas/C_serial/CMakeLists.txt +++ b/test/unit_tests/idas/C_serial/CMakeLists.txt @@ -15,10 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "idas_test_getuserdata\;" - "idas_test_tstop\;" - ) +set(unit_tests "idas_test_getuserdata\;" "idas_test_tstop\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -27,8 +24,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -37,16 +34,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_idas - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_idas sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/idas/gtest/CMakeLists.txt b/test/unit_tests/idas/gtest/CMakeLists.txt index ac85d86b9b..8f6c0b292e 100644 --- a/test/unit_tests/idas/gtest/CMakeLists.txt +++ b/test/unit_tests/idas/gtest/CMakeLists.txt @@ -13,36 +13,29 @@ # include location of public and private header files add_executable(test_idas_error_handling test_idas_error_handling.cpp) -target_include_directories(test_idas_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_idas_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) -# We explicitly choose which object libraries to link to and link in the -# ida objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_idas_error_handling - PRIVATE - $ - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the ida +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_idas_error_handling + PRIVATE $ + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the IDA library since it does not pick -# that up from $. +# Tell CMake that we depend on the IDA library since it does not pick that up +# from $. add_dependencies(test_idas_error_handling sundials_idas_obj) -target_link_libraries(test_idas_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_idas_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_idas_error_handling) - diff --git a/test/unit_tests/kinsol/CXX_serial/CMakeLists.txt b/test/unit_tests/kinsol/CXX_serial/CMakeLists.txt index 2ab550476c..f83ef171b7 100644 --- a/test/unit_tests/kinsol/CXX_serial/CMakeLists.txt +++ b/test/unit_tests/kinsol/CXX_serial/CMakeLists.txt @@ -15,9 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "kin_test_getjac.cpp\;" -) +set(unit_tests "kin_test_getjac.cpp\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -40,16 +38,14 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test_target} PROPERTIES FOLDER "unit_tests") # Include location of public and private header files - target_include_directories(${test_target} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test_target} + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # Libraries to link against - target_link_libraries(${test_target} - sundials_kinsol - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test_target} sundials_kinsol sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -67,13 +63,12 @@ foreach(test_tuple ${unit_tests}) endif() # add test to regression tests - sundials_add_test(${test_name} ${test_target} + sundials_add_test( + ${test_name} ${test_target} TEST_ARGS ${test_args} ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} ANSWER_FILE ${test_name}.out - EXAMPLE_TYPE "develop" - ${diff_output} - ) + EXAMPLE_TYPE "develop" ${diff_output}) endforeach() diff --git a/test/unit_tests/kinsol/C_serial/CMakeLists.txt b/test/unit_tests/kinsol/C_serial/CMakeLists.txt index 9715b8e3e6..a3db85d254 100644 --- a/test/unit_tests/kinsol/C_serial/CMakeLists.txt +++ b/test/unit_tests/kinsol/C_serial/CMakeLists.txt @@ -15,9 +15,7 @@ # --------------------------------------------------------------- # List of test tuples of the form "name\;args" -set(unit_tests - "kin_test_getuserdata\;" - ) +set(unit_tests "kin_test_getuserdata\;") # Add the build and install targets for each test foreach(test_tuple ${unit_tests}) @@ -26,8 +24,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -36,16 +34,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_kinsol - sundials_nvecserial - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_kinsol sundials_nvecserial + ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/kinsol/gtest/CMakeLists.txt b/test/unit_tests/kinsol/gtest/CMakeLists.txt index d620c6d05f..5b6d650402 100644 --- a/test/unit_tests/kinsol/gtest/CMakeLists.txt +++ b/test/unit_tests/kinsol/gtest/CMakeLists.txt @@ -13,35 +13,29 @@ # include location of public and private header files add_executable(test_kinsol_error_handling test_kinsol_error_handling.cpp) -target_include_directories(test_kinsol_error_handling - PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src -) +target_include_directories( + test_kinsol_error_handling + PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) -# We explicitly choose which object libraries to link to and link in the -# KINSOL objects so that we have access to private functions w/o changing -# their visibility in the installed libraries. -target_link_libraries(test_kinsol_error_handling - PRIVATE - $ - sundials_sunmemsys_obj - sundials_nvecserial_obj - sundials_sunlinsolband_obj - sundials_sunlinsoldense_obj - sundials_sunnonlinsolnewton_obj - ${EXE_EXTRA_LINK_LIBS} -) +# We explicitly choose which object libraries to link to and link in the KINSOL +# objects so that we have access to private functions w/o changing their +# visibility in the installed libraries. +target_link_libraries( + test_kinsol_error_handling + PRIVATE $ + sundials_sunmemsys_obj + sundials_nvecserial_obj + sundials_sunlinsolband_obj + sundials_sunlinsoldense_obj + sundials_sunnonlinsolnewton_obj + ${EXE_EXTRA_LINK_LIBS}) -# Tell CMake that we depend on the KINSOL library since it does not pick -# that up from $. +# Tell CMake that we depend on the KINSOL library since it does not pick that up +# from $. add_dependencies(test_kinsol_error_handling sundials_kinsol_obj) -target_link_libraries(test_kinsol_error_handling - PRIVATE - GTest::gtest_main - GTest::gmock -) +target_link_libraries(test_kinsol_error_handling PRIVATE GTest::gtest_main + GTest::gmock) gtest_discover_tests(test_kinsol_error_handling) diff --git a/test/unit_tests/profiling/CMakeLists.txt b/test/unit_tests/profiling/CMakeLists.txt index d3023f7f22..1403bbbefc 100644 --- a/test/unit_tests/profiling/CMakeLists.txt +++ b/test/unit_tests/profiling/CMakeLists.txt @@ -22,8 +22,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -32,15 +32,12 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} - sundials_core - ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} sundials_core ${EXE_EXTRA_LINK_LIBS}) endif() diff --git a/test/unit_tests/sundials/CMakeLists.txt b/test/unit_tests/sundials/CMakeLists.txt index d48c707f07..1883aa072b 100644 --- a/test/unit_tests/sundials/CMakeLists.txt +++ b/test/unit_tests/sundials/CMakeLists.txt @@ -13,8 +13,9 @@ if(SUNDIALS_ENABLE_ERROR_CHECKS) if(TARGET GTest::gtest_main AND TARGET GTest::gmock) add_executable(test_sundials_errors test_sundials_errors.cpp) - target_link_libraries(test_sundials_errors - PRIVATE sundials_core sundials_nvecserial GTest::gtest_main GTest::gmock) + target_link_libraries( + test_sundials_errors PRIVATE sundials_core sundials_nvecserial + GTest::gtest_main GTest::gmock) gtest_discover_tests(test_sundials_errors) endif() endif() diff --git a/test/unit_tests/sundials/reductions/CMakeLists.txt b/test/unit_tests/sundials/reductions/CMakeLists.txt index 70ca8a15a0..bee7ed7707 100644 --- a/test/unit_tests/sundials/reductions/CMakeLists.txt +++ b/test/unit_tests/sundials/reductions/CMakeLists.txt @@ -22,8 +22,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -32,10 +32,9 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against target_link_libraries(${test} ${EXE_EXTRA_LINK_LIBS}) diff --git a/test/unit_tests/sunmemory/CMakeLists.txt b/test/unit_tests/sunmemory/CMakeLists.txt index 2a399b5bce..aba5a544d7 100644 --- a/test/unit_tests/sunmemory/CMakeLists.txt +++ b/test/unit_tests/sunmemory/CMakeLists.txt @@ -23,4 +23,3 @@ endif() if(ENABLE_SYCL) add_subdirectory(sycl) endif() - diff --git a/test/unit_tests/sunmemory/cuda/CMakeLists.txt b/test/unit_tests/sunmemory/cuda/CMakeLists.txt index c66b570bf7..f8fc7f3643 100644 --- a/test/unit_tests/sunmemory/cuda/CMakeLists.txt +++ b/test/unit_tests/sunmemory/cuda/CMakeLists.txt @@ -20,8 +20,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -30,13 +30,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemcuda_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemcuda_obj + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -54,4 +54,3 @@ foreach(test_tuple ${unit_tests}) endforeach() message(STATUS "Added SUNMemoryHelper_Cuda units tests") - diff --git a/test/unit_tests/sunmemory/hip/CMakeLists.txt b/test/unit_tests/sunmemory/hip/CMakeLists.txt index 509a02d038..383417561c 100644 --- a/test/unit_tests/sunmemory/hip/CMakeLists.txt +++ b/test/unit_tests/sunmemory/hip/CMakeLists.txt @@ -20,8 +20,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -30,13 +30,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemhip_obj hip::device ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemhip_obj + hip::device ${EXE_EXTRA_LINK_LIBS}) endif() @@ -54,4 +54,3 @@ foreach(test_tuple ${unit_tests}) endforeach() message(STATUS "Added SUNMemoryHelper_Hip units tests") - diff --git a/test/unit_tests/sunmemory/sycl/CMakeLists.txt b/test/unit_tests/sunmemory/sycl/CMakeLists.txt index 744bb95b7a..de3abc84e7 100644 --- a/test/unit_tests/sunmemory/sycl/CMakeLists.txt +++ b/test/unit_tests/sunmemory/sycl/CMakeLists.txt @@ -20,8 +20,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -30,13 +30,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsycl_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsycl_obj + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -54,4 +54,3 @@ foreach(test_tuple ${unit_tests}) endforeach() message(STATUS "Added SUNMemoryHelper_Sycl units tests") - diff --git a/test/unit_tests/sunmemory/sys/CMakeLists.txt b/test/unit_tests/sunmemory/sys/CMakeLists.txt index 8f11528123..3dc597c941 100644 --- a/test/unit_tests/sunmemory/sys/CMakeLists.txt +++ b/test/unit_tests/sunmemory/sys/CMakeLists.txt @@ -20,8 +20,8 @@ foreach(test_tuple ${unit_tests}) list(GET test_tuple 0 test) list(GET test_tuple 1 test_args) - # check if this test has already been added, only need to add - # test source files once for testing with different inputs + # check if this test has already been added, only need to add test source + # files once for testing with different inputs if(NOT TARGET ${test}) # test source files @@ -30,13 +30,13 @@ foreach(test_tuple ${unit_tests}) set_target_properties(${test} PROPERTIES FOLDER "unit_tests") # include location of public and private header files - target_include_directories(${test} PRIVATE - $ - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src) + target_include_directories( + ${test} PRIVATE $ + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) # libraries to link against - target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsys_obj ${EXE_EXTRA_LINK_LIBS}) + target_link_libraries(${test} PRIVATE sundials_core sundials_sunmemsys_obj + ${EXE_EXTRA_LINK_LIBS}) endif() @@ -54,4 +54,3 @@ foreach(test_tuple ${unit_tests}) endforeach() message(STATUS "Added SUNMemoryHelper_Sys units tests") -