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/.git-blame-ignore-revs b/.git-blame-ignore-revs index 51ab03ac92..870b004be9 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -4,3 +4,7 @@ fab1cecb7d91cff53b31730af5d00ff154c3b6ce cc6960349aa92e2bcad9168a6dacff99b21c329c # Apply formatting to Fortran files 23581e8454955283139e551a7bcd1b85d8b7c77b +# Apply formatting to Python files +b578eabccd77b7642b04ddda9d8530f05890d1b4 +# Apply formatting to CMake files +c6b9a02f24a27081c471d63dfc524684a9f5a9e3 diff --git a/.github/workflows/check-clang-format.yml b/.github/workflows/check-format.yml similarity index 63% rename from .github/workflows/check-clang-format.yml rename to .github/workflows/check-format.yml index 2a87a2a35d..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 @@ -15,9 +15,27 @@ jobs: apt update apt install -y git python3-pip + - name: Install black + run: pip install black + + - 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: @@ -26,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/CHANGELOG.md b/CHANGELOG.md index eee9a428a5..3291523216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,23 @@ # SUNDIALS Changelog +## Changes to SUNDIALS in release X.Y.Z + +### Major Features + +### New Features and Enhancements + +### Bug Fixes + +Fixed the loading of ARKStep's default first order explicit method. + +### Deprecation Notices + ## Changes to SUNDIALS in release 7.1.1 ### Bug Fixes -Fixed a [bug](https://github.com/LLNL/sundials/pull/523) in v7.1.0 with the SYCL N_Vector `N_VSpace` function. +Fixed a [bug](https://github.com/LLNL/sundials/pull/523) in v7.1.0 with the SYCL +N_Vector `N_VSpace` function. ## Changes to SUNDIALS in release 7.1.0 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/advection_reaction_3D/scripts/compare_error.py b/benchmarks/advection_reaction_3D/scripts/compare_error.py index 2dc66d23fa..4dd1ff7ee1 100755 --- a/benchmarks/advection_reaction_3D/scripts/compare_error.py +++ b/benchmarks/advection_reaction_3D/scripts/compare_error.py @@ -15,7 +15,8 @@ import glob import sys import matplotlib -matplotlib.use('Agg') + +matplotlib.use("Agg") from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import pandas as pd @@ -25,57 +26,57 @@ # load pickled data def load_data(file): data = np.load(file) - m = data['mesh'] - t = data['t'] - u = data['u'] - v = data['v'] - w = data['w'] + m = data["mesh"] + t = data["t"] + u = data["u"] + v = data["v"] + w = data["w"] - hx = m[0,1] - m[0,0] - hy = m[1,1] - m[1,0] - hz = m[2,1] - m[2,0] + hx = m[0, 1] - m[0, 0] + hy = m[1, 1] - m[1, 0] + hz = m[2, 1] - m[2, 0] - return { 'm': m, 'h': (hx,hy,hz), 't': t, 'u': u, 'v': v, 'w': w } + return {"m": m, "h": (hx, hy, hz), "t": t, "u": u, "v": v, "w": w} # grid function norm def norm_3Dgrid(h, x, q=1): - hx,hy,hz = h + hx, hy, hz = h s = np.shape(x) - return (hx*hy*hz*np.sum(np.abs(x)**q, axis=(1,2,3)))**(1./q) + return (hx * hy * hz * np.sum(np.abs(x) ** q, axis=(1, 2, 3))) ** (1.0 / q) # load data files -np111 = load_data('np-111/output-with-h-8.33e-02.npz') -np211 = load_data('np-211/output-with-h-8.33e-02.npz') -np311 = load_data('np-311/output-with-h-8.33e-02.npz') -np131 = load_data('np-131/output-with-h-8.33e-02.npz') -np113 = load_data('np-113/output-with-h-8.33e-02.npz') -np911 = load_data('np-911/output-with-h-8.33e-02.npz') +np111 = load_data("np-111/output-with-h-8.33e-02.npz") +np211 = load_data("np-211/output-with-h-8.33e-02.npz") +np311 = load_data("np-311/output-with-h-8.33e-02.npz") +np131 = load_data("np-131/output-with-h-8.33e-02.npz") +np113 = load_data("np-113/output-with-h-8.33e-02.npz") +np911 = load_data("np-911/output-with-h-8.33e-02.npz") # np133 = load_data('np-133/output-with-h-8.33e-02.npz') -np313 = load_data('np-313/output-with-h-8.33e-02.npz') -np331 = load_data('np-331/output-with-h-8.33e-02.npz') -np333 = load_data('np-333/output-with-h-8.33e-02.npz') +np313 = load_data("np-313/output-with-h-8.33e-02.npz") +np331 = load_data("np-331/output-with-h-8.33e-02.npz") +np333 = load_data("np-333/output-with-h-8.33e-02.npz") # np666 = load_data('np-666/output-with-h-8.33e-02.npz') -for component in ['u', 'v', 'w']: +for component in ["u", "v", "w"]: # Reference solution ref = np111[component] # Now compute E(h) = ||U(h) - \bar{U}(h)|| using the grid-function norm - E_np211 = norm_3Dgrid(np211['h'], np211[component] - ref) - E_np311 = norm_3Dgrid(np311['h'], np311[component] - ref) - E_np131 = norm_3Dgrid(np131['h'], np131[component] - ref) - E_np113 = norm_3Dgrid(np113['h'], np113[component] - ref) - E_np911 = norm_3Dgrid(np911['h'], np911[component] - ref) + E_np211 = norm_3Dgrid(np211["h"], np211[component] - ref) + E_np311 = norm_3Dgrid(np311["h"], np311[component] - ref) + E_np131 = norm_3Dgrid(np131["h"], np131[component] - ref) + E_np113 = norm_3Dgrid(np113["h"], np113[component] - ref) + E_np911 = norm_3Dgrid(np911["h"], np911[component] - ref) # E_np133 = norm_3Dgrid(np133['h'], np133[component] - ref) - E_np313 = norm_3Dgrid(np313['h'], np313[component] - ref) - E_np331 = norm_3Dgrid(np331['h'], np331[component] - ref) - E_np333 = norm_3Dgrid(np333['h'], np333[component] - ref) + E_np313 = norm_3Dgrid(np313["h"], np313[component] - ref) + E_np331 = norm_3Dgrid(np331["h"], np331[component] - ref) + E_np333 = norm_3Dgrid(np333["h"], np333[component] - ref) # E_np666 = norm_3Dgrid(np666['h'], np666[component] - ref) # Plot error across time - X, Y = np.meshgrid(np111['m'][0,:], np111['t']) + X, Y = np.meshgrid(np111["m"][0, :], np111["t"]) # fig = plt.figure() # ax = plt.subplot(311, projection='3d') # ax.plot_surface(X, Y, np.abs(np911[component][:,:,0,0] - ref[:,:,0,0])) @@ -83,17 +84,17 @@ def norm_3Dgrid(h, x, q=1): # ax.plot_surface(X, Y, np.abs(np911[component][:,0,:,0] - ref[:,0,:,0])) # ax = plt.subplot(313, projection='3d') # ax.plot_surface(X, Y, np.abs(np911[component][:,0,0,:] - ref[:,0,0,:])) - plt.plot(np111['t'], E_np211) - plt.plot(np111['t'], E_np131) - plt.plot(np111['t'], E_np113) - plt.plot(np111['t'], E_np911) + plt.plot(np111["t"], E_np211) + plt.plot(np111["t"], E_np131) + plt.plot(np111["t"], E_np113) + plt.plot(np111["t"], E_np911) # plt.plot(np111['t'], E_np133) - plt.plot(np111['t'], E_np313) - plt.plot(np111['t'], E_np331) - plt.plot(np111['t'], E_np333) + plt.plot(np111["t"], E_np313) + plt.plot(np111["t"], E_np331) + plt.plot(np111["t"], E_np333) # plt.plot(np111['t'], E_np666) # plt.legend(['2 1 1', '3 1 1', '1 3 3', '3 1 3', '3 3 1', '3 3 3', '6 6 6']) # plt.legend(['3 1 1', '1 3 1', '1 1 3', '9 1 1', '1 3 3', '3 1 3', '3 3 1']) - plt.ylabel('||E(hx,hy,hz)||') - plt.xlabel('time') - plt.savefig('compare-error-plot-%s.png' % component) + plt.ylabel("||E(hx,hy,hz)||") + plt.xlabel("time") + plt.savefig("compare-error-plot-%s.png" % component) diff --git a/benchmarks/advection_reaction_3D/scripts/compute_error.py b/benchmarks/advection_reaction_3D/scripts/compute_error.py index 2c01826b29..85f151ed59 100755 --- a/benchmarks/advection_reaction_3D/scripts/compute_error.py +++ b/benchmarks/advection_reaction_3D/scripts/compute_error.py @@ -15,7 +15,8 @@ import glob import sys import matplotlib -matplotlib.use('Agg') + +matplotlib.use("Agg") import matplotlib.pyplot as plt import pandas as pd import numpy as np @@ -24,65 +25,67 @@ # load pickled data def load_data(file): data = np.load(file) - m = data['mesh'] - t = data['t'] - u = data['u'] - v = data['v'] - w = data['w'] + m = data["mesh"] + t = data["t"] + u = data["u"] + v = data["v"] + w = data["w"] - hx = m[0,1] - m[0,0] - hy = m[1,1] - m[1,0] - hz = m[2,1] - m[2,0] + hx = m[0, 1] - m[0, 0] + hy = m[1, 1] - m[1, 0] + hz = m[2, 1] - m[2, 0] - return { 'm': m, 'h': (hx,hy,hz), 't': t, 'u': u, 'v': v, 'w': w } + return {"m": m, "h": (hx, hy, hz), "t": t, "u": u, "v": v, "w": w} # grid function norm def norm_3Dgrid(h, x, q=1): - hx,hy,hz = h - return (hx*hy*hz*np.sum(np.abs(x)**q, axis=(1,2,3)))**(1/q) + hx, hy, hz = h + return (hx * hy * hz * np.sum(np.abs(x) ** q, axis=(1, 2, 3))) ** (1 / q) # computer order of accuracy p def calc_order(h1, Eh1, h2, Eh2): - return np.log( Eh1/Eh2 ) / np.log( np.prod(h1)/np.prod(h2) ) + return np.log(Eh1 / Eh2) / np.log(np.prod(h1) / np.prod(h2)) # load data files -h_over_8 = load_data('middle-h/output-with-h-1.04e-02.npz') -h_over_4 = load_data('large-h/output-with-h-2.08e-02.npz') +h_over_8 = load_data("middle-h/output-with-h-1.04e-02.npz") +h_over_4 = load_data("large-h/output-with-h-2.08e-02.npz") # h_over_2 = load_data('larger-h/output-with-h-4.16e-02.npz') -h_over_1 = load_data('largest-h/output-with-h-8.33e-02.npz') +h_over_1 = load_data("largest-h/output-with-h-8.33e-02.npz") -for component in ['u', 'v', 'w']: +for component in ["u", "v", "w"]: # Restrict reference to the coarsest grid - ref = h_over_8[component][:,::8,::8,::8] + ref = h_over_8[component][:, ::8, ::8, ::8] # Now compute E(h) = ||U(h) - \bar{U}(h)|| using the grid-function norm - Eh_over_4 = norm_3Dgrid(h_over_4['h'], h_over_4[component][:,::4,::4,::4] - ref) - Eh_over_1 = norm_3Dgrid(h_over_1['h'], h_over_1[component][:,:,:,:] - ref) + Eh_over_4 = norm_3Dgrid(h_over_4["h"], h_over_4[component][:, ::4, ::4, ::4] - ref) + Eh_over_1 = norm_3Dgrid(h_over_1["h"], h_over_1[component][:, :, :, :] - ref) # Compute order p as in O(h^p) - p = calc_order(h_over_1['h'], Eh_over_1, h_over_4['h'], Eh_over_4) - print('min p for %s component: %.4f' % (component, np.min(p))) + p = calc_order(h_over_1["h"], Eh_over_1, h_over_4["h"], Eh_over_4) + print("min p for %s component: %.4f" % (component, np.min(p))) # Plot error across time plt.figure() - plt.plot(h_over_8['t'], Eh_over_4, 'r-') - plt.plot(h_over_8['t'], Eh_over_1, 'b-') - plt.ylabel('||E(hx,hy,hz)||') - plt.xlabel('time') - plt.savefig('error-in-time-plot-%s.png' % component) + plt.plot(h_over_8["t"], Eh_over_4, "r-") + plt.plot(h_over_8["t"], Eh_over_1, "b-") + plt.ylabel("||E(hx,hy,hz)||") + plt.xlabel("time") + plt.savefig("error-in-time-plot-%s.png" % component) # Plot error norm with respect to h plt.figure() - x = np.array([np.prod(h_over_4['h']), np.prod(h_over_1['h'])]) - plt.plot(x, x, 'k-') - plt.plot(x, x**2, 'k-') - plt.plot(x, [np.linalg.norm(Eh_over_4, np.Inf), np.linalg.norm(Eh_over_1, np.Inf)], 'r-') - plt.legend(['1st order', '2nd order', 'actual']) - plt.ylabel('|| ||E(hx,hy,hz)|| ||_inf') - plt.xlabel('hx * hy * hz') - plt.yscale('log') - plt.xscale('log') - plt.savefig('error-plot-%s.png' % component) + x = np.array([np.prod(h_over_4["h"]), np.prod(h_over_1["h"])]) + plt.plot(x, x, "k-") + plt.plot(x, x**2, "k-") + plt.plot( + x, [np.linalg.norm(Eh_over_4, np.Inf), np.linalg.norm(Eh_over_1, np.Inf)], "r-" + ) + plt.legend(["1st order", "2nd order", "actual"]) + plt.ylabel("|| ||E(hx,hy,hz)|| ||_inf") + plt.xlabel("hx * hy * hz") + plt.yscale("log") + plt.xscale("log") + plt.savefig("error-plot-%s.png" % component) diff --git a/benchmarks/advection_reaction_3D/scripts/make_plots.py b/benchmarks/advection_reaction_3D/scripts/make_plots.py index 69a0168d79..a4dfa87840 100755 --- a/benchmarks/advection_reaction_3D/scripts/make_plots.py +++ b/benchmarks/advection_reaction_3D/scripts/make_plots.py @@ -22,218 +22,265 @@ # ------------------------------------------------------------------------------ + # utility functions def parallel_coords(rank): - if (rank == 0): + if rank == 0: return [0, 0, 0] - if (rank == 1): + if rank == 1: return [0, 0, 1] - if (rank == 2): + if rank == 2: return [0, 1, 0] - if (rank == 3): + if rank == 3: return [0, 1, 1] - if (rank == 4): + if rank == 4: return [1, 0, 0] - if (rank == 5): + if rank == 5: return [1, 0, 1] - if (rank == 6): + if rank == 6: return [1, 1, 0] - if (rank == 7): + if rank == 7: return [1, 1, 1] -def xslice(u,it,ix): - return u[it,ix,:,:] -def yslice(u,it,iy): - return u[it,:,iy,:] +def xslice(u, it, ix): + return u[it, ix, :, :] + + +def yslice(u, it, iy): + return u[it, :, iy, :] + + +def zslice(u, it, iz): + return u[it, :, :, iz] -def zslice(u,it,iz): - return u[it,:,:,iz] -def xproj(u,it): - return np.average(u[it,:,:,:], axis=0) +def xproj(u, it): + return np.average(u[it, :, :, :], axis=0) -def yproj(u,it): - return np.average(u[it,:,:,:], axis=1) -def zproj(u,it): - return np.average(u[it,:,:,:], axis=2) +def yproj(u, it): + return np.average(u[it, :, :, :], axis=1) -def myplot(axis, X, Y, Z, xlabel='none', ylabel='none'): + +def zproj(u, it): + return np.average(u[it, :, :, :], axis=2) + + +def myplot(axis, X, Y, Z, xlabel="none", ylabel="none"): frame = axis.contourf(X, Y, Z) plt.colorbar(frame, ax=axis) - if (xlabel != 'none'): + if xlabel != "none": axis.set_xlabel(xlabel) - if (ylabel != 'none'): + if ylabel != "none": axis.set_ylabel(ylabel) - # read time mesh times = np.loadtxt("t.000000.txt") nt = times.size # read spatial mesh mesh = np.loadtxt("mesh.txt", dtype=float) -x = mesh[0,:] -y = mesh[1,:] -z = mesh[2,:] +x = mesh[0, :] +y = mesh[1, :] +z = mesh[2, :] nx = x.size ny = y.size nz = z.size # ensure that the run used exactly 1 or 8 MPI ranks for i in range(9): - if (exists("u.00000" + str(i) + ".txt" ) and - not exists("u.00000" + str(i+1) + ".txt" )): - nprocs = i+1 -if ((nprocs != 1) and (nprocs != 8)): + if exists("u.00000" + str(i) + ".txt") and not exists( + "u.00000" + str(i + 1) + ".txt" + ): + nprocs = i + 1 +if (nprocs != 1) and (nprocs != 8): print("make_plots.py error: run must have used either 1 or 8 MPI ranks") exit() # load data for run -if (nprocs == 1): - u = np.zeros((nt,nx,ny,nz), dtype=float) - v = np.zeros((nt,nx,ny,nz), dtype=float) - w = np.zeros((nt,nx,ny,nz), dtype=float) +if nprocs == 1: + u = np.zeros((nt, nx, ny, nz), dtype=float) + v = np.zeros((nt, nx, ny, nz), dtype=float) + w = np.zeros((nt, nx, ny, nz), dtype=float) udata = np.loadtxt("u.000000.txt") vdata = np.loadtxt("v.000000.txt") wdata = np.loadtxt("w.000000.txt") - if (nt != udata.shape[0]): + if nt != udata.shape[0]: print("make_plots.py error: mesh and data have incompatible sizes") exit() - if (nx*ny*nz != udata.shape[1]): + if nx * ny * nz != udata.shape[1]: print("make_plots.py error: mesh and data have incompatible sizes") exit() for it in range(nt): - u[it,:,:,:] = np.reshape(udata[it,:], (nx,ny,nz), order='C') - v[it,:,:,:] = np.reshape(vdata[it,:], (nx,ny,nz), order='C') - w[it,:,:,:] = np.reshape(wdata[it,:], (nx,ny,nz), order='C') + u[it, :, :, :] = np.reshape(udata[it, :], (nx, ny, nz), order="C") + v[it, :, :, :] = np.reshape(vdata[it, :], (nx, ny, nz), order="C") + w[it, :, :, :] = np.reshape(wdata[it, :], (nx, ny, nz), order="C") else: - u = np.zeros((nt,nx,ny,nz), dtype=float) - v = np.zeros((nt,nx,ny,nz), dtype=float) - w = np.zeros((nt,nx,ny,nz), dtype=float) - nxl = nx//2 - nyl = ny//2 - nzl = nz//2 + u = np.zeros((nt, nx, ny, nz), dtype=float) + v = np.zeros((nt, nx, ny, nz), dtype=float) + w = np.zeros((nt, nx, ny, nz), dtype=float) + nxl = nx // 2 + nyl = ny // 2 + nzl = nz // 2 for ip in range(8): udata = np.loadtxt("u.00000" + str(ip) + ".txt") vdata = np.loadtxt("v.00000" + str(ip) + ".txt") wdata = np.loadtxt("w.00000" + str(ip) + ".txt") - if (nt != udata.shape[0]): + if nt != udata.shape[0]: print("make_plots.py error: mesh and data have incompatible sizes") exit() - if (nxl*nyl*nzl != udata.shape[1]): + if nxl * nyl * nzl != udata.shape[1]: print("make_plots.py error: mesh and data have incompatible sizes") exit() coords = parallel_coords(ip) - ilo = coords[0]*nxl - ihi = (coords[0]+1)*nxl - jlo = coords[1]*nyl - jhi = (coords[1]+1)*nyl - klo = coords[2]*nzl - khi = (coords[2]+1)*nzl + ilo = coords[0] * nxl + ihi = (coords[0] + 1) * nxl + jlo = coords[1] * nyl + jhi = (coords[1] + 1) * nyl + klo = coords[2] * nzl + khi = (coords[2] + 1) * nzl for it in range(nt): - u[it,ilo:ihi,jlo:jhi,klo:khi] = np.reshape(udata[it,:], (nxl,nyl,nzl), order='C') - v[it,ilo:ihi,jlo:jhi,klo:khi] = np.reshape(vdata[it,:], (nxl,nyl,nzl), order='C') - w[it,ilo:ihi,jlo:jhi,klo:khi] = np.reshape(wdata[it,:], (nxl,nyl,nzl), order='C') + u[it, ilo:ihi, jlo:jhi, klo:khi] = np.reshape( + udata[it, :], (nxl, nyl, nzl), order="C" + ) + v[it, ilo:ihi, jlo:jhi, klo:khi] = np.reshape( + vdata[it, :], (nxl, nyl, nzl), order="C" + ) + w[it, ilo:ihi, jlo:jhi, klo:khi] = np.reshape( + wdata[it, :], (nxl, nyl, nzl), order="C" + ) # set meshgrid objects -xy0,xy1 = np.meshgrid(x, y) -yz0,yz1 = np.meshgrid(y, z) -xz0,xz1 = np.meshgrid(x, z) +xy0, xy1 = np.meshgrid(x, y) +yz0, yz1 = np.meshgrid(y, z) +xz0, xz1 = np.meshgrid(x, z) # generate plots sliceidx = 25 tslice = [0, 5, 10] -figsize = (9,7) +figsize = (9, 7) # xy slices at various times plt.figure(1) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, xy0, xy1, zslice(u,tslice[0],sliceidx), ylabel = 'u') -myplot(ax2, xy0, xy1, zslice(u,tslice[1],sliceidx)) -myplot(ax3, xy0, xy1, zslice(u,tslice[2],sliceidx)) -myplot(ax4, xy0, xy1, zslice(v,tslice[0],sliceidx), ylabel = 'v') -myplot(ax5, xy0, xy1, zslice(v,tslice[1],sliceidx)) -myplot(ax6, xy0, xy1, zslice(v,tslice[2],sliceidx)) -myplot(ax7, xy0, xy1, zslice(w,tslice[0],sliceidx), ylabel = 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, xy0, xy1, zslice(w,tslice[1],sliceidx), xlabel = 't = ' + str(times[1])) -myplot(ax9, xy0, xy1, zslice(w,tslice[2],sliceidx), xlabel = 't = ' + str(times[2])) -plt.savefig('xy-slices.png') +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, xy0, xy1, zslice(u, tslice[0], sliceidx), ylabel="u") +myplot(ax2, xy0, xy1, zslice(u, tslice[1], sliceidx)) +myplot(ax3, xy0, xy1, zslice(u, tslice[2], sliceidx)) +myplot(ax4, xy0, xy1, zslice(v, tslice[0], sliceidx), ylabel="v") +myplot(ax5, xy0, xy1, zslice(v, tslice[1], sliceidx)) +myplot(ax6, xy0, xy1, zslice(v, tslice[2], sliceidx)) +myplot( + ax7, + xy0, + xy1, + zslice(w, tslice[0], sliceidx), + ylabel="w", + xlabel="t = " + str(times[0]), +) +myplot(ax8, xy0, xy1, zslice(w, tslice[1], sliceidx), xlabel="t = " + str(times[1])) +myplot(ax9, xy0, xy1, zslice(w, tslice[2], sliceidx), xlabel="t = " + str(times[2])) +plt.savefig("xy-slices.png") # yz slices at various times plt.figure(2) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, yz0, yz1, xslice(u,tslice[0],sliceidx), ylabel = 'u') -myplot(ax2, yz0, yz1, xslice(u,tslice[1],sliceidx)) -myplot(ax3, yz0, yz1, xslice(u,tslice[2],sliceidx)) -myplot(ax4, yz0, yz1, xslice(v,tslice[0],sliceidx), ylabel = 'v') -myplot(ax5, yz0, yz1, xslice(v,tslice[1],sliceidx)) -myplot(ax6, yz0, yz1, xslice(v,tslice[2],sliceidx)) -myplot(ax7, yz0, yz1, xslice(w,tslice[0],sliceidx), ylabel = 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, yz0, yz1, xslice(w,tslice[1],sliceidx), xlabel = 't = ' + str(times[1])) -myplot(ax9, yz0, yz1, xslice(w,tslice[2],sliceidx), xlabel = 't = ' + str(times[2])) -plt.savefig('yz-slices.png') +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, yz0, yz1, xslice(u, tslice[0], sliceidx), ylabel="u") +myplot(ax2, yz0, yz1, xslice(u, tslice[1], sliceidx)) +myplot(ax3, yz0, yz1, xslice(u, tslice[2], sliceidx)) +myplot(ax4, yz0, yz1, xslice(v, tslice[0], sliceidx), ylabel="v") +myplot(ax5, yz0, yz1, xslice(v, tslice[1], sliceidx)) +myplot(ax6, yz0, yz1, xslice(v, tslice[2], sliceidx)) +myplot( + ax7, + yz0, + yz1, + xslice(w, tslice[0], sliceidx), + ylabel="w", + xlabel="t = " + str(times[0]), +) +myplot(ax8, yz0, yz1, xslice(w, tslice[1], sliceidx), xlabel="t = " + str(times[1])) +myplot(ax9, yz0, yz1, xslice(w, tslice[2], sliceidx), xlabel="t = " + str(times[2])) +plt.savefig("yz-slices.png") # xz slices at various times plt.figure(3) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, xz0, xz1, yslice(u,tslice[0],sliceidx), ylabel ='u') -myplot(ax2, xz0, xz1, yslice(u,tslice[1],sliceidx)) -myplot(ax3, xz0, xz1, yslice(u,tslice[2],sliceidx)) -myplot(ax4, xz0, xz1, yslice(v,tslice[0],sliceidx), ylabel = 'v') -myplot(ax5, xz0, xz1, yslice(v,tslice[1],sliceidx)) -myplot(ax6, xz0, xz1, yslice(v,tslice[2],sliceidx)) -myplot(ax7, xz0, xz1, yslice(w,tslice[0],sliceidx), ylabel= 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, xz0, xz1, yslice(w,tslice[1],sliceidx), xlabel ='t = ' + str(times[1])) -myplot(ax9, xz0, xz1, yslice(w,tslice[2],sliceidx), xlabel = 't = ' + str(times[2])) -plt.savefig('xz-slices.png') +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, xz0, xz1, yslice(u, tslice[0], sliceidx), ylabel="u") +myplot(ax2, xz0, xz1, yslice(u, tslice[1], sliceidx)) +myplot(ax3, xz0, xz1, yslice(u, tslice[2], sliceidx)) +myplot(ax4, xz0, xz1, yslice(v, tslice[0], sliceidx), ylabel="v") +myplot(ax5, xz0, xz1, yslice(v, tslice[1], sliceidx)) +myplot(ax6, xz0, xz1, yslice(v, tslice[2], sliceidx)) +myplot( + ax7, + xz0, + xz1, + yslice(w, tslice[0], sliceidx), + ylabel="w", + xlabel="t = " + str(times[0]), +) +myplot(ax8, xz0, xz1, yslice(w, tslice[1], sliceidx), xlabel="t = " + str(times[1])) +myplot(ax9, xz0, xz1, yslice(w, tslice[2], sliceidx), xlabel="t = " + str(times[2])) +plt.savefig("xz-slices.png") # xy projection at various times plt.figure(4) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, xy0, xy1, zproj(u,tslice[0]), ylabel = 'u') -myplot(ax2, xy0, xy1, zproj(u,tslice[1])) -myplot(ax3, xy0, xy1, zproj(u,tslice[2])) -myplot(ax4, xy0, xy1, zproj(v,tslice[0]), ylabel = 'v') -myplot(ax5, xy0, xy1, zproj(v,tslice[1])) -myplot(ax6, xy0, xy1, zproj(v,tslice[2])) -myplot(ax7, xy0, xy1, zproj(w,tslice[0]), ylabel = 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, xy0, xy1, zproj(w,tslice[1]), xlabel = 't = ' + str(times[1])) -myplot(ax9, xy0, xy1, zproj(w,tslice[2]), xlabel = 't = ' + str(times[2])) -plt.savefig('xy-projections.png') +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, xy0, xy1, zproj(u, tslice[0]), ylabel="u") +myplot(ax2, xy0, xy1, zproj(u, tslice[1])) +myplot(ax3, xy0, xy1, zproj(u, tslice[2])) +myplot(ax4, xy0, xy1, zproj(v, tslice[0]), ylabel="v") +myplot(ax5, xy0, xy1, zproj(v, tslice[1])) +myplot(ax6, xy0, xy1, zproj(v, tslice[2])) +myplot(ax7, xy0, xy1, zproj(w, tslice[0]), ylabel="w", xlabel="t = " + str(times[0])) +myplot(ax8, xy0, xy1, zproj(w, tslice[1]), xlabel="t = " + str(times[1])) +myplot(ax9, xy0, xy1, zproj(w, tslice[2]), xlabel="t = " + str(times[2])) +plt.savefig("xy-projections.png") # yz projection at various times fig = plt.figure(5) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, yz0, yz1, xproj(u,tslice[0]), ylabel = 'u') -myplot(ax2, yz0, yz1, xproj(u,tslice[1])) -myplot(ax3, yz0, yz1, xproj(u,tslice[2])) -myplot(ax4, yz0, yz1, xproj(v,tslice[0]), ylabel = 'v') -myplot(ax5, yz0, yz1, xproj(v,tslice[1])) -myplot(ax6, yz0, yz1, xproj(v,tslice[2])) -myplot(ax7, yz0, yz1, xproj(w,tslice[0]), ylabel = 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, yz0, yz1, xproj(w,tslice[1]), xlabel = 't = ' + str(times[1])) -myplot(ax9, yz0, yz1, xproj(w,tslice[2]), xlabel = 't = ' + str(times[2])) -plt.savefig('yz-projections.png') +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, yz0, yz1, xproj(u, tslice[0]), ylabel="u") +myplot(ax2, yz0, yz1, xproj(u, tslice[1])) +myplot(ax3, yz0, yz1, xproj(u, tslice[2])) +myplot(ax4, yz0, yz1, xproj(v, tslice[0]), ylabel="v") +myplot(ax5, yz0, yz1, xproj(v, tslice[1])) +myplot(ax6, yz0, yz1, xproj(v, tslice[2])) +myplot(ax7, yz0, yz1, xproj(w, tslice[0]), ylabel="w", xlabel="t = " + str(times[0])) +myplot(ax8, yz0, yz1, xproj(w, tslice[1]), xlabel="t = " + str(times[1])) +myplot(ax9, yz0, yz1, xproj(w, tslice[2]), xlabel="t = " + str(times[2])) +plt.savefig("yz-projections.png") # xz projection at various times fig = plt.figure(6) -fig, ((ax1,ax2,ax3), (ax4,ax5,ax6), (ax7,ax8,ax9)) = plt.subplots(3, 3, sharex=True, sharey=True, figsize=figsize) -myplot(ax1, xz0, xz1, yproj(u,tslice[0]), ylabel = 'u') -myplot(ax2, xz0, xz1, yproj(u,tslice[1])) -myplot(ax3, xz0, xz1, yproj(u,tslice[2])) -myplot(ax4, xz0, xz1, yproj(v,tslice[0]), ylabel = 'v') -myplot(ax5, xz0, xz1, yproj(v,tslice[1])) -myplot(ax6, xz0, xz1, yproj(v,tslice[2])) -myplot(ax7, xz0, xz1, yproj(w,tslice[0]), ylabel = 'w', xlabel = 't = ' + str(times[0])) -myplot(ax8, xz0, xz1, yproj(w,tslice[1]), xlabel = 't = ' + str(times[1])) -myplot(ax9, xz0, xz1, yproj(w,tslice[2]), xlabel = 't = ' + str(times[2])) -plt.savefig('xz-projections.png') - -#plt.show() +fig, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots( + 3, 3, sharex=True, sharey=True, figsize=figsize +) +myplot(ax1, xz0, xz1, yproj(u, tslice[0]), ylabel="u") +myplot(ax2, xz0, xz1, yproj(u, tslice[1])) +myplot(ax3, xz0, xz1, yproj(u, tslice[2])) +myplot(ax4, xz0, xz1, yproj(v, tslice[0]), ylabel="v") +myplot(ax5, xz0, xz1, yproj(v, tslice[1])) +myplot(ax6, xz0, xz1, yproj(v, tslice[2])) +myplot(ax7, xz0, xz1, yproj(w, tslice[0]), ylabel="w", xlabel="t = " + str(times[0])) +myplot(ax8, xz0, xz1, yproj(w, tslice[1]), xlabel="t = " + str(times[1])) +myplot(ax9, xz0, xz1, yproj(w, tslice[2]), xlabel="t = " + str(times[2])) +plt.savefig("xz-projections.png") + +# plt.show() plt.close() ##### end of script ##### diff --git a/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py b/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py index 407c34921a..a51fade40f 100755 --- a/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py +++ b/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py @@ -19,39 +19,66 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('mesh.txt', dtype=np.double) +mesh = np.loadtxt("mesh.txt", dtype=np.double) # X,Y,Z = np.meshgrid(mesh[0,:], mesh[1,:], mesh[2,:]) # calculate h -hx = mesh[0,1] - mesh[0,0] -hy = mesh[1,1] - mesh[1,0] -hz = mesh[2,1] - mesh[2,0] -nx = len(mesh[0,:]) -ny = len(mesh[1,:]) -nz = len(mesh[2,:]) +hx = mesh[0, 1] - mesh[0, 0] +hy = mesh[1, 1] - mesh[1, 0] +hz = mesh[2, 1] - mesh[2, 0] +nx = len(mesh[0, :]) +ny = len(mesh[1, :]) +nz = len(mesh[2, :]) print("nx, ny, nz = %d, %d, %d" % (nx, ny, nz)) print("hx, hy, hz = %g, %g, %g" % (hx, hy, hz)) # load output time file -times = np.loadtxt('t.000000.txt', dtype=np.double) +times = np.loadtxt("t.000000.txt", dtype=np.double) # load solution data files -ufiles = glob.glob('u.' + ('[0-9]'*6) + '.txt'); ufiles.sort() -vfiles = glob.glob('v.' + ('[0-9]'*6) + '.txt'); vfiles.sort() -wfiles = glob.glob('w.' + ('[0-9]'*6) + '.txt'); wfiles.sort() +ufiles = glob.glob("u." + ("[0-9]" * 6) + ".txt") +ufiles.sort() +vfiles = glob.glob("v." + ("[0-9]" * 6) + ".txt") +vfiles.sort() +wfiles = glob.glob("w." + ("[0-9]" * 6) + ".txt") +wfiles.sort() udata = [] vdata = [] wdata = [] sys.stdout.write("reading 1/%d...\r" % len(ufiles)) sys.stdout.flush() -for idx in range(0,len(ufiles)): - sys.stdout.write("reading %d/%d...\r" % (idx+1,len(ufiles))) +for idx in range(0, len(ufiles)): + sys.stdout.write("reading %d/%d...\r" % (idx + 1, len(ufiles))) sys.stdout.flush() - udata.append(pd.read_csv(ufiles[idx], header=None, delimiter=' ', skipinitialspace=True, dtype=np.double)) - vdata.append(pd.read_csv(vfiles[idx], header=None, delimiter=' ', skipinitialspace=True, dtype=np.double)) - wdata.append(pd.read_csv(wfiles[idx], header=None, delimiter=' ', skipinitialspace=True, dtype=np.double)) + udata.append( + pd.read_csv( + ufiles[idx], + header=None, + delimiter=" ", + skipinitialspace=True, + dtype=np.double, + ) + ) + vdata.append( + pd.read_csv( + vfiles[idx], + header=None, + delimiter=" ", + skipinitialspace=True, + dtype=np.double, + ) + ) + wdata.append( + pd.read_csv( + wfiles[idx], + header=None, + delimiter=" ", + skipinitialspace=True, + dtype=np.double, + ) + ) sys.stdout.write("\n") sys.stdout.flush() @@ -69,5 +96,6 @@ # save data to pickle print("saving...") -np.savez_compressed('output-with-h-%.2e.npz' % hx, t=times, u=udata, v=vdata, w=wdata, mesh=mesh) - +np.savez_compressed( + "output-with-h-%.2e.npz" % hx, t=times, u=udata, v=vdata, w=wdata, mesh=mesh +) 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/plot_nvector_performance_results.py b/benchmarks/nvector/plot_nvector_performance_results.py index 02c45665e6..55bb5ae32e 100755 --- a/benchmarks/nvector/plot_nvector_performance_results.py +++ b/benchmarks/nvector/plot_nvector_performance_results.py @@ -20,6 +20,7 @@ # indicates if timing was enabled. # ----------------------------------------------------------------------------- + def main(): import argparse @@ -35,42 +36,60 @@ def main(): import matplotlib.ticker as mtick parser = argparse.ArgumentParser( - description='Plot data from NVector performance tests') - - parser.add_argument('op', type=str, - help='Which NVector operation to plot') - - parser.add_argument('datadir', type=str, - help='Directory where test output files are located') - - parser.add_argument('--timevelem', dest='timevelem', action='store_true', - help='Turn on plots for time vs number of elements') - - parser.add_argument('--noheatmap', dest='heatmap', action='store_false', - help='Turn off heatmap plots') - - parser.add_argument('--loglog', dest='loglog', action='store_true', - help='Generate loglog plots for time vs number of elements') - - parser.add_argument('--show', dest='show', action='store_true', - help='Display plots rather than saving to file') - - parser.add_argument('--debug', dest='debug', action='store_true', - help='Turn on debugging output') + description="Plot data from NVector performance tests" + ) + + parser.add_argument("op", type=str, help="Which NVector operation to plot") + + parser.add_argument( + "datadir", type=str, help="Directory where test output files are located" + ) + + parser.add_argument( + "--timevelem", + dest="timevelem", + action="store_true", + help="Turn on plots for time vs number of elements", + ) + + parser.add_argument( + "--noheatmap", + dest="heatmap", + action="store_false", + help="Turn off heatmap plots", + ) + + parser.add_argument( + "--loglog", + dest="loglog", + action="store_true", + help="Generate loglog plots for time vs number of elements", + ) + + parser.add_argument( + "--show", + dest="show", + action="store_true", + help="Display plots rather than saving to file", + ) + + parser.add_argument( + "--debug", dest="debug", action="store_true", help="Turn on debugging output" + ) # parse command line args args = parser.parse_args() - if (args.debug): + if args.debug: print(args) # check for test data directory - if (not os.path.isdir(args.datadir)): - print("ERROR:",args.datadir,"does not exist") + if not os.path.isdir(args.datadir): + print("ERROR:", args.datadir, "does not exist") sys.exit() # sort output files - output = sorted(glob.glob(args.datadir+'/output*.txt')) + output = sorted(glob.glob(args.datadir + "/output*.txt")) # if (args.debug): # print("output files") @@ -80,8 +99,8 @@ def main(): # figure out vector sizes, number of vectors, and number of sums nelem = [] - nvec = [] - nsum = [] + nvec = [] + nsum = [] ntest = [] # parse file names to get input parameters @@ -95,32 +114,32 @@ def main(): ns = int(split_fout[3]) nt = int(split_fout[4]) - if (not ne in nelem): + if not ne in nelem: nelem.append(ne) - if (not nv in nvec): + if not nv in nvec: nvec.append(nv) - if (not ns in nsum): + if not ns in nsum: nsum.append(ns) - if (not nt in ntest): + if not nt in ntest: ntest.append(nt) - if (len(ntest) != 1): + if len(ntest) != 1: print("Warning: Unequal numbers of tests") - if (args.debug): - print("nelem:",nelem, len(nelem)) - print("nvec: ",nvec, len(nvec)) - print("nsum: ",nsum, len(nsum)) - print("ntest:",ntest, len(ntest)) + if args.debug: + print("nelem:", nelem, len(nelem)) + print("nvec: ", nvec, len(nvec)) + print("nsum: ", nsum, len(nsum)) + print("ntest:", ntest, len(ntest)) # allocate numpy arrays for timing data - avg_fused = np.zeros([len(nvec), len(nelem)]) + avg_fused = np.zeros([len(nvec), len(nelem)]) sdev_fused = np.zeros([len(nvec), len(nelem)]) - avg_unfused = np.zeros([len(nvec), len(nelem)]) + avg_unfused = np.zeros([len(nvec), len(nelem)]) sdev_unfused = np.zeros([len(nvec), len(nelem)]) avg_ratio = np.zeros([len(nvec), len(nelem)]) @@ -131,8 +150,8 @@ def main(): # read output files for f in output: - if (args.debug): - print("Reading:",f) + if args.debug: + print("Reading:", f) # get test inputs from file name split_fout = f.split("/")[-1] @@ -149,15 +168,15 @@ def main(): split_line = shlex.split(line) # skip blank lines - if (not split_line): + if not split_line: continue # tests finished, stop reading file - if (split_line[0] == "Finished"): + if split_line[0] == "Finished": break # check if the operation is the one we want and get data - if (args.op == split_line[0]): + if args.op == split_line[0]: i = nvec.index(nv) j = nelem.index(ne) @@ -165,15 +184,15 @@ def main(): # NVEC[i][j] = nv # NELM[i][j] = ne - avg_fused[i][j] = float(split_line[1]) + avg_fused[i][j] = float(split_line[1]) sdev_fused[i][j] = float(split_line[2]) - avg_unfused[i][j] = float(split_line[5]) + avg_unfused[i][j] = float(split_line[5]) sdev_unfused[i][j] = float(split_line[6]) avg_ratio[i][j] = avg_fused[i][j] / avg_unfused[i][j] - if (args.debug): + if args.debug: print(avg_fused) print(avg_unfused) print(avg_ratio) @@ -185,35 +204,37 @@ def main(): # -------------------------------------------------------------------------- # allocate arrays for the upper and lower bounds of the confidence interval - lower_fused = np.zeros([len(nvec), len(nelem)]) - upper_fused = np.zeros([len(nvec), len(nelem)]) + lower_fused = np.zeros([len(nvec), len(nelem)]) + upper_fused = np.zeros([len(nvec), len(nelem)]) lower_unfused = np.zeros([len(nvec), len(nelem)]) upper_unfused = np.zeros([len(nvec), len(nelem)]) # critical value for 99% confidence interval - if (ntest[0] < 30): + if ntest[0] < 30: # student's t distribution - cv = st.t.interval(0.99, ntest[0]-1)[1] + cv = st.t.interval(0.99, ntest[0] - 1)[1] else: # normal distribution cv = st.norm.ppf(0.995) # confidence intervals - cdev_fused = cv * sdev_fused / np.sqrt(ntest[0]) + cdev_fused = cv * sdev_fused / np.sqrt(ntest[0]) lower_fused = avg_fused - cdev_fused upper_fused = avg_fused + cdev_fused - cdev_unfused = cv * sdev_unfused / np.sqrt(ntest[0]) + cdev_unfused = cv * sdev_unfused / np.sqrt(ntest[0]) lower_unfused = avg_unfused - cdev_unfused upper_unfused = avg_unfused + cdev_unfused # check if the fused average times are within the unfused confidence interval - fused_in = np.where(np.logical_and(avg_fused < upper_unfused, - avg_fused > lower_unfused)) + fused_in = np.where( + np.logical_and(avg_fused < upper_unfused, avg_fused > lower_unfused) + ) # check if the unfused average times are within the fused confidence interval - unfused_in = np.where(np.logical_and(avg_unfused < upper_fused, - avg_unfused > lower_fused)) + unfused_in = np.where( + np.logical_and(avg_unfused < upper_fused, avg_unfused > lower_fused) + ) # get which numbers of vectors and elements for fused tests are in the # confidence interval of the unfused times @@ -226,7 +247,7 @@ def main(): ef[i] = np.log2(nelem[fused_in[1][i]]) df[i] = 1 - if (args.debug): + if args.debug: print(vf) print(ef) @@ -241,7 +262,7 @@ def main(): eu[i] = np.log2(nelem[unfused_in[1][i]]) du[i] = 1 - if (args.debug): + if args.debug: print(vu) print(eu) @@ -266,20 +287,20 @@ def main(): # print(NELM) # print(avg_ratio) for i in reversed(range(len(nvec))): - print('%2d' % int(i+1), str(avg_ratio[i]).replace('\n', '')) + print("%2d" % int(i + 1), str(avg_ratio[i]).replace("\n", "")) print # -------------------------------------------------------------------------- # Heat Map # -------------------------------------------------------------------------- - if (args.heatmap): + if args.heatmap: - x = np.arange(len(nelem)+1)-0.5 # x = log2(number of elements) = 0,1,2,... - y = np.arange(len(nvec)+1)+1.5 # y = number of vectors = 2,3,4,... + x = np.arange(len(nelem) + 1) - 0.5 # x = log2(number of elements) = 0,1,2,... + y = np.arange(len(nvec) + 1) + 1.5 # y = number of vectors = 2,3,4,... # y = np.arange(len(nvec)+1)+0.5 # y = number of vectors = 1,2,3,... X, Y = np.meshgrid(x, y) - if (args.debug): + if args.debug: print(x) print(y) @@ -287,67 +308,79 @@ def main(): rmax = np.amax(avg_ratio) rmin = np.amin(avg_ratio) - ext = 'neither' - if (rmin > 1): - cmap='Reds' - norm = mpl.colors.Normalize(vmin=rmin, vmax=min(rmax,2)) - v = np.linspace(rmin, min(rmax,2), 10, endpoint=True) - if (rmax > 2): - ext = 'max' + ext = "neither" + if rmin > 1: + cmap = "Reds" + norm = mpl.colors.Normalize(vmin=rmin, vmax=min(rmax, 2)) + v = np.linspace(rmin, min(rmax, 2), 10, endpoint=True) + if rmax > 2: + ext = "max" else: - cmap='seismic' - if (rmax-1 > 1): + cmap = "seismic" + if rmax - 1 > 1: rrange = 1 - ext = 'max' + ext = "max" else: - rrange = max(abs(rmax-1),abs(rmin-1)) + rrange = max(abs(rmax - 1), abs(rmin - 1)) - v1 = np.linspace(1-rrange, 1, 5, endpoint=True) - v2 = np.linspace(1, 1+rrange, 5, endpoint=True) - v = np.append(v1,v2[1:]) - norm = mpl.colors.Normalize(vmin=1-rrange, vmax=1+rrange) + v1 = np.linspace(1 - rrange, 1, 5, endpoint=True) + v2 = np.linspace(1, 1 + rrange, 5, endpoint=True) + v = np.append(v1, v2[1:]) + norm = mpl.colors.Normalize(vmin=1 - rrange, vmax=1 + rrange) # plot heatmap plt.pcolormesh(X, Y, avg_ratio, cmap=cmap, norm=norm) clb = plt.colorbar(ticks=v, extend=ext) - clb.ax.set_title('Max = {0:.2f}\nMin = {1:.2f}'.format(rmax,rmin)) + clb.ax.set_title("Max = {0:.2f}\nMin = {1:.2f}".format(rmax, rmin)) # aff markers to indicate if the average time falls in a confidence interval - plt.scatter(ef,vf,s=40,marker='^',c=df,label='fused') - plt.scatter(eu,vu,s=40,marker='v',c=du,label='unfused') + plt.scatter(ef, vf, s=40, marker="^", c=df, label="fused") + plt.scatter(eu, vu, s=40, marker="v", c=du, label="unfused") plt.legend(loc=9, bbox_to_anchor=(0.5, -0.1), ncol=2) # add legend for scatter plot art = [] - lgd = plt.legend(loc='lower right', bbox_to_anchor=(1.34, -0.17)) + lgd = plt.legend(loc="lower right", bbox_to_anchor=(1.34, -0.17)) art.append(lgd) # add labels and title plt.xticks(np.log2(nelem)) plt.yticks(nvec) - plt.xlabel('log2(num elements)') - plt.ylabel('num vectors') - plt.title('avg fused time / avg unfused time \n'+args.op) + plt.xlabel("log2(num elements)") + plt.ylabel("num vectors") + plt.title("avg fused time / avg unfused time \n" + args.op) # display or save figure - if (args.show): + if args.show: plt.show() else: - plt.savefig(args.op+'-heatmap.pdf', - additional_artists=art, - bbox_inches="tight") + plt.savefig( + args.op + "-heatmap.pdf", additional_artists=art, bbox_inches="tight" + ) plt.close() # -------------------------------------------------------------------------- # Time vs Number of Elements Plots # -------------------------------------------------------------------------- - if (args.timevelem): - - colors = ['#000000','#a6cee3','#1f78b4','#b2df8a','#33a02c', - '#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6', - '#6a3d9a','#ffff99','#b15928'] - - hatch = [ '/','\\','-','+','x','o','O','.','*'] + if args.timevelem: + + colors = [ + "#000000", + "#a6cee3", + "#1f78b4", + "#b2df8a", + "#33a02c", + "#fb9a99", + "#e31a1c", + "#fdbf6f", + "#ff7f00", + "#cab2d6", + "#6a3d9a", + "#ffff99", + "#b15928", + ] + + hatch = ["/", "\\", "-", "+", "x", "o", "O", ".", "*"] # -------------------------------------------------------------------------- # Combined Number of Vectors Plots @@ -359,38 +392,45 @@ def main(): i = nvec.index(nv) - if (args.loglog): - ax.loglog(nelem, avg_fused[i], - color=colors[i], linestyle='-', label=nv) - ax.loglog(nelem, avg_unfused[i], - color=colors[i], linestyle='--', label=None) + if args.loglog: + ax.loglog(nelem, avg_fused[i], color=colors[i], linestyle="-", label=nv) + ax.loglog( + nelem, avg_unfused[i], color=colors[i], linestyle="--", label=None + ) else: - ax.plot(nelem, avg_fused[i], - color=colors[i], linestyle='-', label=nv) - ax.plot(nelem, avg_unfused[i], - color=colors[i], linestyle='--', label=None) + ax.plot(nelem, avg_fused[i], color=colors[i], linestyle="-", label=nv) + ax.plot( + nelem, avg_unfused[i], color=colors[i], linestyle="--", label=None + ) # plot confidence interval - ax.fill_between(nelem, lower_fused[i], upper_fused[i], - color=colors[i], alpha=0.3) - ax.fill_between(nelem, lower_unfused[i], upper_unfused[i], - color=colors[i], hatch='.', alpha=0.3) + ax.fill_between( + nelem, lower_fused[i], upper_fused[i], color=colors[i], alpha=0.3 + ) + ax.fill_between( + nelem, + lower_unfused[i], + upper_unfused[i], + color=colors[i], + hatch=".", + alpha=0.3, + ) ax.legend() ax.grid() - plt.title('Average Time Fused vs Unfused \n'+args.op) - plt.xlabel('vector length') - plt.ylabel('time (s)') + plt.title("Average Time Fused vs Unfused \n" + args.op) + plt.xlabel("vector length") + plt.ylabel("time (s)") - if (args.show): + if args.show: plt.show() else: - if (args.loglog): - fname=args.op+'-nvec-all-loglog.pdf' + if args.loglog: + fname = args.op + "-nvec-all-loglog.pdf" else: - fname=args.op+'-nvec-all.pdf' - plt.ticklabel_format(axis='both',style='sci') + fname = args.op + "-nvec-all.pdf" + plt.ticklabel_format(axis="both", style="sci") plt.savefig(fname) plt.close() @@ -400,49 +440,70 @@ def main(): for nv in nvec: fig = plt.figure() - ax = fig.add_subplot(111) + ax = fig.add_subplot(111) idx = nvec.index(nv) # plot run times - if (args.loglog): - ax.loglog(nelem, avg_fused[idx], - color='red', linestyle='-', label='Fused') - ax.loglog(nelem, avg_unfused[idx], - color='blue', linestyle='--', label='Unfused') + if args.loglog: + ax.loglog( + nelem, avg_fused[idx], color="red", linestyle="-", label="Fused" + ) + ax.loglog( + nelem, + avg_unfused[idx], + color="blue", + linestyle="--", + label="Unfused", + ) else: - ax.plot(nelem, avg_fused[idx], - color='red', linestyle='-', label='Fused') - ax.plot(nelem, avg_unfused[idx], - color='blue', linestyle='--', label='Unfused') + ax.plot( + nelem, avg_fused[idx], color="red", linestyle="-", label="Fused" + ) + ax.plot( + nelem, + avg_unfused[idx], + color="blue", + linestyle="--", + label="Unfused", + ) # plot confidence intervals - ax.fill_between(nelem, lower_fused[idx], upper_fused[idx], - color='red', alpha=0.2) - ax.fill_between(nelem, lower_unfused[idx], upper_unfused[idx], - color='blue', hatch='.', alpha=0.2) + ax.fill_between( + nelem, lower_fused[idx], upper_fused[idx], color="red", alpha=0.2 + ) + ax.fill_between( + nelem, + lower_unfused[idx], + upper_unfused[idx], + color="blue", + hatch=".", + alpha=0.2, + ) ax.legend() ax.grid() - plt.title('Average Time Fused vs Unfused with '+str(nv)+' vectors\n'+args.op) - plt.xlabel('vector length') - ax.set_ylabel('time (s)') + plt.title( + "Average Time Fused vs Unfused with " + str(nv) + " vectors\n" + args.op + ) + plt.xlabel("vector length") + ax.set_ylabel("time (s)") - if (args.show): + if args.show: plt.show() else: - if (args.loglog): - fname=args.op+'-nvec-'+str(nv)+'-loglog.pdf' + if args.loglog: + fname = args.op + "-nvec-" + str(nv) + "-loglog.pdf" else: - fname=args.op+'-nvec-'+str(nv)+'.pdf' - plt.ticklabel_format(axis='both',style='sci') + fname = args.op + "-nvec-" + str(nv) + ".pdf" + plt.ticklabel_format(axis="both", style="sci") plt.savefig(fname) plt.close() + # =============================================================================== if __name__ == "__main__": main() # EOF - diff --git a/benchmarks/nvector/plot_nvector_performance_speedup.py b/benchmarks/nvector/plot_nvector_performance_speedup.py index fb421f5573..623d716c01 100755 --- a/benchmarks/nvector/plot_nvector_performance_speedup.py +++ b/benchmarks/nvector/plot_nvector_performance_speedup.py @@ -20,6 +20,7 @@ # indicates if timing was enabled. # ----------------------------------------------------------------------------- + def main(): import argparse @@ -35,46 +36,61 @@ def main(): import matplotlib.ticker as mtick parser = argparse.ArgumentParser( - description='Plot data from NVector performance tests') - - parser.add_argument('op', type=str, - help='Which NVector operation to plot') - - parser.add_argument('datadir', type=str, - help='Directory where test output files are located') - - parser.add_argument('--noplots', dest='noplots', action='store_true', - help='Turn on plots for time vs number of elements') - - parser.add_argument('--logx', dest='logx', action='store_true', - help='Generate plots for speedup with log scale for the x axis (number of elements') - - parser.add_argument('--fused', dest='fused', action='store_true', - help='Operation is a fused op') - - parser.add_argument('--show', dest='show', action='store_true', - help='Display plots rather than saving to file') - - parser.add_argument('--debug', dest='debug', action='store_true', - help='Turn on debugging output') + description="Plot data from NVector performance tests" + ) + + parser.add_argument("op", type=str, help="Which NVector operation to plot") + + parser.add_argument( + "datadir", type=str, help="Directory where test output files are located" + ) + + parser.add_argument( + "--noplots", + dest="noplots", + action="store_true", + help="Turn on plots for time vs number of elements", + ) + + parser.add_argument( + "--logx", + dest="logx", + action="store_true", + help="Generate plots for speedup with log scale for the x axis (number of elements", + ) + + parser.add_argument( + "--fused", dest="fused", action="store_true", help="Operation is a fused op" + ) + + parser.add_argument( + "--show", + dest="show", + action="store_true", + help="Display plots rather than saving to file", + ) + + parser.add_argument( + "--debug", dest="debug", action="store_true", help="Turn on debugging output" + ) # parse command line args args = parser.parse_args() - if (args.debug): + if args.debug: print(args) # check for test data directory - if (not os.path.isdir(args.datadir)): - print("ERROR:",args.datadir,"does not exist") + if not os.path.isdir(args.datadir): + print("ERROR:", args.datadir, "does not exist") sys.exit() # sort output files - output_baseline = sorted(glob.glob(args.datadir+'/output*-old.log')) - output_new = sorted(glob.glob(args.datadir+'/output*-new.log')) + output_baseline = sorted(glob.glob(args.datadir + "/output*-old.log")) + output_new = sorted(glob.glob(args.datadir + "/output*-new.log")) output = output_baseline + output_new - if (args.debug): + if args.debug: print("output files") print(len(output)) for i in range(len(output)): @@ -82,8 +98,8 @@ def main(): # figure out vector sizes, number of vectors, and number of sums nelem = [] - nvec = [] - nsum = [] + nvec = [] + nsum = [] ntest = [] # parse file names to get input parameters @@ -97,40 +113,40 @@ def main(): ns = int(split_fout[3]) nt = int(split_fout[4]) - if (not ne in nelem): + if not ne in nelem: nelem.append(ne) - if (not nv in nvec): + if not nv in nvec: nvec.append(nv) - if (not ns in nsum): + if not ns in nsum: nsum.append(ns) - if (not nt in ntest): + if not nt in ntest: ntest.append(nt) - if (len(ntest) != 1): + if len(ntest) != 1: print("Warning: Unequal numbers of tests") nelem.sort() - if (args.debug): - print("nelem:",nelem, len(nelem)) - print("nvec: ",nvec, len(nvec)) - print("nsum: ",nsum, len(nsum)) - print("ntest:",ntest, len(ntest)) + if args.debug: + print("nelem:", nelem, len(nelem)) + print("nvec: ", nvec, len(nvec)) + print("nsum: ", nsum, len(nsum)) + print("ntest:", ntest, len(ntest)) # allocate numpy arrays for timing data - avg_denom = np.zeros([len(nvec), len(nelem)]) + avg_denom = np.zeros([len(nvec), len(nelem)]) sdev_denom = np.zeros([len(nvec), len(nelem)]) - avg_numer = np.zeros([len(nvec), len(nelem)]) + avg_numer = np.zeros([len(nvec), len(nelem)]) sdev_numer = np.zeros([len(nvec), len(nelem)]) avg_ratio = np.zeros([len(nvec), len(nelem)]) # read 'baseline' files for f in output_baseline: - if (args.debug): - print("Reading:",f) + if args.debug: + print("Reading:", f) # get test inputs from file name split_fout = f.split("/")[-1] split_fout = split_fout.split("_") @@ -142,22 +158,22 @@ def main(): # split line into list split_line = shlex.split(line) # skip blank lines - if (not split_line): + if not split_line: continue # tests finished, stop reading file - if (split_line[0] == "Finished"): + if split_line[0] == "Finished": break # check if the operation is the one we want and get data - if (args.op == split_line[0]): + if args.op == split_line[0]: i = nvec.index(nv) j = nelem.index(ne) - avg_numer[i][j] = float(split_line[1]) + avg_numer[i][j] = float(split_line[1]) sdev_numer[i][j] = float(split_line[2]) # read output files for f in output_new: - if (args.debug): - print("Reading:",f) + if args.debug: + print("Reading:", f) # get test inputs from file name split_fout = f.split("/")[-1] split_fout = split_fout.split("_") @@ -169,16 +185,16 @@ def main(): # split line into list split_line = shlex.split(line) # skip blank lines - if (not split_line): + if not split_line: continue # tests finished, stop reading file - if (split_line[0] == "Finished"): + if split_line[0] == "Finished": break # check if the operation is the one we want and get data - if (args.op == split_line[0]): + if args.op == split_line[0]: i = nvec.index(nv) j = nelem.index(ne) - avg_denom[i][j] = float(split_line[1]) + avg_denom[i][j] = float(split_line[1]) sdev_denom[i][j] = float(split_line[2]) avg_ratio[i][j] = avg_numer[i][j] / avg_denom[i][j] @@ -187,35 +203,37 @@ def main(): # -------------------------------------------------------------------------- # allocate arrays for the upper and lower bounds of the confidence interval - lower_denom = np.zeros([len(nvec), len(nelem)]) - upper_denom = np.zeros([len(nvec), len(nelem)]) + lower_denom = np.zeros([len(nvec), len(nelem)]) + upper_denom = np.zeros([len(nvec), len(nelem)]) lower_numer = np.zeros([len(nvec), len(nelem)]) upper_numer = np.zeros([len(nvec), len(nelem)]) # critical value for 99% confidence interval - if (ntest[0] < 30): + if ntest[0] < 30: # student's t distribution - cv = st.t.interval(0.99, ntest[0]-1)[1] + cv = st.t.interval(0.99, ntest[0] - 1)[1] else: # normal distribution cv = st.norm.ppf(0.995) # confidence intervals - cdev_denom = cv * sdev_denom / np.sqrt(ntest[0]) + cdev_denom = cv * sdev_denom / np.sqrt(ntest[0]) lower_denom = avg_denom - cdev_denom upper_denom = avg_denom + cdev_denom - cdev_numer = cv * sdev_numer / np.sqrt(ntest[0]) + cdev_numer = cv * sdev_numer / np.sqrt(ntest[0]) lower_numer = avg_numer - cdev_numer upper_numer = avg_numer + cdev_numer # check if the new average times are within the baseline confidence interval - denom_in = np.where(np.logical_and(avg_denom < upper_numer, - avg_denom > lower_numer)) + denom_in = np.where( + np.logical_and(avg_denom < upper_numer, avg_denom > lower_numer) + ) # check if the baseline average times are within the new confidence interval - numer_in = np.where(np.logical_and(avg_numer < upper_denom, - avg_numer > lower_denom)) + numer_in = np.where( + np.logical_and(avg_numer < upper_denom, avg_numer > lower_denom) + ) # get which numbers of vectors and elements for new tests are in the # confidence interval of the baseline times @@ -228,9 +246,9 @@ def main(): ef[i] = np.log2(nelem[denom_in[1][i]]) df[i] = 1 - if (args.debug): - print('vf:', vf) - print('ef:', ef) + if args.debug: + print("vf:", vf) + print("ef:", ef) # get which numbers of vectors and elements for baseline tests are in the # confidence interval of the new times @@ -243,9 +261,9 @@ def main(): eu[i] = np.log2(nelem[numer_in[1][i]]) du[i] = 1 - if (args.debug): - print('vu:', vu) - print('eu:', eu) + if args.debug: + print("vu:", vu) + print("eu:", eu) # -------------------------------------------------------------------------- # Output ratios @@ -256,29 +274,41 @@ def main(): print("avg. new") for i in reversed(range(len(nvec))): - print('%2d' % int(i+1), str(avg_denom[i]).replace('\n', '')) + print("%2d" % int(i + 1), str(avg_denom[i]).replace("\n", "")) print() print("avg. baseline") for i in reversed(range(len(nvec))): - print('%2d' % int(i+1), str(avg_numer[i]).replace('\n', '')) + print("%2d" % int(i + 1), str(avg_numer[i]).replace("\n", "")) print() print("avg. ratio (speedup)") for i in reversed(range(len(nvec))): - print('%2d' % int(i+1), str(avg_ratio[i]).replace('\n', '')) + print("%2d" % int(i + 1), str(avg_ratio[i]).replace("\n", "")) print() # -------------------------------------------------------------------------- # Speedup v. Number of Elements Plots # -------------------------------------------------------------------------- - if (not args.noplots): - - colors = ['#000000','#a6cee3','#1f78b4','#b2df8a','#33a02c', - '#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6', - '#6a3d9a','#ffff99','#b15928'] - - hatch = [ '/','\\','-','+','x','o','O','.','*'] + if not args.noplots: + + colors = [ + "#000000", + "#a6cee3", + "#1f78b4", + "#b2df8a", + "#33a02c", + "#fb9a99", + "#e31a1c", + "#fdbf6f", + "#ff7f00", + "#cab2d6", + "#6a3d9a", + "#ffff99", + "#b15928", + ] + + hatch = ["/", "\\", "-", "+", "x", "o", "O", ".", "*"] # -------------------------------------------------------------------------- # Combined Number of Vectors Plots @@ -287,19 +317,17 @@ def main(): ax = fig.add_subplot(111) if args.fused: - indices = range(0,len(nvec)) + indices = range(0, len(nvec)) else: - indices = range(len(nvec)-1,len(nvec)) + indices = range(len(nvec) - 1, len(nvec)) for i in indices: - lab = 'num. vecs %d' % nvec[i] - if (args.logx): - ax.plot(nelem, avg_ratio[i], - color=colors[i], linestyle='-', label=lab) - ax.set_xscale('log') + lab = "num. vecs %d" % nvec[i] + if args.logx: + ax.plot(nelem, avg_ratio[i], color=colors[i], linestyle="-", label=lab) + ax.set_xscale("log") else: - ax.plot(nelem, avg_ratio[i], - color=colors[i], linestyle='-', label=lab) + ax.plot(nelem, avg_ratio[i], color=colors[i], linestyle="-", label=lab) # # plot confidence interval # ax.fill_between(nelem, lower_denom[i], upper_denom[i], # color=colors[i], alpha=0.3) @@ -309,18 +337,18 @@ def main(): ax.legend() ax.grid() - plt.title('Average Speedup \n'+args.op) - plt.xlabel('vector length') - plt.ylabel('speedup (baseline/new)') + plt.title("Average Speedup \n" + args.op) + plt.xlabel("vector length") + plt.ylabel("speedup (baseline/new)") - if (args.show): + if args.show: plt.show() else: - if (args.logx): - fname=args.op+'-nvec-all-logx.pdf' + if args.logx: + fname = args.op + "-nvec-all-logx.pdf" else: - fname=args.op+'-nvec-all.pdf' - plt.ticklabel_format(axis='both',style='sci') + fname = args.op + "-nvec-all.pdf" + plt.ticklabel_format(axis="both", style="sci") plt.savefig(fname) plt.close() 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/shared/Changelog.rst b/doc/shared/Changelog.rst index 2ce7b9c951..5bf5c04203 100644 --- a/doc/shared/Changelog.rst +++ b/doc/shared/Changelog.rst @@ -21,11 +21,19 @@ Changelog .. SED_REPLACEMENT_KEY -Changes to SUNDIALS in release 7.1.1 +Changes to SUNDIALS in release X.Y.Z ==================================== .. include:: RecentChanges_link.rst +Changes to SUNDIALS in release 7.1.1 +==================================== + +**Bug Fixes** + +Fixed a `bug `_ in v7.1.0 with the +SYCL N_Vector ``N_VSpace`` function. + Changes to SUNDIALS in release 7.1.0 ==================================== diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 0340eed7c8..cc4a9f919c 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -1,3 +1,9 @@ +**Major Features** + +**New Features and Enhancements** + **Bug Fixes** -Fixed a `bug `_ in v7.1.0 with the SYCL N_Vector ``N_VSpace`` function. +Fixed the loading of ARKStep's default first order explicit method. + +**Deprecation Notices** diff --git a/doc/shared/sundials_vars.py b/doc/shared/sundials_vars.py index 7fdf28446e..4c5f76c563 100644 --- a/doc/shared/sundials_vars.py +++ b/doc/shared/sundials_vars.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ---------------------------------------------------------------- -doc_version = 'v7.1.1' +doc_version = 'develop' sundials_version = 'v7.1.1' arkode_version = 'v6.1.1' cvode_version = 'v7.1.1' diff --git a/doc/superbuild/source/developers/style_guide/SourceCode.rst b/doc/superbuild/source/developers/style_guide/SourceCode.rst index 473409d987..5a05602867 100644 --- a/doc/superbuild/source/developers/style_guide/SourceCode.rst +++ b/doc/superbuild/source/developers/style_guide/SourceCode.rst @@ -184,10 +184,12 @@ not adhere to all of these rules. variable-length arrays. Exceptions are allowed when interfacing with a library which requires a newer standard. -#. All new code added to SUNDIALS should be - formatted with `clang-format `_, - and `fprettify `_. - See :ref:`Style.Formatting` for details. +#. All new code added to SUNDIALS should be formatted with `clang-format + `_ for C/C++, `fprettify + `_ for Fortran, `cmake-format + `_ for CMake, and `black + `_ for Python. See :ref:`Style.Formatting` for + details. #. Spaces not tabs. @@ -378,16 +380,22 @@ Formatting ---------- All new code added to SUNDIALS should be formatted with `clang-format -`_ and -`fprettify `_. 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. To apply ``clang-format`` and ``fprettify`` you can run: +`_ for C/C++, `fprettify +`_ 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. The +``.cmake-format.py`` file in the root of the project defines our configuration +for cmake-format. We also use the default black settings. -.. code-block:: shell - ./scripts/format.sh +To apply ``clang-format``, ``fprettify``, ``cmake-format``, and ``black`` you +can run: + +.. code-block:: shell + ./scripts/format.sh .. warning:: @@ -395,8 +403,7 @@ for clang-format. We use the default fprettify settings, except we use that you use version ``17.0.4``, which can be installed from source or with Spack. Alternatively, when you open a pull request on GitHub, an action will run ``clang-format`` on the code. If any 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`. - + (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: @@ -453,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_parallel/plot_brusselator1D.py b/examples/arkode/CXX_parallel/plot_brusselator1D.py index 2bcc7d1af7..087577ff0e 100755 --- a/examples/arkode/CXX_parallel/plot_brusselator1D.py +++ b/examples/arkode/CXX_parallel/plot_brusselator1D.py @@ -22,33 +22,36 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('mesh.txt', dtype=np.double) +mesh = np.loadtxt("mesh.txt", dtype=np.double) # load output time file -times = np.loadtxt('t.000000.txt', dtype=np.double) +times = np.loadtxt("t.000000.txt", dtype=np.double) # load solution data files -ufiles = glob.glob('u.' + ('[0-9]'*6) + '.txt'); ufiles.sort() -vfiles = glob.glob('v.' + ('[0-9]'*6) + '.txt'); vfiles.sort() -wfiles = glob.glob('w.' + ('[0-9]'*6) + '.txt'); wfiles.sort() +ufiles = glob.glob("u." + ("[0-9]" * 6) + ".txt") +ufiles.sort() +vfiles = glob.glob("v." + ("[0-9]" * 6) + ".txt") +vfiles.sort() +wfiles = glob.glob("w." + ("[0-9]" * 6) + ".txt") +wfiles.sort() udata = np.loadtxt(ufiles[0], dtype=np.double) vdata = np.loadtxt(vfiles[0], dtype=np.double) wdata = np.loadtxt(wfiles[0], dtype=np.double) -for idx in range(1,len(ufiles)): +for idx in range(1, len(ufiles)): udata = np.hstack((udata, np.loadtxt(ufiles[idx], dtype=np.double))) vdata = np.hstack((vdata, np.loadtxt(vfiles[idx], dtype=np.double))) wdata = np.hstack((wdata, np.loadtxt(wfiles[idx], dtype=np.double))) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() xmax = mesh.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() @@ -57,39 +60,39 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'solution.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "solution." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, xmax, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() # set string constants for output plots, current time, mesh size -pname = 'solution_at_x0.png' +pname = "solution_at_x0.png" xstr = repr(mesh[0]) # plot current solution and save to disk plt.figure(1) -plt.plot(times,udata[:,0],label="u") -plt.plot(times,vdata[:,0],label="v") -plt.plot(times,wdata[:,0],label="w") -plt.xlabel('t') -plt.ylabel('solution') -plt.title('Solutions at output at x = '+xstr) +plt.plot(times, udata[:, 0], label="u") +plt.plot(times, vdata[:, 0], label="v") +plt.plot(times, wdata[:, 0], label="w") +plt.xlabel("t") +plt.ylabel("solution") +plt.title("Solutions at output at x = " + xstr) plt.axis((times[0], times[-1], minval, maxval)) plt.grid() -plt.legend(loc='upper right', shadow=True) +plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() diff --git a/examples/arkode/CXX_parallel/plot_heat2D_p.py b/examples/arkode/CXX_parallel/plot_heat2D_p.py index 7b7f83d929..0a99dfbc5e 100755 --- a/examples/arkode/CXX_parallel/plot_heat2D_p.py +++ b/examples/arkode/CXX_parallel/plot_heat2D_p.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read MPI root process problem info file -infofile = 'heat2d_info.00000.txt' +infofile = "heat2d_info.00000.txt" with open(infofile) as fn: @@ -59,7 +59,7 @@ continue # total number of MPI processes - if "np"in line: + if "np" in line: nprocs = int(text[1]) continue @@ -71,11 +71,11 @@ # ------------------------------------------------------------------------------ # load subdomain information, store in table -subdomains = np.zeros((nprocs,4), dtype=np.int) +subdomains = np.zeros((nprocs, 4), dtype=np.int) for i in range(nprocs): - infofile = 'heat2d_info.' + repr(i).zfill(5) + '.txt' + infofile = "heat2d_info." + repr(i).zfill(5) + ".txt" with open(infofile) as fn: @@ -87,62 +87,64 @@ # x-direction starting index if "is" in line: - subdomains[i,0] = float(text[1]) + subdomains[i, 0] = float(text[1]) continue # x-direction ending index if "ie" in line: - subdomains[i,1] = float(text[1]) + subdomains[i, 1] = float(text[1]) continue # y-direction starting index if "js" in line: - subdomains[i,2] = float(text[1]) + subdomains[i, 2] = float(text[1]) continue # y-direction ending index if "je" in line: - subdomains[i,3] = float(text[1]) + subdomains[i, 3] = float(text[1]) continue # ------------------------------------------------------------------------------ # check if the error was output -fname = 'heat2d_error.00000.txt' +fname = "heat2d_error.00000.txt" if os.path.isfile(fname): - plottype = ['solution', 'error'] + plottype = ["solution", "error"] else: - plottype = ['solution'] + plottype = ["solution"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) for i in range(nprocs): - datafile = 'heat2d_' + pt + '.' + repr(i).zfill(5) + '.txt' + datafile = "heat2d_" + pt + "." + repr(i).zfill(5) + ".txt" # load data data = np.loadtxt(datafile, dtype=np.double) - if (np.shape(data)[0] != nt): - sys.exit('error: subdomain ' + i + ' has an incorrect number of time steps') + if np.shape(data)[0] != nt: + sys.exit("error: subdomain " + i + " has an incorrect number of time steps") # subdomain indices - istart = subdomains[i,0] - iend = subdomains[i,1] - jstart = subdomains[i,2] - jend = subdomains[i,3] - nxl = iend - istart + 1 - nyl = jend - jstart + 1 + istart = subdomains[i, 0] + iend = subdomains[i, 1] + jstart = subdomains[i, 2] + jend = subdomains[i, 3] + nxl = iend - istart + 1 + nyl = jend - jstart + 1 # extract data for i in range(nt): - time[i] = data[i,0] - result[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,1:], (nyl,nxl)) + time[i] = data[i, 0] + result[i, jstart : jend + 1, istart : iend + 1] = np.reshape( + data[i, 1:], (nyl, nxl) + ) # determine extents of plots maxtemp = 1.1 * result.max() @@ -151,7 +153,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -160,24 +162,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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_parhyp/plot_heat2D_p.py b/examples/arkode/CXX_parhyp/plot_heat2D_p.py index 7b7f83d929..0a99dfbc5e 100755 --- a/examples/arkode/CXX_parhyp/plot_heat2D_p.py +++ b/examples/arkode/CXX_parhyp/plot_heat2D_p.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read MPI root process problem info file -infofile = 'heat2d_info.00000.txt' +infofile = "heat2d_info.00000.txt" with open(infofile) as fn: @@ -59,7 +59,7 @@ continue # total number of MPI processes - if "np"in line: + if "np" in line: nprocs = int(text[1]) continue @@ -71,11 +71,11 @@ # ------------------------------------------------------------------------------ # load subdomain information, store in table -subdomains = np.zeros((nprocs,4), dtype=np.int) +subdomains = np.zeros((nprocs, 4), dtype=np.int) for i in range(nprocs): - infofile = 'heat2d_info.' + repr(i).zfill(5) + '.txt' + infofile = "heat2d_info." + repr(i).zfill(5) + ".txt" with open(infofile) as fn: @@ -87,62 +87,64 @@ # x-direction starting index if "is" in line: - subdomains[i,0] = float(text[1]) + subdomains[i, 0] = float(text[1]) continue # x-direction ending index if "ie" in line: - subdomains[i,1] = float(text[1]) + subdomains[i, 1] = float(text[1]) continue # y-direction starting index if "js" in line: - subdomains[i,2] = float(text[1]) + subdomains[i, 2] = float(text[1]) continue # y-direction ending index if "je" in line: - subdomains[i,3] = float(text[1]) + subdomains[i, 3] = float(text[1]) continue # ------------------------------------------------------------------------------ # check if the error was output -fname = 'heat2d_error.00000.txt' +fname = "heat2d_error.00000.txt" if os.path.isfile(fname): - plottype = ['solution', 'error'] + plottype = ["solution", "error"] else: - plottype = ['solution'] + plottype = ["solution"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) for i in range(nprocs): - datafile = 'heat2d_' + pt + '.' + repr(i).zfill(5) + '.txt' + datafile = "heat2d_" + pt + "." + repr(i).zfill(5) + ".txt" # load data data = np.loadtxt(datafile, dtype=np.double) - if (np.shape(data)[0] != nt): - sys.exit('error: subdomain ' + i + ' has an incorrect number of time steps') + if np.shape(data)[0] != nt: + sys.exit("error: subdomain " + i + " has an incorrect number of time steps") # subdomain indices - istart = subdomains[i,0] - iend = subdomains[i,1] - jstart = subdomains[i,2] - jend = subdomains[i,3] - nxl = iend - istart + 1 - nyl = jend - jstart + 1 + istart = subdomains[i, 0] + iend = subdomains[i, 1] + jstart = subdomains[i, 2] + jend = subdomains[i, 3] + nxl = iend - istart + 1 + nyl = jend - jstart + 1 # extract data for i in range(nt): - time[i] = data[i,0] - result[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,1:], (nyl,nxl)) + time[i] = data[i, 0] + result[i, jstart : jend + 1, istart : iend + 1] = np.reshape( + data[i, 1:], (nyl, nxl) + ) # determine extents of plots maxtemp = 1.1 * result.max() @@ -151,7 +153,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -160,24 +162,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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_serial/plot_heat2D.py b/examples/arkode/CXX_serial/plot_heat2D.py index 6c97cdc112..c494bc06de 100755 --- a/examples/arkode/CXX_serial/plot_heat2D.py +++ b/examples/arkode/CXX_serial/plot_heat2D.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read problem info file -infofile = 'heat2d_info.txt' +infofile = "heat2d_info.txt" with open(infofile) as fn: @@ -66,26 +66,26 @@ # ------------------------------------------------------------------------------ # check if the error was output -fname = 'heat2d_error.txt' +fname = "heat2d_error.txt" if os.path.isfile(fname): - plottype = ['solution', 'error'] + plottype = ["solution", "error"] else: - plottype = ['solution'] + plottype = ["solution"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) # load data - data = np.loadtxt('heat2d_' + pt + '.txt', dtype=np.double) + data = np.loadtxt("heat2d_" + pt + ".txt", dtype=np.double) # extract data for i in range(nt): - time[i] = data[i,0] - result[i,0:ny+1,0:nx+1] = np.reshape(data[i,1:], (ny,nx)) + time[i] = data[i, 0] + result[i, 0 : ny + 1, 0 : nx + 1] = np.reshape(data[i, 1:], (ny, nx)) # determine extents of plots maxtemp = 1.1 * result.max() @@ -94,7 +94,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -103,24 +103,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() diff --git a/examples/arkode/CXX_serial/plot_sol.py b/examples/arkode/CXX_serial/plot_sol.py index ab463fac6c..fe3d875340 100755 --- a/examples/arkode/CXX_serial/plot_sol.py +++ b/examples/arkode/CXX_serial/plot_sol.py @@ -20,16 +20,16 @@ import numpy as np # load solution data file -data = np.loadtxt('solution.txt', dtype=np.double) +data = np.loadtxt("solution.txt", dtype=np.double) # determine number of time steps, number of fields -nt,nv = np.shape(data) +nt, nv = np.shape(data) # extract time array -times = data[:,0] +times = data[:, 0] # parse comment line to determine solution names -f = open('solution.txt', 'r') +f = open("solution.txt", "r") commentline = f.readline() commentsplit = commentline.split() names = commentsplit[2:] @@ -38,18 +38,16 @@ plt.figure() # add curves to figure -for i in range(nv-1): - plt.plot(times,data[:,i+1],label=names[i]) -plt.xlabel('t') -if (nv > 2): - plt.ylabel('solutions') +for i in range(nv - 1): + plt.plot(times, data[:, i + 1], label=names[i]) +plt.xlabel("t") +if nv > 2: + plt.ylabel("solutions") else: - plt.ylabel('solution') -plt.legend(loc='upper right', shadow=True) + plt.ylabel("solution") +plt.legend(loc="upper right", shadow=True) plt.grid() -plt.savefig('solution.png') - - +plt.savefig("solution.png") ##### end of script ##### 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/CXX_xbraid/plot_heat2D.py b/examples/arkode/CXX_xbraid/plot_heat2D.py index 72aaa2adea..f24592bfdc 100755 --- a/examples/arkode/CXX_xbraid/plot_heat2D.py +++ b/examples/arkode/CXX_xbraid/plot_heat2D.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read problem info file -infofile = 'heat2d_info.txt' +infofile = "heat2d_info.txt" with open(infofile) as fn: @@ -66,17 +66,17 @@ # ------------------------------------------------------------------------------ # check if the error was output -fname = 'heat2d_error.000000.txt' +fname = "heat2d_error.000000.txt" if os.path.isfile(fname): - plottype = ['solution', 'error'] + plottype = ["solution", "error"] else: - plottype = ['solution'] + plottype = ["solution"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) tindex = range(0, nt) @@ -86,14 +86,14 @@ for t in tindex: # output file name - datafile = 'heat2d_' + pt + '.' + repr(t).zfill(6) + '.txt' + datafile = "heat2d_" + pt + "." + repr(t).zfill(6) + ".txt" # load data data = np.loadtxt(datafile, dtype=np.double) # extract data time[i] = data[0] - result[i,0:ny+1,0:nx+1] = np.reshape(data[1:], (ny,nx)) + result[i, 0 : ny + 1, 0 : nx + 1] = np.reshape(data[1:], (ny, nx)) i += 1 # determine extents of plots @@ -103,7 +103,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -112,24 +112,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(6) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(6) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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_manyvector/plot_brusselator1D.py b/examples/arkode/C_manyvector/plot_brusselator1D.py index 3cc29051e5..72a3402c4a 100755 --- a/examples/arkode/C_manyvector/plot_brusselator1D.py +++ b/examples/arkode/C_manyvector/plot_brusselator1D.py @@ -20,23 +20,23 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('bruss_mesh.txt', dtype=np.double) +mesh = np.loadtxt("bruss_mesh.txt", dtype=np.double) # load solution data files -udata = np.loadtxt('bruss_u.txt', dtype=np.double) -vdata = np.loadtxt('bruss_v.txt', dtype=np.double) -wdata = np.loadtxt('bruss_w.txt', dtype=np.double) +udata = np.loadtxt("bruss_u.txt", dtype=np.double) +vdata = np.loadtxt("bruss_v.txt", dtype=np.double) +wdata = np.loadtxt("bruss_w.txt", dtype=np.double) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() @@ -44,21 +44,21 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'brusselator1D.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "brusselator1D." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() 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_openmp/plot_brusselator1D.py b/examples/arkode/C_openmp/plot_brusselator1D.py index 3cc29051e5..72a3402c4a 100755 --- a/examples/arkode/C_openmp/plot_brusselator1D.py +++ b/examples/arkode/C_openmp/plot_brusselator1D.py @@ -20,23 +20,23 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('bruss_mesh.txt', dtype=np.double) +mesh = np.loadtxt("bruss_mesh.txt", dtype=np.double) # load solution data files -udata = np.loadtxt('bruss_u.txt', dtype=np.double) -vdata = np.loadtxt('bruss_v.txt', dtype=np.double) -wdata = np.loadtxt('bruss_w.txt', dtype=np.double) +udata = np.loadtxt("bruss_u.txt", dtype=np.double) +vdata = np.loadtxt("bruss_v.txt", dtype=np.double) +wdata = np.loadtxt("bruss_w.txt", dtype=np.double) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() @@ -44,21 +44,21 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'brusselator1D.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "brusselator1D." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() 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_parallel/plot_brusselator1D.py b/examples/arkode/C_parallel/plot_brusselator1D.py index 2bcc7d1af7..087577ff0e 100755 --- a/examples/arkode/C_parallel/plot_brusselator1D.py +++ b/examples/arkode/C_parallel/plot_brusselator1D.py @@ -22,33 +22,36 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('mesh.txt', dtype=np.double) +mesh = np.loadtxt("mesh.txt", dtype=np.double) # load output time file -times = np.loadtxt('t.000000.txt', dtype=np.double) +times = np.loadtxt("t.000000.txt", dtype=np.double) # load solution data files -ufiles = glob.glob('u.' + ('[0-9]'*6) + '.txt'); ufiles.sort() -vfiles = glob.glob('v.' + ('[0-9]'*6) + '.txt'); vfiles.sort() -wfiles = glob.glob('w.' + ('[0-9]'*6) + '.txt'); wfiles.sort() +ufiles = glob.glob("u." + ("[0-9]" * 6) + ".txt") +ufiles.sort() +vfiles = glob.glob("v." + ("[0-9]" * 6) + ".txt") +vfiles.sort() +wfiles = glob.glob("w." + ("[0-9]" * 6) + ".txt") +wfiles.sort() udata = np.loadtxt(ufiles[0], dtype=np.double) vdata = np.loadtxt(vfiles[0], dtype=np.double) wdata = np.loadtxt(wfiles[0], dtype=np.double) -for idx in range(1,len(ufiles)): +for idx in range(1, len(ufiles)): udata = np.hstack((udata, np.loadtxt(ufiles[idx], dtype=np.double))) vdata = np.hstack((vdata, np.loadtxt(vfiles[idx], dtype=np.double))) wdata = np.hstack((wdata, np.loadtxt(wfiles[idx], dtype=np.double))) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() xmax = mesh.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() @@ -57,39 +60,39 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'solution.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "solution." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, xmax, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() # set string constants for output plots, current time, mesh size -pname = 'solution_at_x0.png' +pname = "solution_at_x0.png" xstr = repr(mesh[0]) # plot current solution and save to disk plt.figure(1) -plt.plot(times,udata[:,0],label="u") -plt.plot(times,vdata[:,0],label="v") -plt.plot(times,wdata[:,0],label="w") -plt.xlabel('t') -plt.ylabel('solution') -plt.title('Solutions at output at x = '+xstr) +plt.plot(times, udata[:, 0], label="u") +plt.plot(times, vdata[:, 0], label="v") +plt.plot(times, wdata[:, 0], label="w") +plt.xlabel("t") +plt.ylabel("solution") +plt.title("Solutions at output at x = " + xstr) plt.axis((times[0], times[-1], minval, maxval)) plt.grid() -plt.legend(loc='upper right', shadow=True) +plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() 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/C_serial/ark_kepler_plot.py b/examples/arkode/C_serial/ark_kepler_plot.py index 2d499d850e..7a50dc3ebb 100755 --- a/examples/arkode/C_serial/ark_kepler_plot.py +++ b/examples/arkode/C_serial/ark_kepler_plot.py @@ -19,70 +19,72 @@ import matplotlib.pyplot as plt import argparse -parser = argparse.ArgumentParser(description='Script for plotting the energy, angular momentum, and phase space solution for ark_kepler.c') -parser.add_argument('output_times', help='file with the output times') -parser.add_argument('solution', help='file with the solution') -parser.add_argument('conserved_quantities', help='file with conserved quantities') +parser = argparse.ArgumentParser( + description="Script for plotting the energy, angular momentum, and phase space solution for ark_kepler.c" +) +parser.add_argument("output_times", help="file with the output times") +parser.add_argument("solution", help="file with the solution") +parser.add_argument("conserved_quantities", help="file with conserved quantities") args = parser.parse_args() t = np.loadtxt(args.output_times, dtype=np.float64) y = np.loadtxt(args.solution, dtype=np.float64) -y = np.reshape(y, (y.shape[0]//4, 4)) +y = np.reshape(y, (y.shape[0] // 4, 4)) plt.figure(dpi=200) -plt.plot(y[:,0], y[:,1]) -plt.savefig('ark_kepler_phase.png') +plt.plot(y[:, 0], y[:, 1]) +plt.savefig("ark_kepler_phase.png") plt.close() -conserved = np.loadtxt(args.conserved_quantities, delimiter=',', dtype=np.float64) -energy = conserved[:,0] -energy_0 = conserved[0,0] -L = conserved[:,1] -L_0 = conserved[0,1] +conserved = np.loadtxt(args.conserved_quantities, delimiter=",", dtype=np.float64) +energy = conserved[:, 0] +energy_0 = conserved[0, 0] +L = conserved[:, 1] +L_0 = conserved[0, 1] plt.figure(dpi=200) -plt.title('Energy') +plt.title("Energy") plt.plot(t, np.abs(energy)) -plt.ylabel('H(t,p,q)') -plt.xlabel('<--- t --->') -plt.xscale('log') -plt.savefig('ark_kepler_energy.png') +plt.ylabel("H(t,p,q)") +plt.xlabel("<--- t --->") +plt.xscale("log") +plt.savefig("ark_kepler_energy.png") plt.close() plt.figure(dpi=200) -plt.title('Momentum') +plt.title("Momentum") plt.plot(t, L) -plt.ylabel('L(t,p,q)') -plt.xlabel('<--- t --->') -plt.xscale('log') -plt.savefig('ark_kepler_momentum.png') +plt.ylabel("L(t,p,q)") +plt.xlabel("<--- t --->") +plt.xscale("log") +plt.savefig("ark_kepler_momentum.png") plt.close() # # Time plot. # plt.figure(dpi=200) -plt.plot(t, y[:,0], linewidth = 2) -plt.plot(t, y[:,1], linewidth = 2) -plt.plot(t, y[:,2], linewidth = 2) -plt.plot(t, y[:,3], linewidth = 2) +plt.plot(t, y[:, 0], linewidth=2) +plt.plot(t, y[:, 1], linewidth=2) +plt.plot(t, y[:, 2], linewidth=2) +plt.plot(t, y[:, 3], linewidth=2) plt.grid(True) -plt.legend(['P', 'P\'', 'Q', 'Q\'']) -plt.xlabel('<--- t --->') -plt.ylabel('<--- y(1:4) --->') -plt.title('Solution in Time') -plt.savefig('ark_kepler_plot.png') +plt.legend(["P", "P'", "Q", "Q'"]) +plt.xlabel("<--- t --->") +plt.ylabel("<--- y(1:4) --->") +plt.title("Solution in Time") +plt.savefig("ark_kepler_plot.png") plt.close() # # Phase plot. # plt.figure(dpi=200) -plt.plot(y[:,0], y[:,1], linewidth=0.1) +plt.plot(y[:, 0], y[:, 1], linewidth=0.1) plt.grid(True) -plt.xlabel('<--- y1 --->') -plt.ylabel('<--- y2 --->') -plt.title('Phase Plot') -plt.savefig('ark_kepler_phase.png') +plt.xlabel("<--- y1 --->") +plt.ylabel("<--- y2 --->") +plt.title("Phase Plot") +plt.savefig("ark_kepler_phase.png") plt.close() diff --git a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c index 65a4ca73bf..56754bb625 100644 --- a/examples/arkode/C_serial/ark_reaction_diffusion_mri.c +++ b/examples/arkode/C_serial/ark_reaction_diffusion_mri.c @@ -135,7 +135,7 @@ int main(void) if (check_retval(&retval, "SetInitialCondition", 1)) { return 1; } /* - * Create the slow integrator and set options + * Create the fast integrator and set options */ /* Initialize the fast integrator. Specify the explicit fast right-hand side diff --git a/examples/arkode/C_serial/plot_brusselator1D.py b/examples/arkode/C_serial/plot_brusselator1D.py index 3cc29051e5..72a3402c4a 100755 --- a/examples/arkode/C_serial/plot_brusselator1D.py +++ b/examples/arkode/C_serial/plot_brusselator1D.py @@ -20,23 +20,23 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('bruss_mesh.txt', dtype=np.double) +mesh = np.loadtxt("bruss_mesh.txt", dtype=np.double) # load solution data files -udata = np.loadtxt('bruss_u.txt', dtype=np.double) -vdata = np.loadtxt('bruss_v.txt', dtype=np.double) -wdata = np.loadtxt('bruss_w.txt', dtype=np.double) +udata = np.loadtxt("bruss_u.txt", dtype=np.double) +vdata = np.loadtxt("bruss_v.txt", dtype=np.double) +wdata = np.loadtxt("bruss_w.txt", dtype=np.double) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() @@ -44,21 +44,21 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'brusselator1D.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "brusselator1D." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() diff --git a/examples/arkode/C_serial/plot_brusselator1D_FEM.py b/examples/arkode/C_serial/plot_brusselator1D_FEM.py index d47bf2b40e..61bbf4f069 100755 --- a/examples/arkode/C_serial/plot_brusselator1D_FEM.py +++ b/examples/arkode/C_serial/plot_brusselator1D_FEM.py @@ -20,52 +20,52 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('bruss_FEM_mesh.txt', dtype=np.double) +mesh = np.loadtxt("bruss_FEM_mesh.txt", dtype=np.double) # load solution data files -udata = np.loadtxt('bruss_FEM_u.txt', dtype=np.double) -vdata = np.loadtxt('bruss_FEM_v.txt', dtype=np.double) -wdata = np.loadtxt('bruss_FEM_w.txt', dtype=np.double) +udata = np.loadtxt("bruss_FEM_u.txt", dtype=np.double) +vdata = np.loadtxt("bruss_FEM_v.txt", dtype=np.double) +wdata = np.loadtxt("bruss_FEM_w.txt", dtype=np.double) # determine number of time steps, mesh size -nt,nx = np.shape(udata) +nt, nx = np.shape(udata) # determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() +umin = 0.9 * udata.min() +umax = 1.1 * udata.max() +vmin = 0.9 * vdata.min() +vmax = 1.1 * vdata.max() +wmin = 0.9 * wdata.min() +wmax = 1.1 * wdata.max() minval = np.array([umin, vmin, wmin]).min() maxval = np.array([umax, vmax, wmax]).max() # plot the mesh plt.figure(1) -plt.plot(mesh,0.0*mesh,'o') -plt.xlabel('x') -plt.title('FEM mesh') -plt.savefig('brusselator1D_FEM_mesh.png') +plt.plot(mesh, 0.0 * mesh, "o") +plt.xlabel("x") +plt.title("FEM mesh") +plt.savefig("brusselator1D_FEM_mesh.png") # generate plots of results for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'brusselator1D_FEM.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "brusselator1D_FEM." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, udata[tstep, :], label="u") + plt.plot(mesh, vdata[tstep, :], label="v") + plt.plot(mesh, wdata[tstep, :], label="w") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("Solutions at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, minval, maxval)) plt.grid() - plt.legend(loc='upper right', shadow=True) + plt.legend(loc="upper right", shadow=True) plt.savefig(pname) plt.close() diff --git a/examples/arkode/C_serial/plot_heat1D.py b/examples/arkode/C_serial/plot_heat1D.py index d1c8e2bfdf..7b7b0e3fd2 100755 --- a/examples/arkode/C_serial/plot_heat1D.py +++ b/examples/arkode/C_serial/plot_heat1D.py @@ -20,31 +20,31 @@ import numpy as np # load mesh data file -mesh = np.loadtxt('heat_mesh.txt', dtype=np.double) +mesh = np.loadtxt("heat_mesh.txt", dtype=np.double) # load solution data file -data = np.loadtxt('heat1D.txt', dtype=np.double) +data = np.loadtxt("heat1D.txt", dtype=np.double) # determine number of time steps, mesh size -nt,nx = np.shape(data) +nt, nx = np.shape(data) # determine maximum temperature -maxtemp = 1.1*data.max() +maxtemp = 1.1 * data.max() # generate plots of results for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat1d.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "heat1d." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(nx) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh,data[tstep,:]) - plt.xlabel('x') - plt.ylabel('solution') - plt.title('u(x) at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh, data[tstep, :]) + plt.xlabel("x") + plt.ylabel("solution") + plt.title("u(x) at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, 0.0, maxtemp)) plt.grid() plt.savefig(pname) diff --git a/examples/arkode/C_serial/plot_heat1D_adapt.py b/examples/arkode/C_serial/plot_heat1D_adapt.py index fa813fff04..ab361a968e 100755 --- a/examples/arkode/C_serial/plot_heat1D_adapt.py +++ b/examples/arkode/C_serial/plot_heat1D_adapt.py @@ -20,39 +20,41 @@ import numpy as np # load mesh data file as list of NumPy arrays -inp = open('heat_mesh.txt').readlines() +inp = open("heat_mesh.txt").readlines() mesh = [] for line in inp: mesh.append(np.array(str.split(line), dtype=np.double)) # load solution data file as list of NumPy arrays -inp = open('heat1D.txt').readlines() +inp = open("heat1D.txt").readlines() data = [] for line in inp: data.append(np.array(str.split(line), dtype=np.double)) # determine number of time steps -nt = len(mesh) +nt = len(mesh) nt2 = len(data) -if (nt != nt2): - sys.exit('plot_heat1D_adapt.py error: data and mesh files have different numbers of time steps') +if nt != nt2: + sys.exit( + "plot_heat1D_adapt.py error: data and mesh files have different numbers of time steps" + ) # determine minimum/maximum temperature mintemp = 0.0 maxtemp = 0.0 for tstep in range(nt): mx = data[tstep].max() - if (mx > maxtemp): + if mx > maxtemp: maxtemp = mx mn = data[tstep].min() - if (mn < mintemp): + if mn < mintemp: mintemp = mn -if (maxtemp > 0.0): +if maxtemp > 0.0: maxtemp *= 1.1 else: maxtemp *= 0.9 -if (mintemp > 0.0): +if mintemp > 0.0: mintemp *= 0.9 else: mintemp *= 1.1 @@ -62,16 +64,16 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat1d.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) + pname = "heat1d." + repr(tstep).zfill(3) + ".png" + tstr = repr(tstep) nxstr = repr(len(data[tstep])) # plot current solution and save to disk plt.figure(1) - plt.plot(mesh[tstep],data[tstep],'-o') - plt.xlabel('x') - plt.ylabel('solution') - plt.title('u(x) at output ' + tstr + ', mesh = ' + nxstr) + plt.plot(mesh[tstep], data[tstep], "-o") + plt.xlabel("x") + plt.ylabel("solution") + plt.title("u(x) at output " + tstr + ", mesh = " + nxstr) plt.axis((0.0, 1.0, mintemp, maxtemp)) plt.grid() plt.savefig(pname) diff --git a/examples/arkode/C_serial/plot_sol.py b/examples/arkode/C_serial/plot_sol.py index af783fb053..813f35bec2 100755 --- a/examples/arkode/C_serial/plot_sol.py +++ b/examples/arkode/C_serial/plot_sol.py @@ -20,16 +20,16 @@ import numpy as np # load solution data file -data = np.loadtxt('solution.txt', dtype=np.double) +data = np.loadtxt("solution.txt", dtype=np.double) # determine number of time steps, number of fields -nt,nv = np.shape(data) +nt, nv = np.shape(data) # extract time array -times = data[:,0] +times = data[:, 0] # parse comment line to determine solution names -f = open('solution.txt', 'r') +f = open("solution.txt", "r") commentline = f.readline() commentsplit = commentline.split() names = commentsplit[2:] @@ -38,18 +38,16 @@ plt.figure() # add curves to figure -for i in range(nv-1): - plt.plot(times,data[:,i+1],label=names[i]) -plt.xlabel('t') -if (nv > 2): - plt.ylabel('solutions') +for i in range(nv - 1): + plt.plot(times, data[:, i + 1], label=names[i]) +plt.xlabel("t") +if nv > 2: + plt.ylabel("solutions") else: - plt.ylabel('solution') -plt.legend(loc='upper right', shadow=True) + plt.ylabel("solution") +plt.legend(loc="upper right", shadow=True) plt.grid() -plt.savefig('solution.png') - - +plt.savefig("solution.png") ##### end of script ##### diff --git a/examples/arkode/C_serial/plot_sol_log.py b/examples/arkode/C_serial/plot_sol_log.py index ca27f9eb59..2437cce448 100755 --- a/examples/arkode/C_serial/plot_sol_log.py +++ b/examples/arkode/C_serial/plot_sol_log.py @@ -20,16 +20,16 @@ import numpy as np # load solution data file -data = np.loadtxt('solution.txt', dtype=np.double) +data = np.loadtxt("solution.txt", dtype=np.double) # determine number of time steps, number of fields -nt,nv = np.shape(data) +nt, nv = np.shape(data) # extract time array -times = data[:,0] +times = data[:, 0] # parse comment line to determine solution names -f = open('solution.txt', 'r') +f = open("solution.txt", "r") commentline = f.readline() commentsplit = commentline.split() names = commentsplit[2:] @@ -38,18 +38,16 @@ plt.figure() # add curves to figure -for i in range(nv-1): - plt.loglog(times,data[:,i+1],label=names[i]) -plt.xlabel('t') -if (nv > 2): - plt.ylabel('solutions') +for i in range(nv - 1): + plt.loglog(times, data[:, i + 1], label=names[i]) +plt.xlabel("t") +if nv > 2: + plt.ylabel("solutions") else: - plt.ylabel('solution') -plt.legend(loc='upper right', shadow=True) + plt.ylabel("solution") +plt.legend(loc="upper right", shadow=True) plt.grid() -plt.savefig('solution.png') - - +plt.savefig("solution.png") ##### end of script ##### 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_parallel/plot_heat2D_p.py b/examples/cvode/CXX_parallel/plot_heat2D_p.py index 5e5357873a..9f320f609b 100755 --- a/examples/cvode/CXX_parallel/plot_heat2D_p.py +++ b/examples/cvode/CXX_parallel/plot_heat2D_p.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read MPI root process problem info file -infofile = 'heat2d_info.00000.txt' +infofile = "heat2d_info.00000.txt" with open(infofile) as fn: @@ -59,7 +59,7 @@ continue # total number of MPI processes - if "np"in line: + if "np" in line: nprocs = int(text[1]) continue @@ -71,11 +71,11 @@ # ------------------------------------------------------------------------------ # load subdomain information, store in table -subdomains = np.zeros((nprocs,4), dtype=np.int) +subdomains = np.zeros((nprocs, 4), dtype=np.int) for i in range(nprocs): - infofile = 'heat2d_info.' + repr(i).zfill(5) + '.txt' + infofile = "heat2d_info." + repr(i).zfill(5) + ".txt" with open(infofile) as fn: @@ -87,56 +87,58 @@ # x-direction starting index if "is" in line: - subdomains[i,0] = float(text[1]) + subdomains[i, 0] = float(text[1]) continue # x-direction ending index if "ie" in line: - subdomains[i,1] = float(text[1]) + subdomains[i, 1] = float(text[1]) continue # y-direction starting index if "js" in line: - subdomains[i,2] = float(text[1]) + subdomains[i, 2] = float(text[1]) continue # y-direction ending index if "je" in line: - subdomains[i,3] = float(text[1]) + subdomains[i, 3] = float(text[1]) continue # ------------------------------------------------------------------------------ -plottype = ['solution', 'error'] +plottype = ["solution", "error"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) for i in range(nprocs): - datafile = 'heat2d_' + pt + '.' + repr(i).zfill(5) + '.txt' + datafile = "heat2d_" + pt + "." + repr(i).zfill(5) + ".txt" # load data data = np.loadtxt(datafile, dtype=np.double) - if (np.shape(data)[0] != nt): - sys.exit('error: subdomain ' + i + ' has an incorrect number of time steps') + if np.shape(data)[0] != nt: + sys.exit("error: subdomain " + i + " has an incorrect number of time steps") # subdomain indices - istart = subdomains[i,0] - iend = subdomains[i,1] - jstart = subdomains[i,2] - jend = subdomains[i,3] - nxl = iend - istart + 1 - nyl = jend - jstart + 1 + istart = subdomains[i, 0] + iend = subdomains[i, 1] + jstart = subdomains[i, 2] + jend = subdomains[i, 3] + nxl = iend - istart + 1 + nyl = jend - jstart + 1 # extract data for i in range(nt): - time[i] = data[i,0] - result[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,1:], (nyl,nxl)) + time[i] = data[i, 0] + result[i, jstart : jend + 1, istart : iend + 1] = np.reshape( + data[i, 1:], (nyl, nxl) + ) # determine extents of plots maxtemp = 1.1 * result.max() @@ -145,7 +147,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -154,24 +156,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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_parhyp/plot_heat2D_p.py b/examples/cvode/CXX_parhyp/plot_heat2D_p.py index 58673d17b2..f567f1c621 100755 --- a/examples/cvode/CXX_parhyp/plot_heat2D_p.py +++ b/examples/cvode/CXX_parhyp/plot_heat2D_p.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read MPI root process problem info file -infofile = 'heat2d_info.00000.txt' +infofile = "heat2d_info.00000.txt" with open(infofile) as fn: @@ -59,7 +59,7 @@ continue # total number of MPI processes - if "np"in line: + if "np" in line: nprocs = int(text[1]) continue @@ -71,11 +71,11 @@ # ------------------------------------------------------------------------------ # load subdomain information, store in table -subdomains = np.zeros((nprocs,4), dtype=np.int) +subdomains = np.zeros((nprocs, 4), dtype=np.int) for i in range(nprocs): - infofile = 'heat2d_info.' + repr(i).zfill(5) + '.txt' + infofile = "heat2d_info." + repr(i).zfill(5) + ".txt" with open(infofile) as fn: @@ -87,56 +87,58 @@ # x-direction starting index if "is" in line: - subdomains[i,0] = float(text[1]) + subdomains[i, 0] = float(text[1]) continue # x-direction ending index if "ie" in line: - subdomains[i,1] = float(text[1]) + subdomains[i, 1] = float(text[1]) continue # y-direction starting index if "js" in line: - subdomains[i,2] = float(text[1]) + subdomains[i, 2] = float(text[1]) continue # y-direction ending index if "je" in line: - subdomains[i,3] = float(text[1]) + subdomains[i, 3] = float(text[1]) continue # ------------------------------------------------------------------------------ -plottype = ['solution', 'error'] +plottype = ["solution", "error"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) for i in range(nprocs): - datafile = 'heat2d_' + pt + '.' + repr(i).zfill(5) + '.txt' + datafile = "heat2d_" + pt + "." + repr(i).zfill(5) + ".txt" # load data data = np.loadtxt(datafile, dtype=np.double) - if (np.shape(data)[0] != nt): - sys.exit('error: subdomain ' + i + ' has an incorrect number of time steps') + if np.shape(data)[0] != nt: + sys.exit("error: subdomain " + i + " has an incorrect number of time steps") # subdomain indices - istart = subdomains[i,0] - iend = subdomains[i,1] - jstart = subdomains[i,2] - jend = subdomains[i,3] - nxl = iend - istart + 1 - nyl = jend - jstart + 1 + istart = subdomains[i, 0] + iend = subdomains[i, 1] + jstart = subdomains[i, 2] + jend = subdomains[i, 3] + nxl = iend - istart + 1 + nyl = jend - jstart + 1 # extract data for i in range(nt): - time[i] = data[i,0] - result[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,1:], (nyl,nxl)) + time[i] = data[i, 0] + result[i, jstart : jend + 1, istart : iend + 1] = np.reshape( + data[i, 1:], (nyl, nxl) + ) # determine extents of plots maxtemp = 1.1 * result.max() @@ -145,7 +147,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -154,24 +156,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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_serial/plot_heat2D.py b/examples/cvode/CXX_serial/plot_heat2D.py index bbadc4de32..90ceba7d96 100755 --- a/examples/cvode/CXX_serial/plot_heat2D.py +++ b/examples/cvode/CXX_serial/plot_heat2D.py @@ -28,7 +28,7 @@ # ------------------------------------------------------------------------------ # read problem info file -infofile = 'heat2d_info.txt' +infofile = "heat2d_info.txt" with open(infofile) as fn: @@ -65,21 +65,21 @@ # ------------------------------------------------------------------------------ -plottype = ['solution', 'error'] +plottype = ["solution", "error"] for pt in plottype: # fill array with data - time = np.zeros(nt) + time = np.zeros(nt) result = np.zeros((nt, ny, nx)) # load data - data = np.loadtxt('heat2d_' + pt + '.txt', dtype=np.double) + data = np.loadtxt("heat2d_" + pt + ".txt", dtype=np.double) # extract data for i in range(nt): - time[i] = data[i,0] - result[i,0:ny+1,0:nx+1] = np.reshape(data[i,1:], (ny,nx)) + time[i] = data[i, 0] + result[i, 0 : ny + 1, 0 : nx + 1] = np.reshape(data[i, 1:], (ny, nx)) # determine extents of plots maxtemp = 1.1 * result.max() @@ -88,7 +88,7 @@ # set x and y meshgrid objects xspan = np.linspace(0.0, xu, nx) yspan = np.linspace(0.0, yu, ny) - X,Y = np.meshgrid(xspan, yspan) + X, Y = np.meshgrid(xspan, yspan) nxstr = repr(nx) nystr = repr(ny) @@ -97,24 +97,33 @@ for tstep in range(nt): # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf_' + pt + '.' + repr(tstep).zfill(3) + '.png' - tstr = str(time[tstep]) + pname = "heat2d_surf_" + pt + "." + repr(tstep).zfill(3) + ".png" + tstr = str(time[tstep]) # plot surface and save to disk fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, result[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - - ax.set_xlabel('x') - ax.set_ylabel('y') + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + result[tstep, :, :], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + + ax.set_xlabel("x") + ax.set_ylabel("y") ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - if (pt == 'solution'): - title('u(x,y) at t = ' + tstr) + ax.view_init(20, 45) + if pt == "solution": + title("u(x,y) at t = " + tstr) else: - title('error(x,y) at t = ' + tstr) + title("error(x,y) at t = " + tstr) savefig(pname) plt.close() 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/serial/plot_cvParticle.py b/examples/cvode/serial/plot_cvParticle.py index 6557000a0a..f686312a78 100755 --- a/examples/cvode/serial/plot_cvParticle.py +++ b/examples/cvode/serial/plot_cvParticle.py @@ -21,20 +21,26 @@ import matplotlib.pyplot as plt # command line options -parser = argparse.ArgumentParser(description='Plots cvPraticle_dns output') -parser.add_argument('--sfile', type=str, - default='cvParticle_solution.txt', - help='solution output file to read') -parser.add_argument('--efile', type=str, - default='cvParticle_error.txt', - help='error output file to read') -parser.add_argument('--alpha', type=float, nargs=1, - default=1.0, - help='set a non-default alpha value') -parser.add_argument('--slim', type=float, nargs=2, - help='x and y limits for solution plot') -parser.add_argument('--eylim', type=float, nargs=2, - help='y limits for error plot') +parser = argparse.ArgumentParser(description="Plots cvPraticle_dns output") +parser.add_argument( + "--sfile", + type=str, + default="cvParticle_solution.txt", + help="solution output file to read", +) +parser.add_argument( + "--efile", + type=str, + default="cvParticle_error.txt", + help="error output file to read", +) +parser.add_argument( + "--alpha", type=float, nargs=1, default=1.0, help="set a non-default alpha value" +) +parser.add_argument( + "--slim", type=float, nargs=2, help="x and y limits for solution plot" +) +parser.add_argument("--eylim", type=float, nargs=2, help="y limits for error plot") # parse inputs args = parser.parse_args() @@ -48,23 +54,23 @@ y = data[:, 2] # unit circle -tt = np.linspace(0,np.pi*2,10000) +tt = np.linspace(0, np.pi * 2, 10000) xt = np.cos(tt) yt = np.sin(tt) # plot solution fig, ax = plt.subplots() -plt.plot(xt, yt, color='black', linestyle='--') -plt.scatter(x, y, color='red') +plt.plot(xt, yt, color="black", linestyle="--") +plt.scatter(x, y, color="red") -if (args.slim): +if args.slim: plt.xlim((args.slim[0], args.slim[1])) plt.ylim((args.slim[0], args.slim[1])) -plt.xlabel('x') -plt.ylabel('y') -plt.title('Solution') -ax.set_aspect('equal') +plt.xlabel("x") +plt.ylabel("y") +plt.title("Solution") +ax.set_aspect("equal") # true solution xt = np.cos(args.alpha * t) @@ -72,15 +78,15 @@ # plot solution fig, ax = plt.subplots() -plt.plot(t, x, linestyle='-', label='x') -plt.plot(t, xt, linestyle='--', label='x true') -plt.plot(t, y, linestyle='-', label='y') -plt.plot(t, yt, linestyle='--', label='y true') +plt.plot(t, x, linestyle="-", label="x") +plt.plot(t, xt, linestyle="--", label="x true") +plt.plot(t, y, linestyle="-", label="y") +plt.plot(t, yt, linestyle="--", label="y true") -plt.xlabel('t') -plt.ylabel('position') -plt.title('Particle Position Over Time') -plt.legend(loc='lower right') +plt.xlabel("t") +plt.ylabel("position") +plt.title("Particle Position Over Time") +plt.legend(loc="lower right") # read error output file data = np.loadtxt(args.efile, dtype=np.double) @@ -93,17 +99,17 @@ # plot solution fig, ax = plt.subplots() -plt.semilogy(t, xerr, label='x err') -plt.semilogy(t, yerr, label='y err') -plt.semilogy(t, cerr, label='c err') +plt.semilogy(t, xerr, label="x err") +plt.semilogy(t, yerr, label="y err") +plt.semilogy(t, cerr, label="c err") -if (args.eylim): +if args.eylim: plt.ylim((args.eylim[0], args.eylim[1])) -plt.xlabel('time') -plt.ylabel('error') -plt.legend(loc='lower right') -plt.title('Error in position and constraint') +plt.xlabel("time") +plt.ylabel("error") +plt.legend(loc="lower right") +plt.title("Error in position and constraint") plt.grid() # display plots diff --git a/examples/cvode/serial/plot_cvPendulum.py b/examples/cvode/serial/plot_cvPendulum.py index 07314f2936..c855c70d6d 100755 --- a/examples/cvode/serial/plot_cvPendulum.py +++ b/examples/cvode/serial/plot_cvPendulum.py @@ -21,9 +21,8 @@ import matplotlib.pyplot as plt # command line options -parser = argparse.ArgumentParser(description='Plots cvPendulum_dns output') -parser.add_argument('sfile', type=str, - help='solution output file to read') +parser = argparse.ArgumentParser(description="Plots cvPendulum_dns output") +parser.add_argument("sfile", type=str, help="solution output file to read") # parse inputs args = parser.parse_args() @@ -32,9 +31,9 @@ data = np.loadtxt(args.sfile, dtype=np.double) # extract times, positions, and velocities -t = data[:, 0] -x = data[:, 1] -y = data[:, 2] +t = data[:, 0] +x = data[:, 1] +y = data[:, 2] vx = data[:, 3] vy = data[:, 4] @@ -42,50 +41,50 @@ ref = np.loadtxt("cvPendulum_dns_ref.txt", dtype=np.double) # extract positions and velocities -xr = ref[:, 1] -yr = ref[:, 2] +xr = ref[:, 1] +yr = ref[:, 2] vxr = ref[:, 3] vyr = ref[:, 4] # lower half of unit circle -tt = np.linspace(np.pi, 2*np.pi, 10000) +tt = np.linspace(np.pi, 2 * np.pi, 10000) xt = np.cos(tt) yt = np.sin(tt) # plot solution in xy plane fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--', label=None) -ax.axvline(x=0, color='black', linestyle='--', label=None) -plt.plot(xt, yt, color='black', linestyle='--', label=None) -plt.scatter(x, y, color='red', label='comp') -plt.scatter(xr, yr, color='blue', label='ref') - -plt.xlabel('x') -plt.ylabel('y') -plt.title('Pendulum') -ax.set_aspect('equal') -plt.legend(loc='lower right') +ax.axhline(y=0, color="black", linestyle="--", label=None) +ax.axvline(x=0, color="black", linestyle="--", label=None) +plt.plot(xt, yt, color="black", linestyle="--", label=None) +plt.scatter(x, y, color="red", label="comp") +plt.scatter(xr, yr, color="blue", label="ref") + +plt.xlabel("x") +plt.ylabel("y") +plt.title("Pendulum") +ax.set_aspect("equal") +plt.legend(loc="lower right") # plot position over time fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--') -plt.plot(t, x, label='x') -plt.plot(t, y, label='y') +ax.axhline(y=0, color="black", linestyle="--") +plt.plot(t, x, label="x") +plt.plot(t, y, label="y") -plt.xlabel('t') -plt.ylabel('position') -plt.title('Pendulum Position') +plt.xlabel("t") +plt.ylabel("position") +plt.title("Pendulum Position") plt.legend() # plot velocity over time fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--') -plt.plot(t, vx, label='$v_x$') -plt.plot(t, vy, label='$v_y$') +ax.axhline(y=0, color="black", linestyle="--") +plt.plot(t, vx, label="$v_x$") +plt.plot(t, vy, label="$v_y$") -plt.xlabel('t') -plt.ylabel('velocity') -plt.title('Pendulum Velocity') +plt.xlabel("t") +plt.ylabel("velocity") +plt.title("Pendulum Velocity") plt.legend() # display plots 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/cvodes/serial/plot_cvsParticle.py b/examples/cvodes/serial/plot_cvsParticle.py index fb0c66da1c..72e8736388 100755 --- a/examples/cvodes/serial/plot_cvsParticle.py +++ b/examples/cvodes/serial/plot_cvsParticle.py @@ -21,20 +21,26 @@ import matplotlib.pyplot as plt # command line options -parser = argparse.ArgumentParser(description='Plots cvsPraticle_dns output') -parser.add_argument('--sfile', type=str, - default='cvsParticle_solution.txt', - help='solution output file to read') -parser.add_argument('--efile', type=str, - default='cvsParticle_error.txt', - help='error output file to read') -parser.add_argument('--alpha', type=float, nargs=1, - default=1.0, - help='set a non-default alpha value') -parser.add_argument('--slim', type=float, nargs=2, - help='x and y limits for solution plot') -parser.add_argument('--eylim', type=float, nargs=2, - help='y limits for error plot') +parser = argparse.ArgumentParser(description="Plots cvsPraticle_dns output") +parser.add_argument( + "--sfile", + type=str, + default="cvsParticle_solution.txt", + help="solution output file to read", +) +parser.add_argument( + "--efile", + type=str, + default="cvsParticle_error.txt", + help="error output file to read", +) +parser.add_argument( + "--alpha", type=float, nargs=1, default=1.0, help="set a non-default alpha value" +) +parser.add_argument( + "--slim", type=float, nargs=2, help="x and y limits for solution plot" +) +parser.add_argument("--eylim", type=float, nargs=2, help="y limits for error plot") # parse inputs args = parser.parse_args() @@ -48,23 +54,23 @@ y = data[:, 2] # unit circle -tt = np.linspace(0,np.pi*2,10000) +tt = np.linspace(0, np.pi * 2, 10000) xt = np.cos(tt) yt = np.sin(tt) # plot solution fig, ax = plt.subplots() -plt.plot(xt, yt, color='black', linestyle='--') -plt.scatter(x, y, color='red') +plt.plot(xt, yt, color="black", linestyle="--") +plt.scatter(x, y, color="red") -if (args.slim): +if args.slim: plt.xlim((args.slim[0], args.slim[1])) plt.ylim((args.slim[0], args.slim[1])) -plt.xlabel('x') -plt.ylabel('y') -plt.title('Solution') -ax.set_aspect('equal') +plt.xlabel("x") +plt.ylabel("y") +plt.title("Solution") +ax.set_aspect("equal") # true solution xt = np.cos(args.alpha * t) @@ -72,15 +78,15 @@ # plot solution fig, ax = plt.subplots() -plt.plot(t, x, linestyle='-', label='x') -plt.plot(t, xt, linestyle='--', label='x true') -plt.plot(t, y, linestyle='-', label='y') -plt.plot(t, yt, linestyle='--', label='y true') +plt.plot(t, x, linestyle="-", label="x") +plt.plot(t, xt, linestyle="--", label="x true") +plt.plot(t, y, linestyle="-", label="y") +plt.plot(t, yt, linestyle="--", label="y true") -plt.xlabel('t') -plt.ylabel('position') -plt.title('Particle Position Over Time') -plt.legend(loc='lower right') +plt.xlabel("t") +plt.ylabel("position") +plt.title("Particle Position Over Time") +plt.legend(loc="lower right") # read error output file data = np.loadtxt(args.efile, dtype=np.double) @@ -93,17 +99,17 @@ # plot solution fig, ax = plt.subplots() -plt.semilogy(t, xerr, label='x err') -plt.semilogy(t, yerr, label='y err') -plt.semilogy(t, cerr, label='c err') +plt.semilogy(t, xerr, label="x err") +plt.semilogy(t, yerr, label="y err") +plt.semilogy(t, cerr, label="c err") -if (args.eylim): +if args.eylim: plt.ylim((args.eylim[0], args.eylim[1])) -plt.xlabel('time') -plt.ylabel('error') -plt.legend(loc='lower right') -plt.title('Error in position and constraint') +plt.xlabel("time") +plt.ylabel("error") +plt.legend(loc="lower right") +plt.title("Error in position and constraint") plt.grid() # display plots diff --git a/examples/cvodes/serial/plot_cvsPendulum.py b/examples/cvodes/serial/plot_cvsPendulum.py index 0376a755bb..87408f4634 100755 --- a/examples/cvodes/serial/plot_cvsPendulum.py +++ b/examples/cvodes/serial/plot_cvsPendulum.py @@ -21,9 +21,8 @@ import matplotlib.pyplot as plt # command line options -parser = argparse.ArgumentParser(description='Plots cvsPendulum_dns output') -parser.add_argument('sfile', type=str, - help='solution output file to read') +parser = argparse.ArgumentParser(description="Plots cvsPendulum_dns output") +parser.add_argument("sfile", type=str, help="solution output file to read") # parse inputs args = parser.parse_args() @@ -32,9 +31,9 @@ data = np.loadtxt(args.sfile, dtype=np.double) # extract times, positions, and velocities -t = data[:, 0] -x = data[:, 1] -y = data[:, 2] +t = data[:, 0] +x = data[:, 1] +y = data[:, 2] vx = data[:, 3] vy = data[:, 4] @@ -42,50 +41,50 @@ ref = np.loadtxt("cvsPendulum_dns_ref.txt", dtype=np.double) # extract positions and velocities -xr = ref[:, 1] -yr = ref[:, 2] +xr = ref[:, 1] +yr = ref[:, 2] vxr = ref[:, 3] vyr = ref[:, 4] # lower half of unit circle -tt = np.linspace(np.pi, 2*np.pi, 10000) +tt = np.linspace(np.pi, 2 * np.pi, 10000) xt = np.cos(tt) yt = np.sin(tt) # plot solution in xy plane fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--', label=None) -ax.axvline(x=0, color='black', linestyle='--', label=None) -plt.plot(xt, yt, color='black', linestyle='--', label=None) -plt.scatter(x, y, color='red', label='comp') -plt.scatter(xr, yr, color='blue', label='ref') - -plt.xlabel('x') -plt.ylabel('y') -plt.title('Pendulum') -ax.set_aspect('equal') -plt.legend(loc='lower right') +ax.axhline(y=0, color="black", linestyle="--", label=None) +ax.axvline(x=0, color="black", linestyle="--", label=None) +plt.plot(xt, yt, color="black", linestyle="--", label=None) +plt.scatter(x, y, color="red", label="comp") +plt.scatter(xr, yr, color="blue", label="ref") + +plt.xlabel("x") +plt.ylabel("y") +plt.title("Pendulum") +ax.set_aspect("equal") +plt.legend(loc="lower right") # plot position over time fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--') -plt.plot(t, x, label='x') -plt.plot(t, y, label='y') +ax.axhline(y=0, color="black", linestyle="--") +plt.plot(t, x, label="x") +plt.plot(t, y, label="y") -plt.xlabel('t') -plt.ylabel('position') -plt.title('Pendulum Position') +plt.xlabel("t") +plt.ylabel("position") +plt.title("Pendulum Position") plt.legend() # plot velocity over time fig, ax = plt.subplots() -ax.axhline(y=0, color='black', linestyle='--') -plt.plot(t, vx, label='$v_x$') -plt.plot(t, vy, label='$v_y$') +ax.axhline(y=0, color="black", linestyle="--") +plt.plot(t, vx, label="$v_x$") +plt.plot(t, vy, label="$v_y$") -plt.xlabel('t') -plt.ylabel('velocity') -plt.title('Pendulum Velocity') +plt.xlabel("t") +plt.ylabel("velocity") +plt.title("Pendulum Velocity") plt.legend() # display plots 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/examples/utilities/plot_data_2d.py b/examples/utilities/plot_data_2d.py index 0303e252ff..ecf15ab7e6 100755 --- a/examples/utilities/plot_data_2d.py +++ b/examples/utilities/plot_data_2d.py @@ -78,101 +78,111 @@ def main(): import sys import argparse - parser = argparse.ArgumentParser(description='''Plot 2D data files''') + parser = argparse.ArgumentParser(description="""Plot 2D data files""") # List of input data files - parser.add_argument('datafiles', type=str, nargs='+', - help='Data files to plot') + parser.add_argument("datafiles", type=str, nargs="+", help="Data files to plot") # Plot type options - group = parser.add_argument_group('Plot Options', - '''Options to specify the type of plot to - generate and what data to plot''') + group = parser.add_argument_group( + "Plot Options", + """Options to specify the type of plot to + generate and what data to plot""", + ) - group.add_argument('--plottype', type=str, - choices=['surface', 'surface-ani', - 'contour', 'contour-ani', - 'slice', 'point'], - default='surface', - help='''Set the plot type''') + group.add_argument( + "--plottype", + type=str, + choices=["surface", "surface-ani", "contour", "contour-ani", "slice", "point"], + default="surface", + help="""Set the plot type""", + ) - group.add_argument('--plotvars', type=int, nargs='+', - help='''Variable indices to plot''') + group.add_argument( + "--plotvars", type=int, nargs="+", help="""Variable indices to plot""" + ) - group.add_argument('--plottimes', type=int, nargs='+', - help='''Time indices to plot''') + group.add_argument( + "--plottimes", type=int, nargs="+", help="""Time indices to plot""" + ) # Slice plot options - group = parser.add_argument_group('Slice Plot Options', - '''Options specific to the slice plot - type''') + group = parser.add_argument_group( + "Slice Plot Options", + """Options specific to the slice plot + type""", + ) - group.add_argument('--slicetype', type=str, default='var', - choices=['var', 'time'], - help='''The slice plot type''') + group.add_argument( + "--slicetype", + type=str, + default="var", + choices=["var", "time"], + help="""The slice plot type""", + ) mxgroup = group.add_mutually_exclusive_group() - mxgroup.add_argument('--yslice', type=int, default=-1, - help='''y index to plot''') + mxgroup.add_argument("--yslice", type=int, default=-1, help="""y index to plot""") - mxgroup.add_argument('--xslice', type=int, default=-1, - help='''x index to plot''') + mxgroup.add_argument("--xslice", type=int, default=-1, help="""x index to plot""") # Point plot options - group = parser.add_argument_group('Point Plot Options', - '''Options specific to the point plot - type''') + group = parser.add_argument_group( + "Point Plot Options", + """Options specific to the point plot + type""", + ) - group.add_argument('--point', type=int, nargs=2, default=[0, 0], - help='''x and y index to plot''') + group.add_argument( + "--point", type=int, nargs=2, default=[0, 0], help="""x and y index to plot""" + ) # Output options - group = parser.add_argument_group('Output Options', - '''Options for saving plots''') + group = parser.add_argument_group("Output Options", """Options for saving plots""") - group.add_argument('--save', action='store_true', - help='''Save figure to file''') + group.add_argument("--save", action="store_true", help="""Save figure to file""") - group.add_argument('--prefix', type=str, - help='''File name prefix for saving the figure''') + group.add_argument( + "--prefix", type=str, help="""File name prefix for saving the figure""" + ) - group.add_argument('--merge', action='store_true', - help='''Merge PDF output files into a single file''') + group.add_argument( + "--merge", + action="store_true", + help="""Merge PDF output files into a single file""", + ) # Figure options - group = parser.add_argument_group('Figure Options', - '''Options to specify various figure - properties''') + group = parser.add_argument_group( + "Figure Options", + """Options to specify various figure + properties""", + ) - group.add_argument('--labels', type=str, nargs='+', - help='''Data labels for the plot legend''') + group.add_argument( + "--labels", type=str, nargs="+", help="""Data labels for the plot legend""" + ) - group.add_argument('--title', type=str, - help='''Plot title''') + group.add_argument("--title", type=str, help="""Plot title""") - group.add_argument('--xlabel', type=str, - help='''x-axis label''') + group.add_argument("--xlabel", type=str, help="""x-axis label""") - group.add_argument('--ylabel', type=str, - help='''y-axis label''') + group.add_argument("--ylabel", type=str, help="""y-axis label""") - group.add_argument('--zlabel', type=str, - help='''z-axis label''') + group.add_argument("--zlabel", type=str, help="""z-axis label""") - group.add_argument('--grid', action='store_true', - help='''Add grid to plot''') + group.add_argument("--grid", action="store_true", help="""Add grid to plot""") # Debugging options - parser.add_argument('--debug', action='store_true', - help='Enable debugging') + parser.add_argument("--debug", action="store_true", help="Enable debugging") # parse command line args args = parser.parse_args() @@ -190,52 +200,53 @@ def main(): plot_settings(args, info, time, xvals, yvals, zdata) # Create plots - if args.plottype == 'surface': + if args.plottype == "surface": plot_surface(args, info, time, xvals, yvals, zdata) - if args.plottype == 'surface-ani': + if args.plottype == "surface-ani": plot_surface_ani(args, info, time, xvals, yvals, zdata) - if args.plottype == 'contour': + if args.plottype == "contour": plot_contour(args, info, time, xvals, yvals, zdata) - if args.plottype == 'contour-ani': + if args.plottype == "contour-ani": plot_contour_ani(args, info, time, xvals, yvals, zdata) - if args.plottype == 'slice': + if args.plottype == "slice": # slice data - if (args.yslice > -1) and (args.yslice < info['ny']): + if (args.yslice > -1) and (args.yslice < info["ny"]): svals = xvals sdata = zdata[:, args.yslice, :, :] if args.xlabel: hlabel = args.xlabel else: - hlabel = 'x' + hlabel = "x" suffix = " at y = {:.4f}".format(yvals[args.yslice]) - elif (args.xslice > -1) and (args.xslice < info['nx']): + elif (args.xslice > -1) and (args.xslice < info["nx"]): svals = yvals sdata = zdata[:, :, args.xslice, :] if args.ylabel: hlabel = args.ylabel else: - hlabel = 'y' + hlabel = "y" suffix = " at x = {:.4f}".format(xvals[args.xslice]) else: print("ERROR: invalid xslice or yslice option") sys.exit() - if args.slicetype == 'var': + if args.slicetype == "var": plot_slice_vars(args, info, time, svals, sdata, hlabel, suffix) else: plot_slice_time(args, info, time, svals, sdata, hlabel, suffix) - if args.plottype == 'point': + if args.plottype == "point": # point data pdata = zdata[:, args.point[1], args.point[0], :] - suffix = " at x = {:.4f}, y = {:.4f}".format(xvals[args.point[0]], - yvals[args.point[1]]) + suffix = " at x = {:.4f}, y = {:.4f}".format( + xvals[args.point[0]], yvals[args.point[1]] + ) plot_point(args, info, time, pdata, suffix) @@ -264,8 +275,19 @@ def read_header(args): import numpy as np # initialize dictionary of header info variables to None - keys = ['title', 'varnames', 'nprocs', 'nvar', 'nt', 'nx', 'xl', 'xu', - 'ny', 'yl', 'yu'] + keys = [ + "title", + "varnames", + "nprocs", + "nvar", + "nt", + "nx", + "xl", + "xu", + "ny", + "yl", + "yu", + ] info = dict() for k in keys: @@ -290,62 +312,62 @@ def read_header(args): # plot title if "title" in line: - info['title'] = " ".join(text[2:]) + info["title"] = " ".join(text[2:]) continue # plot variable names if "vars" in line: - info['varnames'] = text[2:] + info["varnames"] = text[2:] continue # total number of processes if "nprocs" in line: - info['nprocs'] = int(text[2]) + info["nprocs"] = int(text[2]) continue # number of variables (at each spatial node) if "nvar" in line: - info['nvar'] = int(text[2]) + info["nvar"] = int(text[2]) continue # number of output times if "nt" in line: - info['nt'] = int(text[2]) + info["nt"] = int(text[2]) continue # the global number of nodes in the x-direction, the x lower bound # (west) and the x upper bound (east) if "nx" in line: - info['nx'] = int(text[2]) + info["nx"] = int(text[2]) continue if "xl" in line: - info['xl'] = float(text[2]) + info["xl"] = float(text[2]) continue if "xu" in line: - info['xu'] = float(text[2]) + info["xu"] = float(text[2]) continue # the global number of nodes in the y-direction, the y lower bound # (south) and the y upper bound (north) if "ny" in line: - info['ny'] = int(text[2]) + info["ny"] = int(text[2]) continue if "yl" in line: - info['yl'] = float(text[2]) + info["yl"] = float(text[2]) continue if "yu" in line: - info['yu'] = float(text[2]) + info["yu"] = float(text[2]) continue # load data to deduce values and perform sanity checks data = np.loadtxt(args.datafiles[0], dtype=np.double) # try to fill in missing values - if info['nvar'] is None: - info['nvar'] = 1 + if info["nvar"] is None: + info["nvar"] = 1 print("WARNING: nvar not provided. Using nvar = 1") - if info['nt'] is None or info['nx'] is None or info['ny'] is None: + if info["nt"] is None or info["nx"] is None or info["ny"] is None: # check if data exists if data.ndim != 2: @@ -353,72 +375,76 @@ def read_header(args): sys.exit() # number of output times - if info['nt'] is None: - info['nt'] = np.shape(data)[0] + if info["nt"] is None: + info["nt"] = np.shape(data)[0] # number of spatial nodes - if info['nx'] is None or info['ny'] is None: + if info["nx"] is None or info["ny"] is None: col = np.shape(data)[1] - 1 # exclude output times - if info['nx'] is None and info['ny'] is not None: - info['nx'] = col // (info['nvar'] * info['ny']) - elif info['nx'] is not None and info['ny'] is None: - info['ny'] = col // (info['nvar'] * info['nx']) + if info["nx"] is None and info["ny"] is not None: + info["nx"] = col // (info["nvar"] * info["ny"]) + elif info["nx"] is not None and info["ny"] is None: + info["ny"] = col // (info["nvar"] * info["nx"]) else: - info['nx'] = int(np.sqrt(col // info['nvar'])) - info['ny'] = info['nx'] - print("WARNING: nx and ny not provided. Using nx = ny =", - info['nx']) + info["nx"] = int(np.sqrt(col // info["nvar"])) + info["ny"] = info["nx"] + print("WARNING: nx and ny not provided. Using nx = ny =", info["nx"]) # sanity checks - if info['nt'] != np.shape(data)[0]: - print("ERROR: nt != nrows", info['nt'], np.shape(data)[0]) + if info["nt"] != np.shape(data)[0]: + print("ERROR: nt != nrows", info["nt"], np.shape(data)[0]) sys.exit() - if (info['nvar'] * info['nx'] * info['ny']) != (np.shape(data)[1] - 1): + if (info["nvar"] * info["nx"] * info["ny"]) != (np.shape(data)[1] - 1): print("ERROR: nvar * nx * ny != ncols - 1") sys.exit() # check x-dimension lower and upper bounds - if info['xl'] is None: + if info["xl"] is None: print("WARNING: xl not provided, using xl = 0") - info['xl'] = 0.0 + info["xl"] = 0.0 - if info['xu'] is None: + if info["xu"] is None: print("WARNING: xu not provided, using xu = 1") - info['xu'] = 1.0 + info["xu"] = 1.0 # check y-dimension lower and upper bounds - if info['yl'] is None: + if info["yl"] is None: print("WARNING: yl not provided, using yl = 0") - info['yl'] = 0.0 + info["yl"] = 0.0 - if info['yu'] is None: + if info["yu"] is None: print("WARNING: yu not provided, using yu = 1") - info['yu'] = 1.0 + info["yu"] = 1.0 # check number of processes - if info['nprocs'] is None: - info['nprocs'] = len(args.datafiles) - print("WARNING: nprocs not provided, using nprocs =", info['nprocs']) + if info["nprocs"] is None: + info["nprocs"] = len(args.datafiles) + print("WARNING: nprocs not provided, using nprocs =", info["nprocs"]) # check if all the expected input files were provided - if len(args.datafiles) != info['nprocs']: - print("ERROR: number of data files (", len(args.datafiles), - ") does not match number of processes (", info['nprocs'], ")") + if len(args.datafiles) != info["nprocs"]: + print( + "ERROR: number of data files (", + len(args.datafiles), + ") does not match number of processes (", + info["nprocs"], + ")", + ) sys.exit() if args.debug: - print('title = ', info['title']) - print('varnames = ', info['varnames']) - print('nprocs = ', info['nprocs']) - print('nvar = ', info['nvar']) - print('nt = ', info['nt']) - print('nx = ', info['nx']) - print('xl = ', info['xl']) - print('xu = ', info['xu']) - print('ny = ', info['ny']) - print('yl = ', info['yl']) - print('yu = ', info['yu']) + print("title = ", info["title"]) + print("varnames = ", info["varnames"]) + print("nprocs = ", info["nprocs"]) + print("nvar = ", info["nvar"]) + print("nt = ", info["nt"]) + print("nx = ", info["nx"]) + print("xl = ", info["xl"]) + print("xu = ", info["xu"]) + print("ny = ", info["ny"]) + print("yl = ", info["yl"]) + print("yu = ", info["yu"]) return info @@ -435,14 +461,14 @@ def read_subdomains(args, info): import numpy as np # load subdomain information, store in table - subdomains = np.zeros((info['nprocs'], 4), dtype=int) + subdomains = np.zeros((info["nprocs"], 4), dtype=int) # get the spatial subdomain owned by each process - if info['nprocs'] == 1: + if info["nprocs"] == 1: subdomains[0, 0] = 0 - subdomains[0, 1] = info['nx'] - 1 + subdomains[0, 1] = info["nx"] - 1 subdomains[0, 2] = 0 - subdomains[0, 3] = info['ny'] - 1 + subdomains[0, 3] = info["ny"] - 1 else: for idx, datafile in enumerate(args.datafiles): @@ -490,8 +516,7 @@ def read_subdomains(args, info): # check if subdomain indices were found if not (found_is and found_ie and found_js and found_je): - print("ERROR: could not find subdomain indices in", - datafile) + print("ERROR: could not find subdomain indices in", datafile) sys.exit() return subdomains @@ -507,10 +532,10 @@ def read_data(args, info, subdomains): import numpy as np # initialize data arrays - time = np.zeros(info['nt']) - xvals = np.linspace(info['xl'], info['xu'], info['nx']) - yvals = np.linspace(info['yl'], info['yu'], info['ny']) - zdata = np.zeros((info['nt'], info['ny'], info['nx'], info['nvar'])) + time = np.zeros(info["nt"]) + xvals = np.linspace(info["xl"], info["xu"], info["nx"]) + yvals = np.linspace(info["yl"], info["yu"], info["ny"]) + zdata = np.zeros((info["nt"], info["ny"], info["nx"], info["nvar"])) # extract data for idx, datafile in enumerate(args.datafiles): @@ -524,10 +549,17 @@ def read_data(args, info, subdomains): if args.debug: print(np.shape(data)) - if np.shape(data)[0] != info['nt']: - print("WARNING: subdomain", str(idx), "has an incorrect number of" - "output times (", np.shape(data)[0], "vs", info['nt'], ")") - info['nt'] = np.shape(data)[0] + if np.shape(data)[0] != info["nt"]: + print( + "WARNING: subdomain", + str(idx), + "has an incorrect number of" "output times (", + np.shape(data)[0], + "vs", + info["nt"], + ")", + ) + info["nt"] = np.shape(data)[0] # x-subdomain indices istart = subdomains[idx, 0] @@ -547,10 +579,11 @@ def read_data(args, info, subdomains): # reshape and save data time[:] = data[:, 0] - for v in range(info['nvar']): - for i in range(info['nt']): - zdata[i, jstart:jend+1, istart:iend+1, v] = \ - np.reshape(data[i, 1+v::info['nvar']], (nyl, nxl)) + for v in range(info["nvar"]): + for i in range(info["nt"]): + zdata[i, jstart : jend + 1, istart : iend + 1, v] = np.reshape( + data[i, 1 + v :: info["nvar"]], (nyl, nxl) + ) return time, xvals, yvals, zdata @@ -565,40 +598,40 @@ def plot_settings(args, info, time, xvals, yvals, zdata): import numpy as np # determine extents of plots - info['zmin'] = np.zeros(info['nvar']) - info['zmax'] = np.zeros(info['nvar']) + info["zmin"] = np.zeros(info["nvar"]) + info["zmax"] = np.zeros(info["nvar"]) - for v in range(info['nvar']): - info['zmin'][v] = np.amin(zdata[:, :, :, v]) - info['zmax'][v] = np.amax(zdata[:, :, :, v]) + for v in range(info["nvar"]): + info["zmin"][v] = np.amin(zdata[:, :, :, v]) + info["zmax"][v] = np.amax(zdata[:, :, :, v]) if args.debug: - print("z max = ", info['zmax']) - print("z min = ", info['zmin']) + print("z max = ", info["zmax"]) + print("z min = ", info["zmin"]) # which variables to plot if args.plotvars: - info['pltvars'] = args.plotvars + info["pltvars"] = args.plotvars else: - info['pltvars'] = range(info['nvar']) + info["pltvars"] = range(info["nvar"]) # which times to plot if args.plottimes: - info['plttimes'] = args.plottimes + info["plttimes"] = args.plottimes else: - info['plttimes'] = range(info['nt']) + info["plttimes"] = range(info["nt"]) # x-axis label if args.xlabel: - info['xlabel'] = args.xlabel + info["xlabel"] = args.xlabel else: - info['xlabel'] = 'x' + info["xlabel"] = "x" # y-axis label if args.ylabel: - info['ylabel'] = args.ylabel + info["ylabel"] = args.ylabel else: - info['ylabel'] = 'y' + info["ylabel"] = "y" # ----------------------------------------------------------------------------- @@ -638,50 +671,58 @@ def plot_surface(args, info, time, xvals, yvals, zdata): X, Y = np.meshgrid(xvals, yvals) # generate plots - for v in info['pltvars']: + for v in info["pltvars"]: if args.merge: mergefiles = list() - for t in info['plttimes']: + for t in info["plttimes"]: # create figure and axes fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - ax.plot_surface(X, Y, zdata[t, :, :, v], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, - shade=True) + ax = fig.add_subplot(111, projection="3d") + + ax.plot_surface( + X, + Y, + zdata[t, :, :, v], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) # set axis limits - ax.set_xlim([info['xl'], info['xu']]) - ax.set_ylim([info['yl'], info['yu']]) - ax.set_zlim(info['zmin'][v], info['zmax'][v]) + ax.set_xlim([info["xl"], info["xu"]]) + ax.set_ylim([info["yl"], info["yu"]]) + ax.set_zlim(info["zmin"][v], info["zmax"][v]) # initial perspective ax.view_init(20, -120) # add axis labels - plt.xlabel(info['xlabel']) - plt.ylabel(info['ylabel']) + plt.xlabel(info["xlabel"]) + plt.ylabel(info["ylabel"]) # add z-axis label if args.zlabel: ax.set_zlabel(args.zlabel) - elif info['varnames']: - ax.set_zlabel(info['varnames'][v]) + elif info["varnames"]: + ax.set_zlabel(info["varnames"][v]) else: - ax.set_zlabel('z') + ax.set_zlabel("z") # add title tstr = str(time[t]) if args.title: title = args.title - elif info['title']: - title = info['title'] + elif info["title"]: + title = info["title"] else: - title = 'Solution' - plt.title(title + '\nt = ' + tstr) + title = "Solution" + plt.title(title + "\nt = " + tstr) # add grid if args.grid: @@ -690,15 +731,15 @@ def plot_surface(args, info, time, xvals, yvals, zdata): # save plot to file if args.save: if args.prefix: - fname = args.prefix + '_fig_surface_' + fname = args.prefix + "_fig_surface_" else: - fname = 'fig_surface_' - if info['varnames']: - fname += info['varnames'][v] + fname = "fig_surface_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - fname += '_t_' + repr(t).zfill(3) + '.pdf' - plt.savefig(fname, bbox_inches='tight') + fname += "var_" + repr(v).zfill(3) + fname += "_t_" + repr(t).zfill(3) + ".pdf" + plt.savefig(fname, bbox_inches="tight") if args.merge: mergefiles.append(fname) else: @@ -707,14 +748,14 @@ def plot_surface(args, info, time, xvals, yvals, zdata): if args.merge: if args.prefix: - fname = args.prefix + '_fig_surface_' + fname = args.prefix + "_fig_surface_" else: - fname = 'fig_surface_' - if info['varnames']: - fname += info['varnames'][v] + fname = "fig_surface_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - fname += '.pdf' + fname += "var_" + repr(v).zfill(3) + fname += ".pdf" merge_pdf(mergefiles, fname) @@ -732,38 +773,47 @@ def plot_surface_ani(args, info, time, xvals, yvals, zdata): def update_plot(frame_number, zarray, v, plot): plot[0].remove() - plot[0] = ax.plot_surface(X, Y, zarray[frame_number, :, :, v], - cmap=cm.jet) + plot[0] = ax.plot_surface(X, Y, zarray[frame_number, :, :, v], cmap=cm.jet) tstr = str(time[frame_number]) if args.title: title = args.title - elif info['title']: - title = info['title'] + elif info["title"]: + title = info["title"] else: - title = 'Solution' - plt.title(title + '\nt = ' + tstr) + title = "Solution" + plt.title(title + "\nt = " + tstr) - return plot, + return (plot,) # set x and y meshgrid objects X, Y = np.meshgrid(xvals, yvals) # generate plots - for v in info['pltvars']: + for v in info["pltvars"]: # create figure and axes fig = plt.figure() - ax = plt.axes(projection='3d') - - plot = [ax.plot_surface(X, Y, zdata[0, :, :, v], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, - shade=True)] + ax = plt.axes(projection="3d") + + plot = [ + ax.plot_surface( + X, + Y, + zdata[0, :, :, v], + rstride=1, + cstride=1, + cmap=cm.jet, + linewidth=0, + antialiased=True, + shade=True, + ) + ] # set axis limits - ax.set_xlim([info['xl'], info['xu']]) - ax.set_ylim([info['yl'], info['yu']]) - ax.set_zlim([info['zmin'][v], info['zmax'][v]]) + ax.set_xlim([info["xl"], info["xu"]]) + ax.set_ylim([info["yl"], info["yu"]]) + ax.set_zlim([info["zmin"][v], info["zmax"][v]]) # initial perspective ax.view_init(20, -120) @@ -772,45 +822,45 @@ def update_plot(frame_number, zarray, v, plot): if args.xlabel: plt.xlabel(args.xlabel) else: - ax.set_xlabel('x') + ax.set_xlabel("x") # add y-axis label if args.ylabel: plt.ylabel(args.ylabel) else: - ax.set_ylabel('y') + ax.set_ylabel("y") # add z-axis label if args.zlabel: ax.set_zlabel(args.zlabel) - elif info['varnames']: - ax.set_zlabel(info['varnames'][v]) + elif info["varnames"]: + ax.set_zlabel(info["varnames"][v]) else: - ax.set_zlabel('z') + ax.set_zlabel("z") # add grid if args.grid: plt.grid() - fps = 2 # frame per sec + fps = 2 # frame per sec frn = len(time) # number of frames in the animation # create animation - ani = animation.FuncAnimation(fig, update_plot, frn, - fargs=(zdata, v, plot), - interval=1000/fps) + ani = animation.FuncAnimation( + fig, update_plot, frn, fargs=(zdata, v, plot), interval=1000 / fps + ) # save animation to file if args.save: if args.prefix: - fname = args.prefix + '_ani_surface_' + fname = args.prefix + "_ani_surface_" else: - fname = 'ani_surface_' - if info['varnames']: - fname += info['varnames'][v] + fname = "ani_surface_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - ani.save(fname + '.mp4', dpi=200, fps=fps) + fname += "var_" + repr(v).zfill(3) + ani.save(fname + ".mp4", dpi=200, fps=fps) else: plt.show() plt.close() @@ -830,36 +880,37 @@ def plot_contour(args, info, time, xvals, yvals, zdata): X, Y = np.meshgrid(xvals, yvals) # generate plots - for v in info['pltvars']: + for v in info["pltvars"]: - levels = np.linspace(info['zmin'][v], info['zmax'][v], 100) - ticks = np.linspace(info['zmin'][v], info['zmax'][v], 10) + levels = np.linspace(info["zmin"][v], info["zmax"][v], 100) + ticks = np.linspace(info["zmin"][v], info["zmax"][v], 10) - for t in info['plttimes']: + for t in info["plttimes"]: # create figure and axes fig, ax = plt.subplots() - cf = ax.contourf(X, Y, zdata[t, :, :, v], levels=levels, - cmap="coolwarm", extend="both") + cf = ax.contourf( + X, Y, zdata[t, :, :, v], levels=levels, cmap="coolwarm", extend="both" + ) fig.colorbar(cf, ax=ax, fraction=0.046, pad=0.04, ticks=ticks) # set axis limits - ax.set_xlim([info['xl'], info['xu']]) - ax.set_ylim([info['yl'], info['yu']]) + ax.set_xlim([info["xl"], info["xu"]]) + ax.set_ylim([info["yl"], info["yu"]]) # add axis labels - plt.xlabel(info['xlabel']) - plt.ylabel(info['ylabel']) + plt.xlabel(info["xlabel"]) + plt.ylabel(info["ylabel"]) # add title tstr = str(time[t]) if args.title: - plt.title(args.title + ' at t = ' + tstr) - elif info['title']: - plt.title(info['title'] + ' at t = ' + tstr) + plt.title(args.title + " at t = " + tstr) + elif info["title"]: + plt.title(info["title"] + " at t = " + tstr) else: - plt.title('Solution at t = ' + tstr) + plt.title("Solution at t = " + tstr) # add grid if args.grid: @@ -868,15 +919,15 @@ def plot_contour(args, info, time, xvals, yvals, zdata): # save plot to file if args.save: if args.prefix: - fname = args.prefix + '_fig_contour_' + fname = args.prefix + "_fig_contour_" else: - fname = 'fig_contour_' - if info['varnames']: - fname += info['varnames'][v] + fname = "fig_contour_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - fname += '_t_' + repr(t).zfill(3) + '.pdf' - plt.savefig(fname, bbox_inches='tight') + fname += "var_" + repr(v).zfill(3) + fname += "_t_" + repr(t).zfill(3) + ".pdf" + plt.savefig(fname, bbox_inches="tight") else: plt.show() plt.close() @@ -894,67 +945,76 @@ def plot_contour_ani(args, info, time, xvals, yvals, zdata): import matplotlib.animation as animation def update_plot(frame_number, zarray, v, plot): - plot[0] = ax.contourf(X, Y, zdata[frame_number, :, :, v], - levels=levels, cmap="coolwarm", extend="both") + plot[0] = ax.contourf( + X, + Y, + zdata[frame_number, :, :, v], + levels=levels, + cmap="coolwarm", + extend="both", + ) tstr = str(time[frame_number]) if args.title: title = args.title - elif info['title']: - title = info['title'] + elif info["title"]: + title = info["title"] else: - title = 'Solution' - plt.title(title + '\nt = ' + tstr) + title = "Solution" + plt.title(title + "\nt = " + tstr) - return plot, + return (plot,) # set x and y meshgrid objects X, Y = np.meshgrid(xvals, yvals) # generate plots - for v in info['pltvars']: + for v in info["pltvars"]: - levels = np.linspace(info['zmin'][v], info['zmax'][v], 100) - ticks = np.linspace(info['zmin'][v], info['zmax'][v], 10) + levels = np.linspace(info["zmin"][v], info["zmax"][v], 100) + ticks = np.linspace(info["zmin"][v], info["zmax"][v], 10) # create figure and axes fig, ax = plt.subplots() - plot = [ax.contourf(X, Y, zdata[0, :, :, v], levels=levels, - cmap="coolwarm", extend="both")] + plot = [ + ax.contourf( + X, Y, zdata[0, :, :, v], levels=levels, cmap="coolwarm", extend="both" + ) + ] fig.colorbar(plot[0], ax=ax, fraction=0.046, pad=0.04, ticks=ticks) # set axis limits - ax.set_xlim([info['xl'], info['xu']]) - ax.set_ylim([info['yl'], info['yu']]) + ax.set_xlim([info["xl"], info["xu"]]) + ax.set_ylim([info["yl"], info["yu"]]) # add axis labels - plt.xlabel(info['xlabel']) - plt.ylabel(info['ylabel']) + plt.xlabel(info["xlabel"]) + plt.ylabel(info["ylabel"]) # add grid if args.grid: plt.grid() - fps = 2 # frame per sec + fps = 2 # frame per sec frn = len(time) # number of frames in the animation # create animation - ani = animation.FuncAnimation(fig, update_plot, frn, - fargs=(zdata, v, plot), - interval=1000/fps) + ani = animation.FuncAnimation( + fig, update_plot, frn, fargs=(zdata, v, plot), interval=1000 / fps + ) # save animation to file if args.save: if args.prefix: - fname = args.prefix + '_ani_contour_' + fname = args.prefix + "_ani_contour_" else: - fname = 'ani_contour_' - if info['varnames']: - fname += info['varnames'][v] + fname = "ani_contour_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - ani.save(fname + '.mp4', dpi=200, fps=fps) + fname += "var_" + repr(v).zfill(3) + ani.save(fname + ".mp4", dpi=200, fps=fps) else: plt.show() plt.close() @@ -971,10 +1031,10 @@ def plot_slice_vars(args, info, time, svals, sdata, hlabel, suffix): import matplotlib.pyplot as plt # determine extents of slice plot - smin = np.zeros(info['nvar']) - smax = np.zeros(info['nvar']) + smin = np.zeros(info["nvar"]) + smax = np.zeros(info["nvar"]) - for v in range(info['nvar']): + for v in range(info["nvar"]): smin[v] = np.amin(sdata[:, :, v]) smax[v] = np.amax(sdata[:, :, v]) @@ -989,13 +1049,13 @@ def plot_slice_vars(args, info, time, svals, sdata, hlabel, suffix): label = ["%.2f" % t for t in time] # create plot for each variable - for v in info['pltvars']: + for v in info["pltvars"]: # create figure and axes fig, ax = plt.subplots() # add each output time to the plot - for t in info['plttimes']: + for t in info["plttimes"]: ax.plot(svals, sdata[t, :, v], label=label[t]) # set axis limits @@ -1012,19 +1072,19 @@ def plot_slice_vars(args, info, time, svals, sdata, hlabel, suffix): if args.zlabel: ax.set_ylabel(args.zlabel) else: - if info['varnames']: - ax.set_ylabel(info['varnames'][v]) + if info["varnames"]: + ax.set_ylabel(info["varnames"][v]) else: - ax.set_ylabel('variable ' + repr(v)) + ax.set_ylabel("variable " + repr(v)) # add title if args.title: plt.title(args.title + suffix) - elif info['title']: - plt.title(info['title'] + suffix) + elif info["title"]: + plt.title(info["title"] + suffix) else: - if info['varnames']: - plt.title("Evolution of " + info['varnames'][v] + suffix) + if info["varnames"]: + plt.title("Evolution of " + info["varnames"][v] + suffix) else: plt.title("Evolution of variable " + repr(v) + suffix) @@ -1035,14 +1095,14 @@ def plot_slice_vars(args, info, time, svals, sdata, hlabel, suffix): # save plot to file if args.save: if args.prefix: - fname = args.prefix + '_fig_slice_' + fname = args.prefix + "_fig_slice_" else: - fname = 'fig_slice_' - if info['varnames']: - fname += info['varnames'][v] + fname = "fig_slice_" + if info["varnames"]: + fname += info["varnames"][v] else: - fname += 'var_' + repr(v).zfill(3) - plt.savefig(fname + '.pdf', bbox_inches='tight') + fname += "var_" + repr(v).zfill(3) + plt.savefig(fname + ".pdf", bbox_inches="tight") else: plt.show() plt.close() @@ -1069,19 +1129,19 @@ def plot_slice_time(args, info, time, svals, sdata, hlabel, suffix): # set labels for the plot legend if args.labels: label = args.labels - elif info['varnames']: - label = info['varnames'] + elif info["varnames"]: + label = info["varnames"] else: - label = [None] * info['nvar'] + label = [None] * info["nvar"] # create plot for each variable - for t in info['plttimes']: + for t in info["plttimes"]: # create figure and axes fig, ax = plt.subplots() # add each output time to the plot - for v in info['pltvars']: + for v in info["pltvars"]: ax.plot(svals, sdata[t, :, v], label=label[v]) # set axis limits @@ -1101,11 +1161,11 @@ def plot_slice_time(args, info, time, svals, sdata, hlabel, suffix): # add title tstr = str(time[t]) if args.title: - plt.title(args.title + suffix + ' and t = ' + tstr) - elif info['title']: - plt.title(info['title'] + suffix + ' and t = ' + tstr) + plt.title(args.title + suffix + " and t = " + tstr) + elif info["title"]: + plt.title(info["title"] + suffix + " and t = " + tstr) else: - plt.title("Evolution" + suffix + ' and t = ' + tstr) + plt.title("Evolution" + suffix + " and t = " + tstr) # add grid if args.grid: @@ -1114,11 +1174,11 @@ def plot_slice_time(args, info, time, svals, sdata, hlabel, suffix): # save plot to file if args.save: if args.prefix: - fname = args.prefix + '_fig_slice_t_' + fname = args.prefix + "_fig_slice_t_" else: - fname = 'fig_slice_t_' - fname += repr(t).zfill(3) + '.pdf' - plt.savefig(fname, bbox_inches='tight') + fname = "fig_slice_t_" + fname += repr(t).zfill(3) + ".pdf" + plt.savefig(fname, bbox_inches="tight") else: plt.show() plt.close() @@ -1136,16 +1196,16 @@ def plot_point(args, info, time, pdata, suffix): # set labels for the plot legend if args.labels: label = args.labels - elif info['varnames']: - label = info['varnames'] + elif info["varnames"]: + label = info["varnames"] else: - label = [None] * info['nvar'] + label = [None] * info["nvar"] # create figure and axes fig, ax = plt.subplots() # create plot for each variable - for v in info['pltvars']: + for v in info["pltvars"]: ax.plot(time, pdata[:, v], label=label[v]) # add legend @@ -1157,8 +1217,8 @@ def plot_point(args, info, time, pdata, suffix): # add title if args.title: plt.title(args.title + suffix) - elif info['title']: - plt.title(info['title'] + suffix) + elif info["title"]: + plt.title(info["title"] + suffix) else: plt.title("Evolution" + suffix) @@ -1169,10 +1229,10 @@ def plot_point(args, info, time, pdata, suffix): # save plot to file if args.save: if args.prefix: - fname = args.prefix + '_fig_point' + fname = args.prefix + "_fig_point" else: - fname = 'fig_point' - plt.savefig(fname + '.pdf', bbox_inches='tight') + fname = "fig_point" + plt.savefig(fname + ".pdf", bbox_inches="tight") else: plt.show() plt.close() @@ -1183,6 +1243,7 @@ def plot_point(args, info, time, pdata, suffix): # ----------------------------------------------------------------------------- -if __name__ == '__main__': +if __name__ == "__main__": import sys + sys.exit(main()) diff --git a/examples/utilities/plot_data_time_series.py b/examples/utilities/plot_data_time_series.py index f96aeec538..02e3c34f7c 100755 --- a/examples/utilities/plot_data_time_series.py +++ b/examples/utilities/plot_data_time_series.py @@ -31,6 +31,7 @@ # output time. # ----------------------------------------------------------------------------- + # ----------------------------------------------------------------------------- # main routine # ----------------------------------------------------------------------------- @@ -41,50 +42,46 @@ def main(): import numpy as np import shlex - parser = argparse.ArgumentParser(description='''Plot data files''') + parser = argparse.ArgumentParser(description="""Plot data files""") - parser.add_argument('quantity', type=str, - help='''Quantity to plot''') + parser.add_argument("quantity", type=str, help="""Quantity to plot""") - parser.add_argument('datafiles', type=str, nargs='+', - help='''Data files to plot''') + parser.add_argument("datafiles", type=str, nargs="+", help="""Data files to plot""") # Plot display options - parser.add_argument('--save', action='store_true', - help='''Save figure to file''') + parser.add_argument("--save", action="store_true", help="""Save figure to file""") - parser.add_argument('--labels', type=str, nargs='+', - help='''Data file labels for plot legend''') + parser.add_argument( + "--labels", type=str, nargs="+", help="""Data file labels for plot legend""" + ) - parser.add_argument('--title', type=str, - help='''Plot title''') + parser.add_argument("--title", type=str, help="""Plot title""") - parser.add_argument('--xlabel', type=str, - help='''x-axis label''') + parser.add_argument("--xlabel", type=str, help="""x-axis label""") - parser.add_argument('--ylabel', type=str, - help='''y-axis label''') + parser.add_argument("--ylabel", type=str, help="""y-axis label""") - parser.add_argument('--grid', action='store_true', - help='''Add grid to plot''') + parser.add_argument("--grid", action="store_true", help="""Add grid to plot""") # Axis scaling logscale = parser.add_mutually_exclusive_group() - logscale.add_argument('--logx', action='store_true', - help='''Plot with log scale x-axis''') + logscale.add_argument( + "--logx", action="store_true", help="""Plot with log scale x-axis""" + ) - logscale.add_argument('--logy', action='store_true', - help='''Plot with log scale y-axis''') + logscale.add_argument( + "--logy", action="store_true", help="""Plot with log scale y-axis""" + ) - logscale.add_argument('--loglog', action='store_true', - help='''Use log scale x and y axes''') + logscale.add_argument( + "--loglog", action="store_true", help="""Use log scale x and y axes""" + ) # Debugging options - parser.add_argument('--debug', action='store_true', - help='Enable debugging') + parser.add_argument("--debug", action="store_true", help="Enable debugging") # Parse command line args args = parser.parse_args() @@ -132,33 +129,49 @@ def main(): print(data) # Extract t and q data - tdata = data[:,0] # first column has t values - qdata = data[:,idx] # remaining columns have q values + tdata = data[:, 0] # first column has t values + qdata = data[:, idx] # remaining columns have q values # line colors: matplotlib.org/stable/tutorials/colors/colormaps.html # and colorbrewer2.org) if len(args.datafiles) < 22: - colors = ["#d62728", "#1f77b4", "#2ca02c", "#9467bd", "#ff7f0e", - "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf", - "#000000", "#ff9896", "#aec7e8", "#98df8a", "#c5b0d5", - "#ffbb78", "#c49c94", "#f7b6d2", "#c7c7c7", "#dbdb8d", - "#9edae5"] + colors = [ + "#d62728", + "#1f77b4", + "#2ca02c", + "#9467bd", + "#ff7f0e", + "#8c564b", + "#e377c2", + "#7f7f7f", + "#bcbd22", + "#17becf", + "#000000", + "#ff9896", + "#aec7e8", + "#98df8a", + "#c5b0d5", + "#ffbb78", + "#c49c94", + "#f7b6d2", + "#c7c7c7", + "#dbdb8d", + "#9edae5", + ] else: print("ERROR: ncols > ncolors") sys.exit() # Set plot label for legend - if (args.labels): - label=args.labels[i] + if args.labels: + label = args.labels[i] else: - label=None + label = None if args.logx or args.logy or args.loglog: - ax.plot(tdata, np.abs(qdata), label=label, - color=colors[i]) + ax.plot(tdata, np.abs(qdata), label=label, color=colors[i]) else: - ax.plot(tdata, qdata, label=label, - color=colors[i]) + ax.plot(tdata, qdata, label=label, color=colors[i]) # Change axis scale if args.logx: @@ -183,7 +196,7 @@ def main(): if args.ylabel: plt.ylabel(args.ylabel) else: - plt.ylabel(args.quantity.replace("_"," ")); + plt.ylabel(args.quantity.replace("_", " ")) # Add legend if args.labels: @@ -199,10 +212,12 @@ def main(): else: plt.show() + # ----------------------------------------------------------------------------- # run the main routine # ----------------------------------------------------------------------------- -if __name__ == '__main__': +if __name__ == "__main__": import sys + sys.exit(main()) diff --git a/scripts/format.sh b/scripts/format.sh index b145adcfad..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,7 +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/arkode_arkstep.c b/src/arkode/arkode_arkstep.c index 5f91285edb..4f6e403ccf 100644 --- a/src/arkode/arkode_arkstep.c +++ b/src/arkode/arkode_arkstep.c @@ -2254,7 +2254,7 @@ int arkStep_SetButcherTables(ARKodeMem ark_mem) { switch (step_mem->q) { - case (1): itable = ARKSTEP_DEFAULT_ERK_1; break; + case (1): etable = ARKSTEP_DEFAULT_ERK_1; break; case (2): etable = ARKSTEP_DEFAULT_ERK_2; break; case (3): etable = ARKSTEP_DEFAULT_ERK_3; break; case (4): etable = ARKSTEP_DEFAULT_ERK_4; break; 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/compare_benchmarks.py b/test/compare_benchmarks.py index 2df5e7249e..1f76c60519 100644 --- a/test/compare_benchmarks.py +++ b/test/compare_benchmarks.py @@ -22,19 +22,55 @@ def main(): - parser = argparse.ArgumentParser(description='Compare Sundials performance results against previous results') - - parser.add_argument('--release', dest='release', action='store_true', help='indicate if the current run to process is a release') - - parser.add_argument('--calidir', dest='caliDir', type=str, help='path to directory containing caliper files', default="/usr/workspace/sundials/califiles") - - parser.add_argument('--releasedir', dest='releaseDir', type=str, help='path to directory containing release caliper files', default="/usr/workspace/sundials/califiles/Release") - - parser.add_argument('--outpath', dest='outPath', type=str, help='path to directory to write results to', default="/dev/null") - - parser.add_argument('--jobid', dest='jobID', type=int, help='job id of the current run to identify .cali files') - - parser.add_argument('--threshold', dest="threshold", type=float, help='the percentage threshold in performance difference that indicates a regression', default=2.0) + parser = argparse.ArgumentParser( + description="Compare Sundials performance results against previous results" + ) + + parser.add_argument( + "--release", + dest="release", + action="store_true", + help="indicate if the current run to process is a release", + ) + + parser.add_argument( + "--calidir", + dest="caliDir", + type=str, + help="path to directory containing caliper files", + default="/usr/workspace/sundials/califiles", + ) + + parser.add_argument( + "--releasedir", + dest="releaseDir", + type=str, + help="path to directory containing release caliper files", + default="/usr/workspace/sundials/califiles/Release", + ) + + parser.add_argument( + "--outpath", + dest="outPath", + type=str, + help="path to directory to write results to", + default="/dev/null", + ) + + parser.add_argument( + "--jobid", + dest="jobID", + type=int, + help="job id of the current run to identify .cali files", + ) + + parser.add_argument( + "--threshold", + dest="threshold", + type=float, + help="the percentage threshold in performance difference that indicates a regression", + default=2.0, + ) args = parser.parse_args() @@ -50,38 +86,42 @@ def main(): if not os.path.exists(outPath): os.makedirs(outPath) - outFile = open("%s/benchmark_output.out" % outPath, 'w') + outFile = open("%s/benchmark_output.out" % outPath, "w") # thread per file with mp.Pool() as pool: - for res in pool.starmap(process_benchmark, [(jobID, release, releaseDir, i, threshold) for i in benchFiles]): + for res in pool.starmap( + process_benchmark, + [(jobID, release, releaseDir, i, threshold) for i in benchFiles], + ): if res: outFile.write(res + "\n") outFile.close() - outFile = open("%s/benchmark_output.out" % outPath, 'r') + outFile = open("%s/benchmark_output.out" % outPath, "r") try: outLines = outFile.readlines() finally: outFile.close() - if (len(outLines) == 0): + if len(outLines) == 0: return -1 return 0 + def process_benchmark(jobID, isRelease, releaseDir, benchmarkDir, threshold): # Get the current benchmark run benchmarkFiles = glob.glob("%s/*.cali" % benchmarkDir) # Don't compare if the run didn't include this benchmark - if (len(benchmarkFiles) == 0): + if len(benchmarkFiles) == 0: return th_files = tt.Thicket.from_caliperreader(benchmarkFiles) - curFilter = lambda x: x['job_id'] == jobID + curFilter = lambda x: x["job_id"] == jobID th_current = th_files.filter_metadata(curFilter) # Get the release caliper file - cluster = th_current.metadata['cluster'].values[0] + cluster = th_current.metadata["cluster"].values[0] if isRelease: # Get the last release versionDirs = glob.glob("%s/%s/*" % (releaseDir, cluster)) @@ -89,18 +129,23 @@ def process_benchmark(jobID, isRelease, releaseDir, benchmarkDir, threshold): versionDir = versionDirs[1] else: # Get the release the run is a part of - version = th_current.metadata['sundials_version'].values[0] + version = th_current.metadata["sundials_version"].values[0] versionDir = "%s/%s/%s" % (releaseDir, cluster, version) - benchmarkName = th_current.metadata['env.TEST_NAME'].values[0] - releaseFile = glob.glob("%s/Benchmarking/*/%s/*.cali" % (versionDir, benchmarkName), recursive=True) + benchmarkName = th_current.metadata["env.TEST_NAME"].values[0] + releaseFile = glob.glob( + "%s/Benchmarking/*/%s/*.cali" % (versionDir, benchmarkName), recursive=True + ) th_compare = tt.Thicket.from_caliperreader(releaseFile) - metrics = ['Max time/rank'] + metrics = ["Max time/rank"] tt.mean(th_current, columns=metrics) tt.mean(th_compare, columns=metrics) - ratio = th_current.statsframe.dataframe['Max time/rank_mean'] / th_compare.statsframe.dataframe['Max time/rank_mean'] + ratio = ( + th_current.statsframe.dataframe["Max time/rank_mean"] + / th_compare.statsframe.dataframe["Max time/rank_mean"] + ) - tolerance = threshold/100 + tolerance = threshold / 100 if 1 - ratio[0] < tolerance: return benchmarkName diff --git a/test/compare_examples.py b/test/compare_examples.py index 046b9d620b..3383fa91f6 100644 --- a/test/compare_examples.py +++ b/test/compare_examples.py @@ -27,18 +27,50 @@ import hatchet as ht import thicket as tt -def main(): - parser = argparse.ArgumentParser(description='Compare Sundials performance results against previous results') - - parser.add_argument('--release', dest='release', action='store_true', help='indicate if the current run to process is a release') - - parser.add_argument('--calidir', dest='caliDir', type=str, help='path to directory containing caliper files', default="/usr/workspace/sundials/califiles") - - parser.add_argument('--releasedir', dest='releaseDir', type=str, help='path to directory containing release caliper files', default="/usr/workspace/sundials/califiles/Release") - parser.add_argument('--outpath', dest='outPath', type=str, help='path to directory to write results to', default="/dev/null") - - parser.add_argument('--threshold', dest="threshold", type=float, help='the percentage threshold in performance difference that indicates a regression', default=2.0) +def main(): + parser = argparse.ArgumentParser( + description="Compare Sundials performance results against previous results" + ) + + parser.add_argument( + "--release", + dest="release", + action="store_true", + help="indicate if the current run to process is a release", + ) + + parser.add_argument( + "--calidir", + dest="caliDir", + type=str, + help="path to directory containing caliper files", + default="/usr/workspace/sundials/califiles", + ) + + parser.add_argument( + "--releasedir", + dest="releaseDir", + type=str, + help="path to directory containing release caliper files", + default="/usr/workspace/sundials/califiles/Release", + ) + + parser.add_argument( + "--outpath", + dest="outPath", + type=str, + help="path to directory to write results to", + default="/dev/null", + ) + + parser.add_argument( + "--threshold", + dest="threshold", + type=float, + help="the percentage threshold in performance difference that indicates a regression", + default=2.0, + ) args = parser.parse_args() @@ -49,13 +81,13 @@ def main(): threshold = args.threshold # Get the latest test run - runDirs = glob.glob("%s/Testing/*" % caliDir, recursive = True) + runDirs = glob.glob("%s/Testing/*" % caliDir, recursive=True) runDirs.sort(key=os.path.getmtime, reverse=True) runDir = runDirs[0] runFile = glob.glob(runDir)[0] th_temp = tt.Thicket.from_caliperreader(runFile) - cluster = th_temp.metadata['cluster'] + cluster = th_temp.metadata["cluster"] # get machine from the file if release: # Compare against the last release @@ -64,7 +96,7 @@ def main(): versionDir = versionDirs[1] else: # Compare against the release the run is a part of - version = th_temp.metadata['sundials_version'].values[0] + version = th_temp.metadata["sundials_version"].values[0] versionDir = "%s/%s/%s" % (releaseDir, cluster, version) # Gather files to process @@ -72,22 +104,24 @@ def main(): if not os.path.exists(outPath): os.makedirs(outPath) - outFile = open("%s/output.out" % outPath, 'w') + outFile = open("%s/output.out" % outPath, "w") # Compare test results against past runs. If a test performs below a threshold, output test name to outFile. with mp.Pool() as pool: - for res in pool.starmap(compare_against_release, [(versionDir, i, threshold) for i in runFiles]): + for res in pool.starmap( + compare_against_release, [(versionDir, i, threshold) for i in runFiles] + ): if res: outFile.write(res + "\n") outFile.close() - outFile = open("%s/example_output.out" % outPath, 'r') + outFile = open("%s/example_output.out" % outPath, "r") try: outLines = outFile.readlines() finally: outFile.close() - if (len(outLines) == 0): + if len(outLines) == 0: return -1 return 0 @@ -95,21 +129,27 @@ def main(): def compare_against_release(releaseDir, file, threshold): th = tt.Thicket.from_caliperreader(file) - testName = th.metadata['env.TEST_NAME'].values[0] + testName = th.metadata["env.TEST_NAME"].values[0] # Gather release run - releaseFile = glob.glob("%s/Testing/*/%s.*.cali" % (releaseDir, testName), recursive=True) + releaseFile = glob.glob( + "%s/Testing/*/%s.*.cali" % (releaseDir, testName), recursive=True + ) th_release = tt.Thicket.from_caliperreader(releaseFile) - metrics = ['Max time/rank'] + metrics = ["Max time/rank"] tt.mean(th_release, columns=metrics) tt.mean(th, columns=metrics) - ratio = th.statsframe.dataframe['Max time/rank_mean'] / th_release.statsframe.dataframe['Max time/rank_mean'] + ratio = ( + th.statsframe.dataframe["Max time/rank_mean"] + / th_release.statsframe.dataframe["Max time/rank_mean"] + ) print(ratio[0]) - tolerance = threshold/100 + tolerance = threshold / 100 if 1 - ratio[0] < tolerance: return testName + if __name__ == "__main__": main() diff --git a/test/config_cmake.py b/test/config_cmake.py index e916d1bcc0..f1574b6257 100644 --- a/test/config_cmake.py +++ b/test/config_cmake.py @@ -21,109 +21,252 @@ def main(): import argparse - parser = argparse.ArgumentParser(description='''Create a SUNDIALS CMake - cache file''') - - parser.add_argument('--filetype', type=str, choices=['cache', 'script'], - default='cache', - help='''Create a CMake cache file or configuration - script (default cache)''') - - parser.add_argument('--filename', type=str, default="sundials.cmake", - help='''Set the cache file or script name (default - sundials.cmake)''') - - parser.add_argument('--readenv', action='store_true', - help='''Read environment variables (command line + parser = argparse.ArgumentParser( + description="""Create a SUNDIALS CMake + cache file""" + ) + + parser.add_argument( + "--filetype", + type=str, + choices=["cache", "script"], + default="cache", + help="""Create a CMake cache file or configuration + script (default cache)""", + ) + + parser.add_argument( + "--filename", + type=str, + default="sundials.cmake", + help="""Set the cache file or script name (default + sundials.cmake)""", + ) + + parser.add_argument( + "--readenv", + action="store_true", + help="""Read environment variables (command line arguments will override any settings from the - environment variables)''') + environment variables)""", + ) - parser.add_argument('--debugscript', action='store_true', - help='Enable debugging output for this script') + parser.add_argument( + "--debugscript", + action="store_true", + help="Enable debugging output for this script", + ) # ----------------- # Compiler Options # ----------------- - group = parser.add_argument_group('Compilers and Flags', - '''Options for setting the C, C++, - Fortran, and CUDA compiler and flags.''') + group = parser.add_argument_group( + "Compilers and Flags", + """Options for setting the C, C++, + Fortran, and CUDA compiler and flags.""", + ) # Build type - add_arg(group, '--build-type', 'CMAKE_BUILD_TYPE', 'CMAKE_BUILD_TYPE', - 'RelWithDebInfo', 'STRING', - 'CMake build type (Debug, RelWithDebInfo, Release)') + add_arg( + group, + "--build-type", + "CMAKE_BUILD_TYPE", + "CMAKE_BUILD_TYPE", + "RelWithDebInfo", + "STRING", + "CMake build type (Debug, RelWithDebInfo, Release)", + ) # C compiler - add_arg(group, '--c-compiler', 'CC', 'CMAKE_C_COMPILER', None, 'FILEPATH', - 'C compiler') - - add_arg(group, '--c-flags', 'CFLAGS', 'CMAKE_C_FLAGS', None, 'STRING', - 'C compiler flags') - - add_arg(group, '--c-std', 'CMAKE_C_STANDARD', 'CMAKE_C_STANDARD', '99', - 'STRING', 'C standard') - - add_arg(group, '--c-ext', 'CMAKE_C_EXTENSIONS', 'CMAKE_C_EXTENSIONS', - 'OFF', 'STRING', 'C compiler extensions') + add_arg( + group, "--c-compiler", "CC", "CMAKE_C_COMPILER", None, "FILEPATH", "C compiler" + ) + + add_arg( + group, + "--c-flags", + "CFLAGS", + "CMAKE_C_FLAGS", + None, + "STRING", + "C compiler flags", + ) + + add_arg( + group, + "--c-std", + "CMAKE_C_STANDARD", + "CMAKE_C_STANDARD", + "99", + "STRING", + "C standard", + ) + + add_arg( + group, + "--c-ext", + "CMAKE_C_EXTENSIONS", + "CMAKE_C_EXTENSIONS", + "OFF", + "STRING", + "C compiler extensions", + ) # C++ compiler - add_arg(group, '--cxx-compiler', 'CXX', 'CMAKE_CXX_COMPILER', None, - 'FILEPATH', 'C++ compiler') - - add_arg(group, '--cxx-flags', 'CXXFLAGS', 'CMAKE_CXX_FLAGS', None, - 'STRING', 'C++ compiler flags') - - add_arg(group, '--cxx-std', 'CMAKE_CXX_STANDARD', 'CMAKE_CXX_STANDARD', - '14', 'STRING', 'C++ standard') - - add_arg(group, '--cxx-ext', 'CMAKE_CXX_EXTENSIONS', 'CMAKE_CXX_EXTENSIONS', - 'OFF', 'STRING', 'C++ compiler extensions') + add_arg( + group, + "--cxx-compiler", + "CXX", + "CMAKE_CXX_COMPILER", + None, + "FILEPATH", + "C++ compiler", + ) + + add_arg( + group, + "--cxx-flags", + "CXXFLAGS", + "CMAKE_CXX_FLAGS", + None, + "STRING", + "C++ compiler flags", + ) + + add_arg( + group, + "--cxx-std", + "CMAKE_CXX_STANDARD", + "CMAKE_CXX_STANDARD", + "14", + "STRING", + "C++ standard", + ) + + add_arg( + group, + "--cxx-ext", + "CMAKE_CXX_EXTENSIONS", + "CMAKE_CXX_EXTENSIONS", + "OFF", + "STRING", + "C++ compiler extensions", + ) # Fortran compiler - add_arg(group, '--fortran-compiler', 'FC', 'CMAKE_Fortran_COMPILER', None, - 'FILEPATH', 'Fortran compiler') - - add_arg(group, '--fortran-flags', 'FFLAGS', 'CMAKE_Fortran_FLAGS', None, - 'STRING', 'Fortran compiler flags') + add_arg( + group, + "--fortran-compiler", + "FC", + "CMAKE_Fortran_COMPILER", + None, + "FILEPATH", + "Fortran compiler", + ) + + add_arg( + group, + "--fortran-flags", + "FFLAGS", + "CMAKE_Fortran_FLAGS", + None, + "STRING", + "Fortran compiler flags", + ) # CUDA compiler - add_arg(group, '--cuda-compiler', 'CUDACXX', 'CMAKE_CUDA_COMPILER', None, - 'FILEPATH', 'CUDA compiler') - - add_arg(group, '--cuda-flags', 'CUDAFLAGS', 'CMAKE_CUDA_FLAGS', None, - 'STRING', 'CUDA compiler flags') - - add_arg(group, '--cuda-std', 'CMAKE_CUDA_STANDARD', 'CMAKE_CUDA_STANDARD', - '14', 'STRING', 'CUDA standard') - - add_arg(group, '--cuda-arch', 'CUDAARCHS', 'CMAKE_CUDA_ARCHITECTURES', - None, 'STRING', 'CUDA architecture') + add_arg( + group, + "--cuda-compiler", + "CUDACXX", + "CMAKE_CUDA_COMPILER", + None, + "FILEPATH", + "CUDA compiler", + ) + + add_arg( + group, + "--cuda-flags", + "CUDAFLAGS", + "CMAKE_CUDA_FLAGS", + None, + "STRING", + "CUDA compiler flags", + ) + + add_arg( + group, + "--cuda-std", + "CMAKE_CUDA_STANDARD", + "CMAKE_CUDA_STANDARD", + "14", + "STRING", + "CUDA standard", + ) + + add_arg( + group, + "--cuda-arch", + "CUDAARCHS", + "CMAKE_CUDA_ARCHITECTURES", + None, + "STRING", + "CUDA architecture", + ) # Additional compiler options - add_arg(group, '--Wall', 'SUNDIALS_ENABLE_ALL_WARNINGS', - 'ENABLE_ALL_WARNINGS', 'OFF', 'BOOL', - 'Enable all compiler warnings') - - add_arg(group, '--Werror', 'SUNDIALS_ENABLE_WARNINGS_AS_ERRORS', - 'ENABLE_WARNINGS_AS_ERRORS', 'OFF', 'BOOL', - 'Enable compiler warnings as errors') - - add_arg(group, '--address-sanitizer', 'SUNDIALS_ENABLE_ADDRESS_SANITIZER', - 'ENABLE_ADDRESS_SANITIZER', 'OFF', 'BOOL', - 'Enable address sanitizer') + add_arg( + group, + "--Wall", + "SUNDIALS_ENABLE_ALL_WARNINGS", + "ENABLE_ALL_WARNINGS", + "OFF", + "BOOL", + "Enable all compiler warnings", + ) + + add_arg( + group, + "--Werror", + "SUNDIALS_ENABLE_WARNINGS_AS_ERRORS", + "ENABLE_WARNINGS_AS_ERRORS", + "OFF", + "BOOL", + "Enable compiler warnings as errors", + ) + + add_arg( + group, + "--address-sanitizer", + "SUNDIALS_ENABLE_ADDRESS_SANITIZER", + "ENABLE_ADDRESS_SANITIZER", + "OFF", + "BOOL", + "Enable address sanitizer", + ) # ---------------- # Install Options # ---------------- - group = parser.add_argument_group('Install Options', - '''Options for where SUNDIALS should be - installed.''') + group = parser.add_argument_group( + "Install Options", + """Options for where SUNDIALS should be + installed.""", + ) # install prefix - add_arg(group, '--install-prefix', 'SUNDIALS_INSTALL_PREFIX', - 'CMAKE_INSTALL_PREFIX', None, 'PATH', 'SUNDIALS install location') + add_arg( + group, + "--install-prefix", + "SUNDIALS_INSTALL_PREFIX", + "CMAKE_INSTALL_PREFIX", + None, + "PATH", + "SUNDIALS install location", + ) # library directory @@ -131,148 +274,333 @@ def main(): # Debugging Options # ------------------ - group = parser.add_argument_group('Debugging Options', - '''Options debugging SUNDIALS.''') - - add_arg(group, '--debug', 'SUNDIALS_DEBUG', 'SUNDIALS_DEBUG', 'OFF', - 'BOOL', 'SUNDIALS debugging output') - - add_arg(group, '--debug-assert', 'SUNDIALS_DEBUG_ASSERT', - 'SUNDIALS_DEBUG_ASSERT', 'OFF', 'BOOL', - 'SUNDIALS debugging asserts', dependson='--debug') - - add_arg(group, '--debug-cuda', 'SUNDIALS_DEBUG_CUDA_LASTERROR', - 'SUNDIALS_DEBUG_CUDA_LASTERROR', 'OFF', 'BOOL', - 'SUNDIALS debugging cuda errors', dependson='--debug') - - add_arg(group, '--debug-hip', 'SUNDIALS_DEBUG_HIP_LASTERROR', - 'SUNDIALS_DEBUG_HIP_LASTERROR', 'OFF', 'BOOL', - 'SUNDIALS debugging hip errors', dependson='--debug') - - add_arg(group, '--debug-printvec', 'SUNDIALS_DEBUG_PRINTVEC', - 'SUNDIALS_DEBUG_PRINTVEC', 'OFF', 'BOOL', - 'SUNDIALS debugging vector output', dependson='--debug') + group = parser.add_argument_group( + "Debugging Options", """Options debugging SUNDIALS.""" + ) + + add_arg( + group, + "--debug", + "SUNDIALS_DEBUG", + "SUNDIALS_DEBUG", + "OFF", + "BOOL", + "SUNDIALS debugging output", + ) + + add_arg( + group, + "--debug-assert", + "SUNDIALS_DEBUG_ASSERT", + "SUNDIALS_DEBUG_ASSERT", + "OFF", + "BOOL", + "SUNDIALS debugging asserts", + dependson="--debug", + ) + + add_arg( + group, + "--debug-cuda", + "SUNDIALS_DEBUG_CUDA_LASTERROR", + "SUNDIALS_DEBUG_CUDA_LASTERROR", + "OFF", + "BOOL", + "SUNDIALS debugging cuda errors", + dependson="--debug", + ) + + add_arg( + group, + "--debug-hip", + "SUNDIALS_DEBUG_HIP_LASTERROR", + "SUNDIALS_DEBUG_HIP_LASTERROR", + "OFF", + "BOOL", + "SUNDIALS debugging hip errors", + dependson="--debug", + ) + + add_arg( + group, + "--debug-printvec", + "SUNDIALS_DEBUG_PRINTVEC", + "SUNDIALS_DEBUG_PRINTVEC", + "OFF", + "BOOL", + "SUNDIALS debugging vector output", + dependson="--debug", + ) # -------------- # Library Types # -------------- - group = parser.add_argument_group('Library Type Options', - '''Options to specify if shared and/or - static libraries are build.''') - add_arg(group, '--static', 'SUNDIALS_STATIC_LIBRARIES', - 'BUILD_STATIC_LIBS', 'ON', 'BOOL', - 'Build static SUNDIALS libraries') - - add_arg(group, '--shared', 'SUNDIALS_SHARED_LIBRARIES', - 'BUILD_SHARED_LIBS', 'ON', 'BOOL', - 'Build shared SUNDIALS libraries') + group = parser.add_argument_group( + "Library Type Options", + """Options to specify if shared and/or + static libraries are build.""", + ) + add_arg( + group, + "--static", + "SUNDIALS_STATIC_LIBRARIES", + "BUILD_STATIC_LIBS", + "ON", + "BOOL", + "Build static SUNDIALS libraries", + ) + + add_arg( + group, + "--shared", + "SUNDIALS_SHARED_LIBRARIES", + "BUILD_SHARED_LIBS", + "ON", + "BOOL", + "Build shared SUNDIALS libraries", + ) # --------- # Packages # --------- # packages TODO(DJG): Add support for ONLY option - group = parser.add_argument_group('SUNDIALS Packages', - '''Options to specify which SUNDIALS - packages should be built.''') - add_arg(group, '--arkode', 'SUNDIALS_ARKODE', 'BUILD_ARKODE', 'ON', 'BOOL', - 'Build the ARKODE library') - - add_arg(group, '--cvode', 'SUNDIALS_CVODE', 'BUILD_CVODE', 'ON', 'BOOL', - 'Build the CVODE library') - - add_arg(group, '--cvodes', 'SUNDIALS_CVODES', 'BUILD_CVODES', 'ON', 'BOOL', - 'Build the CVODES library') - - add_arg(group, '--ida', 'SUNDIALS_IDA', 'BUILD_IDA', 'ON', 'BOOL', - 'Build the IDA library') - - add_arg(group, '--idas', 'SUNDIALS_IDAS', 'BUILD_IDAS', 'ON', 'BOOL', - 'Build the IDAS library') - - add_arg(group, '--kinsol', 'SUNDIALS_KINSOL', 'BUILD_KINSOL', 'ON', 'BOOL', - 'Build the KINSOL library') + group = parser.add_argument_group( + "SUNDIALS Packages", + """Options to specify which SUNDIALS + packages should be built.""", + ) + add_arg( + group, + "--arkode", + "SUNDIALS_ARKODE", + "BUILD_ARKODE", + "ON", + "BOOL", + "Build the ARKODE library", + ) + + add_arg( + group, + "--cvode", + "SUNDIALS_CVODE", + "BUILD_CVODE", + "ON", + "BOOL", + "Build the CVODE library", + ) + + add_arg( + group, + "--cvodes", + "SUNDIALS_CVODES", + "BUILD_CVODES", + "ON", + "BOOL", + "Build the CVODES library", + ) + + add_arg( + group, + "--ida", + "SUNDIALS_IDA", + "BUILD_IDA", + "ON", + "BOOL", + "Build the IDA library", + ) + + add_arg( + group, + "--idas", + "SUNDIALS_IDAS", + "BUILD_IDAS", + "ON", + "BOOL", + "Build the IDAS library", + ) + + add_arg( + group, + "--kinsol", + "SUNDIALS_KINSOL", + "BUILD_KINSOL", + "ON", + "BOOL", + "Build the KINSOL library", + ) # ----------------- # Packages Options # ----------------- - group = parser.add_argument_group('SUNDIALS Package Options', - '''Options for configuring SUNDIALS types + group = parser.add_argument_group( + "SUNDIALS Package Options", + """Options for configuring SUNDIALS types and enabling special compile time - features.''') + features.""", + ) # index size - add_arg(group, '--indexsize', 'SUNDIALS_INDEX_SIZE', 'SUNDIALS_INDEX_SIZE', - '64', 'STRING', 'index size', choices=['32', '64']) + add_arg( + group, + "--indexsize", + "SUNDIALS_INDEX_SIZE", + "SUNDIALS_INDEX_SIZE", + "64", + "STRING", + "index size", + choices=["32", "64"], + ) # precision - add_arg(group, '--precision', 'SUNDIALS_PRECISION', 'SUNDIALS_PRECISION', - 'double', 'STRING', 'real type precision', - choices=['single', 'double', 'extended']) + add_arg( + group, + "--precision", + "SUNDIALS_PRECISION", + "SUNDIALS_PRECISION", + "double", + "STRING", + "real type precision", + choices=["single", "double", "extended"], + ) # monitoring - add_arg(group, '--monitoring', 'SUNDIALS_MONITORING', - 'SUNDIALS_BUILD_WITH_MONITORING', 'OFF', 'BOOL', - 'integrator and solver monitoring') + add_arg( + group, + "--monitoring", + "SUNDIALS_MONITORING", + "SUNDIALS_BUILD_WITH_MONITORING", + "OFF", + "BOOL", + "integrator and solver monitoring", + ) # profiling - add_arg(group, '--profiling', 'SUNDIALS_PROFILING', - 'SUNDIALS_BUILD_WITH_PROFILING', 'OFF', 'BOOL', - 'fine-grained profiling') - - add_arg(group, '--logging-level', 'SUNDIALS_LOGGING_LEVEL', - 'SUNDIALS_LOGGING_LEVEL', '0', 'STRING', - 'logging', choices=['0', '1', '2', '3', '4', '5']) + add_arg( + group, + "--profiling", + "SUNDIALS_PROFILING", + "SUNDIALS_BUILD_WITH_PROFILING", + "OFF", + "BOOL", + "fine-grained profiling", + ) + + add_arg( + group, + "--logging-level", + "SUNDIALS_LOGGING_LEVEL", + "SUNDIALS_LOGGING_LEVEL", + "0", + "STRING", + "logging", + choices=["0", "1", "2", "3", "4", "5"], + ) # fused kernels - add_arg(group, '--fused-kernels', 'SUNDIALS_FUSED_KERNELS', - 'SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS', 'OFF', 'BOOL', - 'package fused kernels') + add_arg( + group, + "--fused-kernels", + "SUNDIALS_FUSED_KERNELS", + "SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS", + "OFF", + "BOOL", + "package fused kernels", + ) # error checks - add_arg(group, '--enable-error-checks', 'SUNDIALS_ENABLE_ERROR_CHECKS', - 'SUNDIALS_ENABLE_ERROR_CHECKS', 'OFF', 'BOOL', - 'enable error checks') - + add_arg( + group, + "--enable-error-checks", + "SUNDIALS_ENABLE_ERROR_CHECKS", + "SUNDIALS_ENABLE_ERROR_CHECKS", + "OFF", + "BOOL", + "enable error checks", + ) # ----------- # Interfaces # ----------- - group = parser.add_argument_group('SUNDIALS Interfaces', - '''These options enable or disable the - SUNDIALS Fortran interfaces.''') + group = parser.add_argument_group( + "SUNDIALS Interfaces", + """These options enable or disable the + SUNDIALS Fortran interfaces.""", + ) # Fortran interfaces - add_arg(group, '--fmod-interface', 'SUNDIALS_FMOD_INTERFACE', - 'BUILD_FORTRAN_MODULE_INTERFACE', 'OFF', 'BOOL', - 'Fortran module interface') + add_arg( + group, + "--fmod-interface", + "SUNDIALS_FMOD_INTERFACE", + "BUILD_FORTRAN_MODULE_INTERFACE", + "OFF", + "BOOL", + "Fortran module interface", + ) # --------- # Examples # --------- - group = parser.add_argument_group('Example and Benchmark Programs', - '''These options enable or disable + group = parser.add_argument_group( + "Example and Benchmark Programs", + """These options enable or disable building and installing the SUNDIALS - example and Benchmark programs.''') - - add_arg(group, '--examples-c', 'SUNDIALS_EXAMPLES_C', - 'EXAMPLES_ENABLE_C', 'ON', 'BOOL', 'C examples') - - add_arg(group, '--examples-cxx', 'SUNDIALS_EXAMPLES_CXX', - 'EXAMPLES_ENABLE_CXX', None, 'BOOL', 'C++ examples') - - add_arg(group, '--examples-f03', 'SUNDIALS_EXAMPLES_F03', - 'EXAMPLES_ENABLE_F2003', None, 'BOOL', - 'Fortran 2003 examples') - - add_arg(group, '--examples-cuda', 'SUNDIALS_EXAMPLES_CUDA', - 'EXAMPLES_ENABLE_CUDA', None, 'BOOL', 'CUDA examples') - - add_arg(group, '--benchmarks', 'SUNDIALS_BENCHMARKS', - 'BUILD_BENCHMARKS', 'OFF', 'BOOL', 'Benchmarks') + example and Benchmark programs.""", + ) + + add_arg( + group, + "--examples-c", + "SUNDIALS_EXAMPLES_C", + "EXAMPLES_ENABLE_C", + "ON", + "BOOL", + "C examples", + ) + + add_arg( + group, + "--examples-cxx", + "SUNDIALS_EXAMPLES_CXX", + "EXAMPLES_ENABLE_CXX", + None, + "BOOL", + "C++ examples", + ) + + add_arg( + group, + "--examples-f03", + "SUNDIALS_EXAMPLES_F03", + "EXAMPLES_ENABLE_F2003", + None, + "BOOL", + "Fortran 2003 examples", + ) + + add_arg( + group, + "--examples-cuda", + "SUNDIALS_EXAMPLES_CUDA", + "EXAMPLES_ENABLE_CUDA", + None, + "BOOL", + "CUDA examples", + ) + + add_arg( + group, + "--benchmarks", + "SUNDIALS_BENCHMARKS", + "BUILD_BENCHMARKS", + "OFF", + "BOOL", + "Benchmarks", + ) # ------------ # TPL Options @@ -282,317 +610,745 @@ def main(): # MPI # ---- - group = parser.add_argument_group('MPI Options', - '''Options for enabling MPI support in + group = parser.add_argument_group( + "MPI Options", + """Options for enabling MPI support in SUNDIALS and setting the MPI C, C++, and - Fortran compilers.''') - - add_arg(group, '--mpi', 'SUNDIALS_MPI', 'ENABLE_MPI', 'OFF', - 'FILEPATH', 'SUNDIALS MPI support') - - add_arg(group, '--mpicc', 'MPICC', 'MPI_C_COMPILER', None, - 'FILEPATH', 'MPI C compiler', dependson='--mpi') - - add_arg(group, '--mpicxx', 'MPICXX', 'MPI_CXX_COMPILER', None, - 'FILEPATH', 'MPI C++ compiler', dependson='--mpi') - - add_arg(group, '--mpifort', 'MPIFC', 'MPI_Fortran_COMPILER', None, - 'FILEPATH', 'MPI Fortran compiler', dependson='--mpi') - - add_arg(group, '--mpiexec', 'MPIEXEC', 'MPIEXEC_EXECUTABLE', None, - 'FILEPATH', 'MPI executable', dependson='--mpi') - - add_arg(group, '--mpiexec-pre-flags', 'MPIEXEC_PREFLAGS', 'MPIEXEC_PREFLAGS', None, - 'STRING', 'MPI executable extra flags', dependson='--mpi') + Fortran compilers.""", + ) + + add_arg( + group, + "--mpi", + "SUNDIALS_MPI", + "ENABLE_MPI", + "OFF", + "FILEPATH", + "SUNDIALS MPI support", + ) + + add_arg( + group, + "--mpicc", + "MPICC", + "MPI_C_COMPILER", + None, + "FILEPATH", + "MPI C compiler", + dependson="--mpi", + ) + + add_arg( + group, + "--mpicxx", + "MPICXX", + "MPI_CXX_COMPILER", + None, + "FILEPATH", + "MPI C++ compiler", + dependson="--mpi", + ) + + add_arg( + group, + "--mpifort", + "MPIFC", + "MPI_Fortran_COMPILER", + None, + "FILEPATH", + "MPI Fortran compiler", + dependson="--mpi", + ) + + add_arg( + group, + "--mpiexec", + "MPIEXEC", + "MPIEXEC_EXECUTABLE", + None, + "FILEPATH", + "MPI executable", + dependson="--mpi", + ) + + add_arg( + group, + "--mpiexec-pre-flags", + "MPIEXEC_PREFLAGS", + "MPIEXEC_PREFLAGS", + None, + "STRING", + "MPI executable extra flags", + dependson="--mpi", + ) # ---------- # Threading # ---------- # OpenMP - group = parser.add_argument_group('OpenMP Options', - '''Options for enabling OpenMP support in - SUNDIALS.''') - - add_arg(group, '--openmp', 'SUNDIALS_OPENMP', 'ENABLE_OPENMP', 'OFF', - 'BOOL', 'SUNDIALS OpenMP support') - - add_arg(group, '--openmp-device-works', 'SUNDIALS_OPENMP_DEVICE_WORKS', - 'OPENMP_DEVICE_WORKS', 'OFF', 'BOOL', - 'Disable OpenMP Device Support Checks (assume OpenMP 4.5+)') - + group = parser.add_argument_group( + "OpenMP Options", + """Options for enabling OpenMP support in + SUNDIALS.""", + ) + + add_arg( + group, + "--openmp", + "SUNDIALS_OPENMP", + "ENABLE_OPENMP", + "OFF", + "BOOL", + "SUNDIALS OpenMP support", + ) + + add_arg( + group, + "--openmp-device-works", + "SUNDIALS_OPENMP_DEVICE_WORKS", + "OPENMP_DEVICE_WORKS", + "OFF", + "BOOL", + "Disable OpenMP Device Support Checks (assume OpenMP 4.5+)", + ) # Pthread - group = parser.add_argument_group('Pthread Options', - '''Options for enabling - Pthread support in SUNDIALS.''') - - add_arg(group, '--pthread', 'SUNDIALS_PTHREAD', 'ENABLE_PTHREAD', 'OFF', - 'BOOL', 'SUNDIALS PThread support') + group = parser.add_argument_group( + "Pthread Options", + """Options for enabling + Pthread support in SUNDIALS.""", + ) + + add_arg( + group, + "--pthread", + "SUNDIALS_PTHREAD", + "ENABLE_PTHREAD", + "OFF", + "BOOL", + "SUNDIALS PThread support", + ) # ----- # GPUs # ----- # CUDA - group = parser.add_argument_group('CUDA Options', - '''Options for enabling CUDA support in - - SUNDIALS''') - add_arg(group, '--cuda', 'SUNDIALS_CUDA', 'ENABLE_CUDA', 'OFF', 'BOOL', - 'SUNDIALS CUDA support') + group = parser.add_argument_group( + "CUDA Options", + """Options for enabling CUDA support in + + SUNDIALS""", + ) + add_arg( + group, + "--cuda", + "SUNDIALS_CUDA", + "ENABLE_CUDA", + "OFF", + "BOOL", + "SUNDIALS CUDA support", + ) # HIP - group = parser.add_argument_group('HIP Options', - '''Options for enabling HIP support in - SUNDIALS.''') - - add_arg(group, '--hip', 'SUNDIALS_HIP', 'ENABLE_HIP', 'OFF', 'BOOL', - 'SUNDIALS HIP support') + group = parser.add_argument_group( + "HIP Options", + """Options for enabling HIP support in + SUNDIALS.""", + ) + + add_arg( + group, + "--hip", + "SUNDIALS_HIP", + "ENABLE_HIP", + "OFF", + "BOOL", + "SUNDIALS HIP support", + ) # OpenMP Offload - group = parser.add_argument_group('OpenMP Offload Options', - '''Options for enabling OpenMP offload - support in SUNDIALS.''') - - add_arg(group, '--openmp-offload', 'SUNDIALS_OPENMP_OFFLOAD', - 'ENABLE_OPENMP_DEVICE', 'OFF', 'BOOL', - 'SUNDIALS OpenMP offload support') + group = parser.add_argument_group( + "OpenMP Offload Options", + """Options for enabling OpenMP offload + support in SUNDIALS.""", + ) + + add_arg( + group, + "--openmp-offload", + "SUNDIALS_OPENMP_OFFLOAD", + "ENABLE_OPENMP_DEVICE", + "OFF", + "BOOL", + "SUNDIALS OpenMP offload support", + ) # ------------------------ # Performance portability # ------------------------ # Kokkos - group = parser.add_argument_group('Kokkos Options') - - add_arg(group, '--kokkos', 'SUNDIALS_KOKKOS', 'ENABLE_KOKKOS', 'OFF', - 'BOOL', 'SUNDIALS Kokkos support') - - add_arg(group, '--kokkos-dir', 'KOKKOS_ROOT', 'Kokkos_DIR', None, 'PATH', - 'Kokkos install directory', dependson='--kokkos') + group = parser.add_argument_group("Kokkos Options") + + add_arg( + group, + "--kokkos", + "SUNDIALS_KOKKOS", + "ENABLE_KOKKOS", + "OFF", + "BOOL", + "SUNDIALS Kokkos support", + ) + + add_arg( + group, + "--kokkos-dir", + "KOKKOS_ROOT", + "Kokkos_DIR", + None, + "PATH", + "Kokkos install directory", + dependson="--kokkos", + ) # RAJA - group = parser.add_argument_group('RAJA Options') - - add_arg(group, '--raja', 'SUNDIALS_RAJA', 'ENABLE_RAJA', 'OFF', 'BOOL', - 'SUNDIALS Raja support') - - add_arg(group, '--raja-dir', 'RAJA_ROOT', 'RAJA_DIR', None, 'PATH', - 'RAJA install directory', dependson='--raja') - - add_arg(group, '--raja-backends', 'RAJA_BACKENDS', - 'SUNDIALS_RAJA_BACKENDS', None, 'STRING', 'RAJA backends', - choices=['CUDA', 'HIP'], dependson='--raja') + group = parser.add_argument_group("RAJA Options") + + add_arg( + group, + "--raja", + "SUNDIALS_RAJA", + "ENABLE_RAJA", + "OFF", + "BOOL", + "SUNDIALS Raja support", + ) + + add_arg( + group, + "--raja-dir", + "RAJA_ROOT", + "RAJA_DIR", + None, + "PATH", + "RAJA install directory", + dependson="--raja", + ) + + add_arg( + group, + "--raja-backends", + "RAJA_BACKENDS", + "SUNDIALS_RAJA_BACKENDS", + None, + "STRING", + "RAJA backends", + choices=["CUDA", "HIP"], + dependson="--raja", + ) # SYCL - group = parser.add_argument_group('SYCL Options') - - add_arg(group, '--sycl', 'SUNDIALS_SYCL', 'ENABLE_SYCL', 'OFF', 'BOOL', - 'SUNDIALS SYCL support') + group = parser.add_argument_group("SYCL Options") + + add_arg( + group, + "--sycl", + "SUNDIALS_SYCL", + "ENABLE_SYCL", + "OFF", + "BOOL", + "SUNDIALS SYCL support", + ) # ------------------------ # Linear solver libraries # ------------------------ # Ginkgo - group = parser.add_argument_group('Ginkgo Options') - - add_arg(group, '--ginkgo', 'SUNDIALS_GINKGO', 'ENABLE_GINKGO', 'OFF', - 'BOOL', 'SUNDIALS Ginkgo support') - - add_arg(group, '--ginkgo-dir', 'GINKGO_ROOT', 'Ginkgo_DIR', None, 'PATH', - 'Ginkgo install directory', dependson='--ginkgo') - - add_arg(group, '--ginkgo-backends', 'GINKGO_BACKENDS', - 'SUNDIALS_GINKGO_BACKENDS', 'REF;OMP', 'STRING', 'Ginkgo backends', - choices=['REF', 'OMP', 'CUDA', 'HIP', 'DPCPP'], dependson='--ginkgo') + group = parser.add_argument_group("Ginkgo Options") + + add_arg( + group, + "--ginkgo", + "SUNDIALS_GINKGO", + "ENABLE_GINKGO", + "OFF", + "BOOL", + "SUNDIALS Ginkgo support", + ) + + add_arg( + group, + "--ginkgo-dir", + "GINKGO_ROOT", + "Ginkgo_DIR", + None, + "PATH", + "Ginkgo install directory", + dependson="--ginkgo", + ) + + add_arg( + group, + "--ginkgo-backends", + "GINKGO_BACKENDS", + "SUNDIALS_GINKGO_BACKENDS", + "REF;OMP", + "STRING", + "Ginkgo backends", + choices=["REF", "OMP", "CUDA", "HIP", "DPCPP"], + dependson="--ginkgo", + ) # LAPACK - group = parser.add_argument_group('LAPACK Options') - - add_arg(group, '--lapack', 'SUNDIALS_LAPACK', 'ENABLE_LAPACK', 'OFF', - 'BOOL', 'SUNDIALS LAPACK support') - - add_arg(group, '--lapack-libs', 'LAPACK_LIBRARIES', 'LAPACK_LIBRARIES', - None, 'STRING', 'LAPACK libraries', dependson='--lapack') + group = parser.add_argument_group("LAPACK Options") + + add_arg( + group, + "--lapack", + "SUNDIALS_LAPACK", + "ENABLE_LAPACK", + "OFF", + "BOOL", + "SUNDIALS LAPACK support", + ) + + add_arg( + group, + "--lapack-libs", + "LAPACK_LIBRARIES", + "LAPACK_LIBRARIES", + None, + "STRING", + "LAPACK libraries", + dependson="--lapack", + ) # KLU - group = parser.add_argument_group('KLU Options') - - add_arg(group, '--klu', 'SUNDIALS_KLU', 'ENABLE_KLU', 'OFF', 'BOOL', - 'SUNDIALS KLU support') - - add_arg(group, '--klu-incdir', 'SUITE_SPARSE_INCLUDE_DIR', - 'KLU_INCLUDE_DIR', None, 'PATH', 'KLU include directory', - dependson='--klu') - - add_arg(group, '--klu-libdir', 'SUITE_SPARSE_LIBRARY_DIR', - 'KLU_LIBRARY_DIR', None, 'PATH', 'KLU library directory', - dependson='--klu') + group = parser.add_argument_group("KLU Options") + + add_arg( + group, + "--klu", + "SUNDIALS_KLU", + "ENABLE_KLU", + "OFF", + "BOOL", + "SUNDIALS KLU support", + ) + + add_arg( + group, + "--klu-incdir", + "SUITE_SPARSE_INCLUDE_DIR", + "KLU_INCLUDE_DIR", + None, + "PATH", + "KLU include directory", + dependson="--klu", + ) + + add_arg( + group, + "--klu-libdir", + "SUITE_SPARSE_LIBRARY_DIR", + "KLU_LIBRARY_DIR", + None, + "PATH", + "KLU library directory", + dependson="--klu", + ) # KokkosKernels - group = parser.add_argument_group('KokkosKernels Options') - - add_arg(group, '--kokkos-kernels', 'SUNDIALS_KOKKOS_KERNELS', - 'ENABLE_KOKKOS_KERNELS', 'OFF', 'BOOL', - 'SUNDIALS Kokkos-Kernels support') - - add_arg(group, '--kokkos-kernels-dir', 'KOKKOS_KERNELS_ROOT', - 'KokkosKernels_DIR', None, 'PATH', - 'Kokkos-Kernels install directory', dependson='--kokkos-kernels') + group = parser.add_argument_group("KokkosKernels Options") + + add_arg( + group, + "--kokkos-kernels", + "SUNDIALS_KOKKOS_KERNELS", + "ENABLE_KOKKOS_KERNELS", + "OFF", + "BOOL", + "SUNDIALS Kokkos-Kernels support", + ) + + add_arg( + group, + "--kokkos-kernels-dir", + "KOKKOS_KERNELS_ROOT", + "KokkosKernels_DIR", + None, + "PATH", + "Kokkos-Kernels install directory", + dependson="--kokkos-kernels", + ) # SuperLU MT - group = parser.add_argument_group('SuperLU_MT Options') - - add_arg(group, '--superlu-mt', 'SUNDIALS_SUPERLU_MT', 'ENABLE_SUPERLUMT', - 'OFF', 'BOOL', 'SUNDIALS SuperLU MT support') - - add_arg(group, '--superlu-mt-incdir', 'SUPERLU_MT_INCLUDE_DIR', - 'SUPERLUMT_INCLUDE_DIR', None, 'PATH', - 'SuperLU_MT include directory', dependson='--superlu-mt') - - add_arg(group, '--superlu-mt-libdir', 'SUPERLU_MT_LIBRARY_DIR', - 'SUPERLUMT_LIBRARY_DIR', None, 'PATH', - 'SuperLU_MT library directory', dependson='--superlu-mt') - - add_arg(group, '--superlu-mt-libs', 'SUPERLU_MT_LIBRARIES', - 'SUPERLUMT_LIBRARIES', None, 'STRING', - 'SuperLU_MT additional libraries', dependson='--superlu-mt') - - add_arg(group, '--superlu-mt-thread-type', 'SUPERLU_MT_THREAD_TYPE', - 'SUPERLUMT_THREAD_TYPE', None, 'STRING', - 'SuperLU_MT thread type', choices=['OpenMP', 'Pthread'], - dependson='--superlu-mt') + group = parser.add_argument_group("SuperLU_MT Options") + + add_arg( + group, + "--superlu-mt", + "SUNDIALS_SUPERLU_MT", + "ENABLE_SUPERLUMT", + "OFF", + "BOOL", + "SUNDIALS SuperLU MT support", + ) + + add_arg( + group, + "--superlu-mt-incdir", + "SUPERLU_MT_INCLUDE_DIR", + "SUPERLUMT_INCLUDE_DIR", + None, + "PATH", + "SuperLU_MT include directory", + dependson="--superlu-mt", + ) + + add_arg( + group, + "--superlu-mt-libdir", + "SUPERLU_MT_LIBRARY_DIR", + "SUPERLUMT_LIBRARY_DIR", + None, + "PATH", + "SuperLU_MT library directory", + dependson="--superlu-mt", + ) + + add_arg( + group, + "--superlu-mt-libs", + "SUPERLU_MT_LIBRARIES", + "SUPERLUMT_LIBRARIES", + None, + "STRING", + "SuperLU_MT additional libraries", + dependson="--superlu-mt", + ) + + add_arg( + group, + "--superlu-mt-thread-type", + "SUPERLU_MT_THREAD_TYPE", + "SUPERLUMT_THREAD_TYPE", + None, + "STRING", + "SuperLU_MT thread type", + choices=["OpenMP", "Pthread"], + dependson="--superlu-mt", + ) # SuperLU DIST - group = parser.add_argument_group('SuperLU_DIST Options') - - add_arg(group, '--superlu-dist', 'SUNDIALS_SUPERLU_DIST', - 'ENABLE_SUPERLUDIST', 'OFF', 'BOOL', - 'SUNDIALS SuperLU DIST support') - - add_arg(group, '--superlu-dist-dir', 'SUPERLU_DIST_ROOT', - 'SUPERLUDIST_DIR', None, 'PATH', - 'SuperLU_DIST installation directory', dependson='--superlu-dist') - - add_arg(group, '--superlu-dist-incdir', 'SUPERLU_DIST_INCLUDE_DIR', - 'SUPERLUDIST_INCLUDE_DIR', None, 'PATH', - 'SuperLU_DIST include directory', dependson='--superlu-dist') - - add_arg(group, '--superlu-dist-libdir', 'SUPERLU_DIST_LIBRARY_DIR', - 'SUPERLUDIST_LIBRARY_DIR', None, 'PATH', - 'SuperLU_DIST library directory', dependson='--superlu-dist') - - add_arg(group, '--superlu-dist-libs', 'SUPERLU_DIST_LIBRARIES', - 'SUPERLUDIST_LIBRARIES', None, 'STRING', - 'SuperLU_DIST additional libraries', dependson='--superlu-dist') - - add_arg(group, '--superlu-dist-openmp', 'SUPERLU_DIST_OPENMP', - 'SUPERLUDIST_OpenMP', 'OFF', 'BOOL', 'SuperLU_DIST OpenMP enabled', - dependson='--superlu-dist') + group = parser.add_argument_group("SuperLU_DIST Options") + + add_arg( + group, + "--superlu-dist", + "SUNDIALS_SUPERLU_DIST", + "ENABLE_SUPERLUDIST", + "OFF", + "BOOL", + "SUNDIALS SuperLU DIST support", + ) + + add_arg( + group, + "--superlu-dist-dir", + "SUPERLU_DIST_ROOT", + "SUPERLUDIST_DIR", + None, + "PATH", + "SuperLU_DIST installation directory", + dependson="--superlu-dist", + ) + + add_arg( + group, + "--superlu-dist-incdir", + "SUPERLU_DIST_INCLUDE_DIR", + "SUPERLUDIST_INCLUDE_DIR", + None, + "PATH", + "SuperLU_DIST include directory", + dependson="--superlu-dist", + ) + + add_arg( + group, + "--superlu-dist-libdir", + "SUPERLU_DIST_LIBRARY_DIR", + "SUPERLUDIST_LIBRARY_DIR", + None, + "PATH", + "SuperLU_DIST library directory", + dependson="--superlu-dist", + ) + + add_arg( + group, + "--superlu-dist-libs", + "SUPERLU_DIST_LIBRARIES", + "SUPERLUDIST_LIBRARIES", + None, + "STRING", + "SuperLU_DIST additional libraries", + dependson="--superlu-dist", + ) + + add_arg( + group, + "--superlu-dist-openmp", + "SUPERLU_DIST_OPENMP", + "SUPERLUDIST_OpenMP", + "OFF", + "BOOL", + "SuperLU_DIST OpenMP enabled", + dependson="--superlu-dist", + ) # Magma - group = parser.add_argument_group('MAGMA Options') - - add_arg(group, '--magma', 'SUNDIALS_MAGMA', 'ENABLE_MAGMA', 'OFF', 'BOOL', - 'SUNDIALS MAGMA support') - - add_arg(group, '--magma-dir', 'MAGMA_ROOT', 'MAGMA_DIR', None, 'PATH', - 'MAGMA install directory', dependson='--magma') - - add_arg(group, '--magma-backends', 'MAGAMA_BACKENDS', - 'SUNDIALS_MAGMA_BACKENDS', None, 'STRING', 'MAGMA backends', - choices=['CUDA', 'HIP'], dependson='--magma') + group = parser.add_argument_group("MAGMA Options") + + add_arg( + group, + "--magma", + "SUNDIALS_MAGMA", + "ENABLE_MAGMA", + "OFF", + "BOOL", + "SUNDIALS MAGMA support", + ) + + add_arg( + group, + "--magma-dir", + "MAGMA_ROOT", + "MAGMA_DIR", + None, + "PATH", + "MAGMA install directory", + dependson="--magma", + ) + + add_arg( + group, + "--magma-backends", + "MAGAMA_BACKENDS", + "SUNDIALS_MAGMA_BACKENDS", + None, + "STRING", + "MAGMA backends", + choices=["CUDA", "HIP"], + dependson="--magma", + ) # ---------------- # Other libraries # ---------------- # hypre - group = parser.add_argument_group('hypre Options') - - add_arg(group, '--hypre', 'SUNDIALS_HYPRE', 'ENABLE_HYPRE', 'OFF', 'BOOL', - 'SUNDIALS hypre support') - - add_arg(group, '--hypre-incdir', 'HYPRE_INCLUDE_DIR', - 'HYPRE_INCLUDE_DIR', None, 'PATH', - 'Hypre include directory', dependson='--hypre') - - add_arg(group, '--hypre-libdir', 'HYPRE_LIBRARY_DIR', - 'HYPRE_LIBRARY_DIR', None, 'PATH', - 'Hypre library directory', dependson='--hypre') + group = parser.add_argument_group("hypre Options") + + add_arg( + group, + "--hypre", + "SUNDIALS_HYPRE", + "ENABLE_HYPRE", + "OFF", + "BOOL", + "SUNDIALS hypre support", + ) + + add_arg( + group, + "--hypre-incdir", + "HYPRE_INCLUDE_DIR", + "HYPRE_INCLUDE_DIR", + None, + "PATH", + "Hypre include directory", + dependson="--hypre", + ) + + add_arg( + group, + "--hypre-libdir", + "HYPRE_LIBRARY_DIR", + "HYPRE_LIBRARY_DIR", + None, + "PATH", + "Hypre library directory", + dependson="--hypre", + ) # PETSc - group = parser.add_argument_group('PTESc Options') - - add_arg(group, '--petsc', 'SUNDIALS_PETSC', 'ENABLE_PETSC', 'OFF', 'BOOL', - 'SUNDIALS PETSc support') - - add_arg(group, '--petsc-dir', 'PETSC_ROOT', 'PETSC_DIR', None, 'PATH', - 'PETSc install directory', dependson='--petsc') + group = parser.add_argument_group("PTESc Options") + + add_arg( + group, + "--petsc", + "SUNDIALS_PETSC", + "ENABLE_PETSC", + "OFF", + "BOOL", + "SUNDIALS PETSc support", + ) + + add_arg( + group, + "--petsc-dir", + "PETSC_ROOT", + "PETSC_DIR", + None, + "PATH", + "PETSc install directory", + dependson="--petsc", + ) # Trilinos - group = parser.add_argument_group('Trilinos Options') - - add_arg(group, '--trilinos', 'SUNDIALS_TRILINOS', 'ENABLE_TRILINOS', 'OFF', - 'BOOL', 'SUNDIALS Trilinos support') - - add_arg(group, '--trilinos-dir', 'TRILINOS_ROOT', 'Trilinos_DIR', None, - 'PATH', 'Trilinos install directory', dependson='--trilinos') + group = parser.add_argument_group("Trilinos Options") + + add_arg( + group, + "--trilinos", + "SUNDIALS_TRILINOS", + "ENABLE_TRILINOS", + "OFF", + "BOOL", + "SUNDIALS Trilinos support", + ) + + add_arg( + group, + "--trilinos-dir", + "TRILINOS_ROOT", + "Trilinos_DIR", + None, + "PATH", + "Trilinos install directory", + dependson="--trilinos", + ) # XBraid - group = parser.add_argument_group('XBraid Options') - - add_arg(group, '--xbraid', 'SUNDIALS_XBRAID', 'ENABLE_XBRAID', 'OFF', - 'BOOL', 'SUNDIALS XBraid support') - - add_arg(group, '--xbraid-dir', 'XBRAID_ROOT', 'XBRAID_DIR', None, 'PATH', - 'XBraid install directory', dependson='--xbraid') + group = parser.add_argument_group("XBraid Options") + + add_arg( + group, + "--xbraid", + "SUNDIALS_XBRAID", + "ENABLE_XBRAID", + "OFF", + "BOOL", + "SUNDIALS XBraid support", + ) + + add_arg( + group, + "--xbraid-dir", + "XBRAID_ROOT", + "XBRAID_DIR", + None, + "PATH", + "XBraid install directory", + dependson="--xbraid", + ) # -------- # Testing # -------- - group = parser.add_argument_group('Testing Options') + group = parser.add_argument_group("Testing Options") # development tests - add_arg(group, '--dev-tests', 'SUNDIALS_TEST_DEVTESTS', - 'SUNDIALS_TEST_DEVTESTS', 'OFF', 'BOOL', - 'SUNDIALS development tests') + add_arg( + group, + "--dev-tests", + "SUNDIALS_TEST_DEVTESTS", + "SUNDIALS_TEST_DEVTESTS", + "OFF", + "BOOL", + "SUNDIALS development tests", + ) # unit tests - add_arg(group, '--unit-tests', 'SUNDIALS_TEST_UNITTESTS', - 'SUNDIALS_TEST_UNITTESTS', 'OFF', 'BOOL', - 'SUNDIALS unit tests') - - add_arg(group, '--no-gtest', 'SUNDIALS_TEST_ENABLE_GTEST', - 'SUNDIALS_TEST_ENABLE_GTEST', 'ON', 'BOOL', - 'SUNDIALS GTest unit tests') + add_arg( + group, + "--unit-tests", + "SUNDIALS_TEST_UNITTESTS", + "SUNDIALS_TEST_UNITTESTS", + "OFF", + "BOOL", + "SUNDIALS unit tests", + ) + + add_arg( + group, + "--no-gtest", + "SUNDIALS_TEST_ENABLE_GTEST", + "SUNDIALS_TEST_ENABLE_GTEST", + "ON", + "BOOL", + "SUNDIALS GTest unit tests", + ) # test output directory - add_arg(group, '--test-output-dir', 'SUNDIALS_TEST_OUTPUT_DIR', - 'SUNDIALS_TEST_OUTPUT_DIR', None, 'PATH', - 'SUNDIALS test output directory') + add_arg( + group, + "--test-output-dir", + "SUNDIALS_TEST_OUTPUT_DIR", + "SUNDIALS_TEST_OUTPUT_DIR", + None, + "PATH", + "SUNDIALS test output directory", + ) # test answer directory - add_arg(group, '--test-answer-dir', 'SUNDIALS_TEST_ANSWER_DIR', - 'SUNDIALS_TEST_ANSWER_DIR', None, 'PATH', - 'SUNDIALS test answer directory') + add_arg( + group, + "--test-answer-dir", + "SUNDIALS_TEST_ANSWER_DIR", + "SUNDIALS_TEST_ANSWER_DIR", + None, + "PATH", + "SUNDIALS test answer directory", + ) # test float comparison precision - add_arg(group, '--test-float-precision', 'SUNDIALS_TEST_FLOAT_PRECISION', - 'SUNDIALS_TEST_FLOAT_PRECISION', None, 'STRING', - 'SUNDIALS test float comparison precision') + add_arg( + group, + "--test-float-precision", + "SUNDIALS_TEST_FLOAT_PRECISION", + "SUNDIALS_TEST_FLOAT_PRECISION", + None, + "STRING", + "SUNDIALS test float comparison precision", + ) # test integer comparison precision - add_arg(group, '--test-integer-precision', - 'SUNDIALS_TEST_INTEGER_PRECISION', - 'SUNDIALS_TEST_INTEGER_PRECISION', None, 'STRING', - 'SUNDIALS test integer comparison precision') - - add_arg(group, '--make-verbose', 'CMAKE_VERBOSE_MAKEFILE', - 'CMAKE_VERBOSE_MAKEFILE', 'OFF', 'BOOL', 'verbose make output') + add_arg( + group, + "--test-integer-precision", + "SUNDIALS_TEST_INTEGER_PRECISION", + "SUNDIALS_TEST_INTEGER_PRECISION", + None, + "STRING", + "SUNDIALS test integer comparison precision", + ) + + add_arg( + group, + "--make-verbose", + "CMAKE_VERBOSE_MAKEFILE", + "CMAKE_VERBOSE_MAKEFILE", + "OFF", + "BOOL", + "verbose make output", + ) # --------------------- # Parse and check args @@ -640,20 +1396,20 @@ def read_env(args): continue # don't overwite options already set at command line - value = args_dict[a]['value'] - default = args_dict[a]['default'] + value = args_dict[a]["value"] + default = args_dict[a]["default"] if value != default: continue # check for environment variable and set value - env_var = args_dict[a]['env_var'] + env_var = args_dict[a]["env_var"] if env_var is None: continue if env_var in os.environ: - args_dict[a]['value'] = os.environ[env_var] + args_dict[a]["value"] = os.environ[env_var] # ----------------------------------------------------------------------------- @@ -661,31 +1417,49 @@ def read_env(args): # ----------------------------------------------------------------------------- -def add_arg(parser, arg, env_var, cmake_var, cmake_default, cmake_type, msg, - choices=None, dependson=None): +def add_arg( + parser, + arg, + env_var, + cmake_var, + cmake_default, + cmake_type, + msg, + choices=None, + dependson=None, +): """Add a command SUNDIALS option command line arg""" # Use underscores in the arg variable name - arg_dest = arg[2:].replace('-', '_') + arg_dest = arg[2:].replace("-", "_") help_msg = msg # Define function to create an argparse SUNDIALS option type - arg_type = cmake_arg(env_var, cmake_var, cmake_default, cmake_type, msg, - choices=choices, dependson=dependson) + arg_type = cmake_arg( + env_var, + cmake_var, + cmake_default, + cmake_type, + msg, + choices=choices, + dependson=dependson, + ) # Replace 'None' with a default string to ensure a dictionary is created # even when a command line input is not provided. This is ensures the # dictionary exists when reading variables from the environment. if cmake_default is None: - cmake_default = '__default_none__' + cmake_default = "__default_none__" # Create command line arg - parser.add_argument(arg, dest=arg_dest, type=arg_type, - default=cmake_default, help=help_msg) + parser.add_argument( + arg, dest=arg_dest, type=arg_type, default=cmake_default, help=help_msg + ) -def cmake_arg(env_var, cmake_var, cmake_default, cmake_type, msg, - choices=None, dependson=None): +def cmake_arg( + env_var, cmake_var, cmake_default, cmake_type, msg, choices=None, dependson=None +): """Function factory for argparse SUNDIALS option type""" def _cmake_arg(str_var): @@ -694,19 +1468,19 @@ def _cmake_arg(str_var): import argparse # check if using None for the default value - if str_var == '__default_none__': + if str_var == "__default_none__": str_var = None # check for valid input options - if cmake_type == 'BOOL' and str_var not in ['ON', 'OFF', None]: - err_msg = 'Invalid option value ' + str_var + '. ' - err_msg += 'Input value must be ON or OFF.' + if cmake_type == "BOOL" and str_var not in ["ON", "OFF", None]: + err_msg = "Invalid option value " + str_var + ". " + err_msg += "Input value must be ON or OFF." raise argparse.ArgumentTypeError("Invaid Value for BOOL") if choices is not None and str_var is not None: raise_error = False if ";" in str_var: - for s in str_var.split(';'): + for s in str_var.split(";"): if s not in choices: raise_error = True else: @@ -714,24 +1488,24 @@ def _cmake_arg(str_var): raise_error = True if raise_error: - err_msg = 'Invalid option value ' + str_var + '. ' - err_msg += 'Input value must be ' + err_msg = "Invalid option value " + str_var + ". " + err_msg += "Input value must be " if len(choices) < 3: - err_msg += ' or '.join(choices) + '.' + err_msg += " or ".join(choices) + "." else: - err_msg += ', '.join(choices[:-1]) - err_msg += ', or ' + choices[-1] + '.' + err_msg += ", ".join(choices[:-1]) + err_msg += ", or " + choices[-1] + "." raise argparse.ArgumentTypeError(err_msg) # create dictionary for SUNDIALS option cmake_dict = {} - cmake_dict['env_var'] = env_var - cmake_dict['cmake_var'] = cmake_var - cmake_dict['default'] = cmake_default - cmake_dict['cmake_type'] = cmake_type - cmake_dict['msg'] = msg - cmake_dict['value'] = str_var - cmake_dict['depends_on'] = dependson + cmake_dict["env_var"] = env_var + cmake_dict["cmake_var"] = cmake_var + cmake_dict["default"] = cmake_default + cmake_dict["cmake_type"] = cmake_type + cmake_dict["msg"] = msg + cmake_dict["value"] = str_var + cmake_dict["depends_on"] = dependson return cmake_dict @@ -761,35 +1535,34 @@ def write_cmake(fn, args): # print(a, args_dict[a]) # don't wite output lines if using the default value - value = args_dict[a]['value'] - default = args_dict[a]['default'] + value = args_dict[a]["value"] + default = args_dict[a]["default"] if value is None or value == default: continue # don't wite output if TPL is not enabled - depends_on = args_dict[a]['depends_on'] + depends_on = args_dict[a]["depends_on"] if depends_on is not None: - depends_on = depends_on[2:].replace('-', '_') - depends_on_val = args_dict[depends_on]['value'] + depends_on = depends_on[2:].replace("-", "_") + depends_on_val = args_dict[depends_on]["value"] # print(depends_on, depends_on_val) - if depends_on_val != 'ON': + if depends_on_val != "ON": continue # write CMake output - cmake_var = args_dict[a]['cmake_var'] - cmake_type = args_dict[a]['cmake_type'] - cmake_msg = args_dict[a]['msg'] + cmake_var = args_dict[a]["cmake_var"] + cmake_type = args_dict[a]["cmake_type"] + cmake_msg = args_dict[a]["msg"] - if args.filetype == 'cache': - cmd = (f"set({cmake_var} \"{value}\" CACHE {cmake_type} " - f"\"{cmake_msg}\")\n") + if args.filetype == "cache": + cmd = f'set({cmake_var} "{value}" CACHE {cmake_type} ' f'"{cmake_msg}")\n' else: - cmd = f" \\\n -D {cmake_var}=\"{value}\"" + cmd = f' \\\n -D {cmake_var}="{value}"' fn.write(cmd) @@ -799,13 +1572,15 @@ def setup_file(cmakefile, filename, filetype): import os import stat - if filetype == 'cache': - msg = (f'# CMake cache file for configuring SUNDIALS\n' - f'#\n' - f'# Move this file to your build directory and configure ' - f'SUNDIALS with the\n' - f'# following command:\n' - f'# cmake -C {filename}\n') + if filetype == "cache": + msg = ( + f"# CMake cache file for configuring SUNDIALS\n" + f"#\n" + f"# Move this file to your build directory and configure " + f"SUNDIALS with the\n" + f"# following command:\n" + f"# cmake -C {filename}\n" + ) cmakefile.write(msg) # update permissions to make sure the file is not executable @@ -817,18 +1592,20 @@ def setup_file(cmakefile, filename, filetype): st = os.stat(filename) os.chmod(filename, st.st_mode & NO_EXE) else: - msg = (f'#!/bin/bash\n' - f'# Script for configuring SUNDIALS\n' - f'#\n' - f'# Move this file to your build directory and configure ' - f'SUNDIALS with the\n' - f'# following command:\n' - f'# ./{filename} \n' - f'if [ "$#" -lt 1 ]; then\n' - f' echo "ERROR: Path to SUNDIALS source required"\n' - f' exit 1\n' - f'fi\n' - f'cmake $1') + msg = ( + f"#!/bin/bash\n" + f"# Script for configuring SUNDIALS\n" + f"#\n" + f"# Move this file to your build directory and configure " + f"SUNDIALS with the\n" + f"# following command:\n" + f"# ./{filename} \n" + f'if [ "$#" -lt 1 ]; then\n' + f' echo "ERROR: Path to SUNDIALS source required"\n' + f" exit 1\n" + f"fi\n" + f"cmake $1" + ) cmakefile.write(msg) # update permissions to make sure the user can execute the script @@ -858,6 +1635,7 @@ def print_args(args): # ----------------------------------------------------------------------------- -if __name__ == '__main__': +if __name__ == "__main__": import sys + sys.exit(main()) diff --git a/test/notify.py b/test/notify.py index befdd721ab..ee19008d9a 100755 --- a/test/notify.py +++ b/test/notify.py @@ -15,24 +15,29 @@ # Send email notification if a SUNDIALS regression test status # ----------------------------------------------------------------------------- + def main(): import argparse import os parser = argparse.ArgumentParser( - description='Send email notification based on regression test status', - formatter_class=argparse.RawTextHelpFormatter) + description="Send email notification based on regression test status", + formatter_class=argparse.RawTextHelpFormatter, + ) - parser.add_argument('teststatus', type=str, - choices=['passed', 'failed', 'fixed'], - help='Status of regression test') + parser.add_argument( + "teststatus", + type=str, + choices=["passed", "failed", "fixed"], + help="Status of regression test", + ) - parser.add_argument('testname', type=str, - help='Name branch name or pull-request tested') + parser.add_argument( + "testname", type=str, help="Name branch name or pull-request tested" + ) - parser.add_argument('testurl', type=str, - help='URL for viewing test results') + parser.add_argument("testurl", type=str, help="URL for viewing test results") # parse command line args args = parser.parse_args() @@ -41,7 +46,7 @@ def main(): logfile = "suntest.log" # if log file exists add url, otherwise create log file - if (os.path.isfile(logfile)): + if os.path.isfile(logfile): with open(logfile, "a") as log: log.write("View test output at:\n") log.write(args.testurl) @@ -53,7 +58,7 @@ def main(): log.write(args.testurl) # determine notification recipient - special_branches = ['main', 'develop', 'release'] + special_branches = ["main", "develop", "release"] if any(branch in args.testname for branch in special_branches): # SUNDIALS developers list @@ -61,23 +66,23 @@ def main(): else: # author of most recent commit cmd = "git log --format='%ae' -1" - recipient = runCommand(cmd).rstrip().decode('UTF-8') + recipient = runCommand(cmd).rstrip().decode("UTF-8") # check if the last commit was a CI merge - if (recipient == 'nobody@nowhere'): + if recipient == "nobody@nowhere": cmd = "git log HEAD~1 --pretty=format:'%ae' -1" - recipient = runCommand(cmd).rstrip().decode('UTF-8') + recipient = runCommand(cmd).rstrip().decode("UTF-8") # send notification if tests fail, log file not found, or fixed - if (args.teststatus == 'failed'): + if args.teststatus == "failed": - subject = "FAILED: SUNDIALS "+args.testname+" failed regression tests" + subject = "FAILED: SUNDIALS " + args.testname + " failed regression tests" print("Tests failed, sending notification to", recipient) sendEmail(recipient, subject, logfile) - elif (args.teststatus == 'fixed'): + elif args.teststatus == "fixed": - subject = "FIXED: SUNDIALS "+args.testname+" passed regression tests" + subject = "FIXED: SUNDIALS " + args.testname + " passed regression tests" print("Tests fixed, sending notification to", recipient) sendEmail(recipient, subject, logfile) @@ -94,7 +99,7 @@ def runCommand(cmd): cmdout = subprocess.check_output(cmd, shell=True) - return(cmdout) + return cmdout # @@ -116,13 +121,13 @@ def sendEmail(recipient, subject, message): sender = "SUNDIALS.suntest@llnl.gov" # email settings - msg['Subject'] = subject - msg['From'] = sender - msg['To'] = recipient + msg["Subject"] = subject + msg["From"] = sender + msg["To"] = recipient # Send the message via our own SMTP server, but don't include the # envelope header. - s = smtplib.SMTP('smtp.llnl.gov') + s = smtplib.SMTP("smtp.llnl.gov") s.send_message(msg) s.quit() @@ -130,5 +135,5 @@ def sendEmail(recipient, subject, message): # # just run the main routine # -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/test/test_install.py b/test/test_install.py index 7b2dbe06e6..4dab1c4513 100755 --- a/test/test_install.py +++ b/test/test_install.py @@ -19,6 +19,7 @@ # main routine # ----------------------------------------------------------------------------- + def main(): import argparse @@ -28,29 +29,29 @@ def main(): import subprocess parser = argparse.ArgumentParser( - description='Find and build installed examples', - formatter_class=argparse.RawTextHelpFormatter) + description="Find and build installed examples", + formatter_class=argparse.RawTextHelpFormatter, + ) - parser.add_argument('directory', type=str, - help='Directory to search for build files') + parser.add_argument( + "directory", type=str, help="Directory to search for build files" + ) - parser.add_argument('--cmake', action='store_true', - help='CMake build') + parser.add_argument("--cmake", action="store_true", help="CMake build") - parser.add_argument('--test', action='store_true', - help='Test builds') + parser.add_argument("--test", action="store_true", help="Test builds") - parser.add_argument('--clean', action='store_true', - help='Clean builds') + parser.add_argument("--clean", action="store_true", help="Clean builds") - parser.add_argument('--regex', type=str, - help='Regular expression for filtering example directories') + parser.add_argument( + "--regex", type=str, help="Regular expression for filtering example directories" + ) - parser.add_argument('-v', '--verbose', action='count', default=0, - help='Verbose output') + parser.add_argument( + "-v", "--verbose", action="count", default=0, help="Verbose output" + ) - parser.add_argument('--failfast', action='store_true', - help='Stop on first failure') + parser.add_argument("--failfast", action="store_true", help="Stop on first failure") # parse command line args args = parser.parse_args() @@ -80,7 +81,7 @@ def main(): # filter files if args.regex: regex = re.compile(args.regex) - buildfiles = [ bf for bf in buildfiles if re.search(regex, bf) ] + buildfiles = [bf for bf in buildfiles if re.search(regex, bf)] if args.verbose > 0: print(f"Total files (filtered): {len(buildfiles)}") if args.verbose > 2: @@ -102,9 +103,12 @@ def main(): # clean and move on if args.clean: - ret = subprocess.call('make clean', shell=True, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + ret = subprocess.call( + "make clean", + shell=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) # return to original directory os.chdir(cwd) continue @@ -112,11 +116,14 @@ def main(): # confgure cmake if necessary configfail = False if args.cmake: - if os.path.isfile('Makefile'): - os.remove('Makefile') - ret = subprocess.call('cmake -DCMAKE_VERBOSE_MAKEFILE=ON .', - shell=True, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + if os.path.isfile("Makefile"): + os.remove("Makefile") + ret = subprocess.call( + "cmake -DCMAKE_VERBOSE_MAKEFILE=ON .", + shell=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) if args.verbose > 0: print(f" Config return: {ret}") if ret != 0: @@ -126,9 +133,9 @@ def main(): # make examples buildfail = False if not configfail: - ret = subprocess.call('make', shell=True, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + ret = subprocess.call( + "make", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL + ) if args.verbose > 0: print(f" Build return: {ret}") if ret != 0: @@ -138,9 +145,12 @@ def main(): # test examples testfail = False if not configfail and not buildfail and args.test: - ret = subprocess.call('make test', shell=True, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + ret = subprocess.call( + "make test", + shell=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) if args.verbose > 0: print(f" Test return: {ret}") if ret != 0: @@ -167,10 +177,12 @@ def main(): else: print("All builds successful.") + # ----------------------------------------------------------------------------- # run the main routine # ----------------------------------------------------------------------------- -if __name__ == '__main__': +if __name__ == "__main__": import sys + sys.exit(main()) 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") -