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/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml new file mode 100644 index 0000000000..8825e58b06 --- /dev/null +++ b/.github/workflows/check-spelling.yml @@ -0,0 +1,44 @@ +name: Checks - spelling + +on: + pull_request: + workflow_dispatch: + +jobs: + spelling_check: + runs-on: ubuntu-latest + steps: + - name: Install python3-pip + run: | + sudo apt update + sudo apt install -y --no-install-recommends python3-pip + + - name: Install codespell + run: pip install codespell + + - name: Print codespell version + run: codespell --version + + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Run codespell + run: | + ./scripts/spelling.sh + + - 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 > spelling.patch + + - name: Archive diff as a patch if we failed + uses: actions/upload-artifact@v3 + if: failure() + with: + name: spelling.patch + path: | + ${{ github.workspace }}/spelling.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index eee9a428a5..3a82dd8621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,32 @@ # SUNDIALS Changelog +## Changes to SUNDIALS in release X.Y.Z + +### Major Features + +### New Features and Enhancements + +The default value of `CMAKE_CUDA_ARCHITECTURES` is no longer set to `70` and is +now determined automatically by CMake. The previous default was only valid for +Volta GPUs while the automatically selected value will vary across compilers and +compiler versions. As such, users are encouraged to override this value with the +architecture for their system. + +### Bug Fixes + +Fixed the loading of ARKStep's default first order explicit method. + +Fixed a CMake bug regarding usage of missing "print_warning" macro +that was only triggered when the deprecated `CUDA_ARCH` option was used. + +### 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 @@ -1776,7 +1798,7 @@ update their code to set the corresponding `ops` structure member, `matvecsetup`, to `NULL`. The generic SUNMatrix API now defines error codes to be returned by SUNMatrix -operations. Operations which return an integer flag indiciating success/failure +operations. Operations which return an integer flag indicating success/failure may return different values than previously. A new SUNMatrix (and SUNLinearSolver) implementation was added to facilitate @@ -1888,7 +1910,7 @@ function signatures have been changed including MRIStepCreate which now takes an ARKStep memory structure for the fast integration as an input. The reinitialization functions `ERKStepReInit`, `ARKStepReInit`, and -`MRIStepReInit` have been updated to retain the minimum and maxiumum step +`MRIStepReInit` have been updated to retain the minimum and maximum step size values from before reinitialization rather than resetting them to the default values. @@ -1913,7 +1935,7 @@ being built. Fixed a memory leak in the PETSc `N_Vector` clone function. -Fixed a memeory leak in the ARKODE, CVODE, and IDA F77 interfaces when not using +Fixed a memory leak in the ARKODE, CVODE, and IDA F77 interfaces when not using the default nonlinear solver. Fixed a bug in the ARKStep time-stepping module in ARKODE that would result in @@ -2625,7 +2647,7 @@ with sparse direct solvers. #### KINSOL -The Picard iteration return was chanegd to always return the newest iterate upon +The Picard iteration return was changed to always return the newest iterate upon success. A minor bug in the line search was fixed to prevent an infinite loop when the diff --git a/CMakeLists.txt b/CMakeLists.txt index b5cca95afd..61b164f678 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() @@ -186,14 +187,14 @@ include(SundialsSetupCompilers) include(SundialsSetupTPLs) # =============================================================== -# Build options to be proccessed last +# Build options to be processed last # =============================================================== 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/CODEOWNERS b/CODEOWNERS index 8d465ce4e5..e017386f2b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -3,6 +3,6 @@ # These owners will be the default owners for everything in # the repo. Unless a later match takes precedence, -# globabl owners will be requested for review when someone +# global owners will be requested for review when someone # opens a pull request. * @balos1 @gardner48 @cswoodward @drreynolds diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4106e3738b..be273c77a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to SUNDIALS -There are two primary ways of contributing to SUNDIALS. The first way is by particpating +There are two primary ways of contributing to SUNDIALS. The first way is by participating in the development of SUNDIALS directly through contributions of code to the primary [SUNDIALS repository](https://github.com/LLNL/sundials). This is the best way to contribute bug fixes and minor improvements. At this time, the SUNDIALS team does not have the resources diff --git a/README.md b/README.md index c410afb6ca..1d84b9b6e2 100644 --- a/README.md +++ b/README.md @@ -15,50 +15,62 @@ equation (ODE) systems, differential-algebraic equation (DAE) systems, and nonlinear algebraic systems: * ARKODE - for integrating stiff, nonstiff, and multirate ODEs of the form + $$M(t) \\, y' = f_1(t,y) + f_2(t,y), \quad y(t_0) = y_0$$ * CVODE - for integrating stiff and nonstiff ODEs of the form + $$y' = f(t,y), \quad y(t_0) = y_0$$ * CVODES - for integrating and sensitivity analysis (forward and adjoint) of ODEs of the form + $$y' = f(t,y,p), \quad y(t_0) = y_0(p)$$ * IDA - for integrating DAEs of the form + $$F(t,y,y') = 0, \quad y(t_0) = y_0, \quad y'(t_0) = y_0'$$ * IDAS - for integrating and sensitivity analysis (forward and adjoint) of DAEs of the form + $$F(t,y,y',p) = 0, \quad y(t_0) = y_0(p), \quad y'(t_0) = y_0'(p)$$ * KINSOL - for solving nonlinear algebraic systems of the form + $$F(u) = 0 \quad \text{or} \quad G(u) = u$$ ## Installation ## -For installation directions see the [online install guide](https://sundials.readthedocs.io/en/latest/Install_link.html), -the installation chapter in any of the package user guides, or INSTALL_GUIDE.pdf. +For installation directions, see the [getting started](https://sundials.readthedocs.io/en/latest/sundials/index.html#getting-started) +section in the online documentation. In the [released tarballs](https://github.com/LLNL/sundials/releases), +installation directions are also available in `INSTALL_GUIDE.pdf` and the +installation chapter of the user guides in the `doc` directory. Warning to users who receive more than one of the individual packages at -different times: Mixing old and new versions of SUNDIALS may fail. To avoid -such failures, obtain all desired package at the same time. +different times: Mixing old and new versions of SUNDIALS may fail. To avoid such +failures, obtain all desired package at the same time. ## Support ## -Full user guides for all of the SUNDIALS packages are available [online](https://sundials.readthedocs.io) -and in the [doc](./doc) directory. Additionally, the [doc](./doc) directory -contains documentation for the package example programs. +Full user guides for all of the SUNDIALS packages are available [online](https://sundials.readthedocs.io). +In the [released tarballs](https://github.com/LLNL/sundials/releases), the `doc` +directory includes PDFs of the user guides and documentation for the example +programs. The example program documentation PDFs are also available on the +[releases page](https://github.com/LLNL/sundials/releases). For information on recent changes to SUNDIALS see the [CHANGELOG](./CHANGELOG.md) or the introduction chapter of any package user guide. A list of Frequently Asked Questions on build and installation procedures as -well as common usage issues is available on the SUNDIALS [FAQ](https://computing.llnl.gov/projects/sundials/faq). -For dealing with systems with unphysical solutions or discontinuities see the -SUNDIALS [usage notes](https://computing.llnl.gov/projects/sundials/usage-notes). +well as common usage issues is available on the SUNDIALS +[FAQ](https://computing.llnl.gov/projects/sundials/faq). For dealing with +systems with nonphysical solutions or discontinuities see the SUNDIALS +[usage notes](https://computing.llnl.gov/projects/sundials/usage-notes). -If you have a question not covered in the FAQ or usage notes, please submit -your question to the SUNDIALS [mailing list](https://computing.llnl.gov/projects/sundials/mailing-list). +If you have a question not covered in the FAQ or usage notes, please submit your +question as a [GitHub issue](https://github.com/LLNL/sundials/issues) or to the +SUNDIALS [mailing list](https://computing.llnl.gov/projects/sundials/mailing-list). ## Contributing ## @@ -76,14 +88,15 @@ any publications reporting work done using SUNDIALS packages. The SUNDIALS library has been developed over many years by a number of contributors. The current SUNDIALS team consists of Cody J. Balos, -David J. Gardner, Alan C. Hindmarsh, Daniel R. Reynolds, and Carol S. Woodward. -We thank Radu Serban for significant and critical past contributions. +David J. Gardner, Alan C. Hindmarsh, Daniel R. Reynolds, Steven B. Roberts, and +Carol S. Woodward. We thank Radu Serban for significant and critical past +contributions. Other contributors to SUNDIALS include: James Almgren-Bell, Lawrence E. Banks, Peter N. Brown, George Byrne, Rujeko Chinomona, Scott D. Cohen, Aaron Collier, Keith E. Grant, Steven L. Lee, Shelby L. Lockhart, John Loffeld, Daniel McGreer, -Yu Pan, Slaven Peles, Cosmin Petra, Steven B. Roberts, H. Hunter Schwartz, -Jean M. Sexton, Dan Shumaker, Steve G. Smith, Shahbaj Sohal, Allan G. Taylor, +Yu Pan, Slaven Peles, Cosmin Petra, H. Hunter Schwartz, Jean M. Sexton, +Dan Shumaker, Steve G. Smith, Shahbaj Sohal, Allan G. Taylor, Hilari C. Tiedeman, Chris White, Ting Yan, and Ulrike M. Yang. ## License ## @@ -93,7 +106,7 @@ and [NOTICE](./NOTICE) files for details. All new contributions must be made under the BSD 3-clause license. **Please Note** If you are using SUNDIALS with any third party libraries linked -in (e.g., LAPACK, KLU, SuperLU_MT, PETSc, or *hypre*), be sure to review the +in (e.g., LAPACK, KLU, SuperLU_MT, PETSc, *hypre*, etc.), be sure to review the respective license of the package as that license may have more restrictive terms than the SUNDIALS license. 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/kokkos/ParallelGrid.hpp b/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp index 7bbf8743a7..78fafd71ad 100644 --- a/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp @@ -72,7 +72,7 @@ class ParallelGrid public: // Constructor that creates a new ParallelGrid object. // [in] - the memory helper to use for allocating the MPI buffers - // [in,out] comm - on input, the overal MPI communicator, on output, the cartesian communicator + // [in,out] comm - on input, the overall MPI communicator, on output, the cartesian communicator // [in] a[] - an array of length 3 which defines the domain [a,b] // [in] b[] - an array of length 3 which defines the domain [a,b] // [in] npts[] - an array of length 3 which defines the number of mesh points in each dimension @@ -563,7 +563,7 @@ class ParallelGrid GLOBALINT nx, ny, nz; /* number of intervals globally */ int nxl, nyl, nzl; /* number of intervals locally */ - int npx, npy, npz; /* numner of processes */ + int npx, npy, npz; /* number of processes */ sunrealtype dx, dy, dz; /* mesh spacing */ sunrealtype ax, ay, az; /* domain in [a, b] */ sunrealtype bx, by, bz; diff --git a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp index 2001c2736a..4f606bd7bf 100644 --- a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp @@ -33,7 +33,7 @@ typedef struct SUNNonlinearSolver local_nls; }* TaskLocalNewton_Content; -/* Content accessor macors */ +/* Content accessor macros */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) #define LOCAL_NLS(NLS) (GET_NLS_CONTENT(NLS)->local_nls) diff --git a/benchmarks/advection_reaction_3D/kokkos/check_retval.h b/benchmarks/advection_reaction_3D/kokkos/check_retval.h index b72575c517..a64f816976 100644 --- a/benchmarks/advection_reaction_3D/kokkos/check_retval.h +++ b/benchmarks/advection_reaction_3D/kokkos/check_retval.h @@ -23,7 +23,7 @@ * opt == 0 means the function allocates memory and returns a * pointer so check if a NULL pointer was returned * opt == 1 means the function returns an integer where a - * value < 0 indicates an error occured + * value < 0 indicates an error occurred * --------------------------------------------------------------*/ static int check_retval(void* returnvalue, const char* funcname, int opt, int myid) { diff --git a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp index 0dee917835..ea714ecaeb 100644 --- a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp @@ -23,7 +23,7 @@ * --------------------------------------------------------------*/ /* Compute the advection term f(t,y) = -c (grad * y). This is done using - upwind 1st order finite differences. At present, only periodic boudary + upwind 1st order finite differences. At present, only periodic boundary conditions are supported, which are handled via MPI's Cartesian communicator (even for serial runs). */ static int Advection(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) 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/raja/ParallelGrid.hpp b/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp index e818194047..f234aa089a 100644 --- a/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp +++ b/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp @@ -45,7 +45,7 @@ class ParallelGrid public: // Constructor that creates a new ParallelGrid object. // [in] - the memory helper to use for allocating the MPI buffers - // [in,out] comm - on input, the overal MPI communicator, on output, the cartesian communicator + // [in,out] comm - on input, the overall MPI communicator, on output, the cartesian communicator // [in] a[] - an array of length 3 which defines the domain [a,b] // [in] b[] - an array of length 3 which defines the domain [a,b] // [in] npts[] - an array of length 3 which defines the number of mesh points in each dimension @@ -508,7 +508,7 @@ class ParallelGrid GLOBALINT nx, ny, nz; /* number of intervals globally */ int nxl, nyl, nzl; /* number of intervals locally */ - int npx, npy, npz; /* numner of processes */ + int npx, npy, npz; /* number of processes */ REAL dx, dy, dz; /* mesh spacing */ REAL ax, ay, az; /* domain in [a, b] */ REAL bx, by, bz; diff --git a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp index 8499be6f0b..2caa282af9 100644 --- a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp +++ b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp @@ -89,7 +89,7 @@ struct UserData N_Vector vmask; N_Vector wmask; - /* problem paramaters */ + /* problem parameters */ sunrealtype xmax; /* maximum x value */ sunrealtype A; /* concentration of species A */ sunrealtype B; /* w source rate */ diff --git a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp index 49dcc6d8cf..420c9d63c9 100644 --- a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp @@ -33,7 +33,7 @@ typedef struct SUNNonlinearSolver local_nls; }* TaskLocalNewton_Content; -/* Content accessor macors */ +/* Content accessor macros */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) #define LOCAL_NLS(NLS) (GET_NLS_CONTENT(NLS)->local_nls) diff --git a/benchmarks/advection_reaction_3D/raja/check_retval.h b/benchmarks/advection_reaction_3D/raja/check_retval.h index b72575c517..a64f816976 100644 --- a/benchmarks/advection_reaction_3D/raja/check_retval.h +++ b/benchmarks/advection_reaction_3D/raja/check_retval.h @@ -23,7 +23,7 @@ * opt == 0 means the function allocates memory and returns a * pointer so check if a NULL pointer was returned * opt == 1 means the function returns an integer where a - * value < 0 indicates an error occured + * value < 0 indicates an error occurred * --------------------------------------------------------------*/ static int check_retval(void* returnvalue, const char* funcname, int opt, int myid) { 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/diffusion_2D.cpp b/benchmarks/diffusion_2D/diffusion_2D.cpp index bd18cf1dfb..2a64400938 100644 --- a/benchmarks/diffusion_2D/diffusion_2D.cpp +++ b/benchmarks/diffusion_2D/diffusion_2D.cpp @@ -11,7 +11,7 @@ * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End * ----------------------------------------------------------------------------- - * Shared implementaiton file for 2D diffusion benchmark problem + * Shared implementation file for 2D diffusion benchmark problem * ---------------------------------------------------------------------------*/ #include "diffusion_2D.hpp" diff --git a/benchmarks/diffusion_2D/diffusion_2D.hpp b/benchmarks/diffusion_2D/diffusion_2D.hpp index 1ebb3394aa..a27c004e63 100644 --- a/benchmarks/diffusion_2D/diffusion_2D.hpp +++ b/benchmarks/diffusion_2D/diffusion_2D.hpp @@ -159,7 +159,7 @@ struct UserData sunrealtype* Ssend = NULL; sunrealtype* Nsend = NULL; - // Send requests for neighor exchange + // Send requests for neighbor exchange MPI_Request reqSW; MPI_Request reqSE; MPI_Request reqSS; @@ -192,7 +192,7 @@ struct UserData struct UserOutput { - // Ouput variables + // Output variables int output = 1; // 0 = no output, 1 = stats output, 2 = output to disk int nout = 20; // number of output times N_Vector error = NULL; // error vector diff --git a/benchmarks/diffusion_2D/main_arkode.cpp b/benchmarks/diffusion_2D/main_arkode.cpp index c35bf9e9c7..39c6274a6e 100644 --- a/benchmarks/diffusion_2D/main_arkode.cpp +++ b/benchmarks/diffusion_2D/main_arkode.cpp @@ -329,7 +329,7 @@ int main(int argc, char* argv[]) sunrealtype dTout = udata.tf / uout.nout; sunrealtype tout = dTout; - // Inital output + // Initial output flag = uout.open(&udata); if (check_flag(&flag, "UserOutput::open", 1)) { return 1; } @@ -524,7 +524,7 @@ void UserOptions::help() cout << endl; cout << "Integrator command line options:" << endl; cout << " --rtol : relative tolerance" << endl; - cout << " --atol : absoltue tolerance" << endl; + cout << " --atol : absolute tolerance" << endl; cout << " --nonlinear : disable linearly implicit flag" << endl; cout << " --order : method order" << endl; cout << " --fixedstep : used fixed step size" << endl; diff --git a/benchmarks/diffusion_2D/main_cvode.cpp b/benchmarks/diffusion_2D/main_cvode.cpp index 71172e4ce9..47420cdc98 100644 --- a/benchmarks/diffusion_2D/main_cvode.cpp +++ b/benchmarks/diffusion_2D/main_cvode.cpp @@ -310,7 +310,7 @@ int main(int argc, char* argv[]) sunrealtype dTout = udata.tf / uout.nout; sunrealtype tout = dTout; - // Inital output + // Initial output flag = uout.open(&udata); if (check_flag(&flag, "UserOutput::open", 1)) { return 1; } @@ -479,7 +479,7 @@ void UserOptions::help() cout << endl; cout << "Integrator command line options:" << endl; cout << " --rtol : relative tolerance" << endl; - cout << " --atol : absoltue tolerance" << endl; + cout << " --atol : absolute tolerance" << endl; cout << " --ls : linear solver" << endl; cout << " --lsinfo : output residual history" << endl; cout << " --liniters : max number of iterations" << endl; diff --git a/benchmarks/diffusion_2D/main_ida.cpp b/benchmarks/diffusion_2D/main_ida.cpp index 515256ddd9..ccd86c7ad5 100644 --- a/benchmarks/diffusion_2D/main_ida.cpp +++ b/benchmarks/diffusion_2D/main_ida.cpp @@ -305,7 +305,7 @@ int main(int argc, char* argv[]) sunrealtype dTout = udata.tf / uout.nout; sunrealtype tout = dTout; - // Inital output + // Initial output flag = uout.open(&udata); if (check_flag(&flag, "UserOutput::open", 1)) { return 1; } @@ -460,7 +460,7 @@ void UserOptions::help() cout << endl; cout << "Integrator command line options:" << endl; cout << " --rtol : relative tolerance" << endl; - cout << " --atol : absoltue tolerance" << endl; + cout << " --atol : absolute tolerance" << endl; cout << " --ls : linear solver" << endl; cout << " --liniters : max number of iterations" << endl; cout << " --epslin : linear tolerance factor" << endl; 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..c5e9f69301 100755 --- a/benchmarks/nvector/plot_nvector_performance_results.py +++ b/benchmarks/nvector/plot_nvector_performance_results.py @@ -15,11 +15,12 @@ # This script plots the output from test_nector_performance_* and assumes: # 1. vector lengths are powers of two starting from 0, and # 2. output files are named: output_nelem_nvec_nsum_ntest_timing.txt -# where nelem is the number of elements in the vector, nvec is the nuber of +# where nelem is the number of elements in the vector, nvec is the number of # vectors, nsum is the number of sums, ntest is the number of tests, and timing # 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..baaaf43682 100755 --- a/benchmarks/nvector/plot_nvector_performance_speedup.py +++ b/benchmarks/nvector/plot_nvector_performance_speedup.py @@ -15,11 +15,12 @@ # This script plots the output from test_nector_performance_* and assumes: # 1. vector lengths are powers of two starting from 0, and # 2. output files are named: output_nelem_nvec_nsum_ntest_timing.txt -# where nelem is the number of elements in the vector, nvec is the nuber of +# where nelem is the number of elements in the vector, nvec is the number of # vectors, nsum is the number of sums, ntest is the number of tests, and timing # 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/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp b/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp index 0691d036e4..52b12e966f 100644 --- a/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp +++ b/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) ? "Yes" : "No") << std::endl; - std::cout << " suports usm shared allocations? " + std::cout << " supports usm shared allocations? " << (dev.get_info<::sycl::info::device::usm_shared_allocations>() ? "Yes" : "No") diff --git a/benchmarks/nvector/test_nvector_performance.h b/benchmarks/nvector/test_nvector_performance.h index 23af102a8e..74528b749d 100644 --- a/benchmarks/nvector/test_nvector_performance.h +++ b/benchmarks/nvector/test_nvector_performance.h @@ -17,7 +17,7 @@ #include -/* define constatnts */ +/* define constants */ #define NEG_ONE SUN_RCONST(-1.0) #define ZERO SUN_RCONST(0.0) #define ONE SUN_RCONST(1.0) diff --git a/cmake/SundialsBuildOptionsPost.cmake b/cmake/SundialsBuildOptionsPost.cmake index 01d6969bc6..e914eefd1f 100644 --- a/cmake/SundialsBuildOptionsPost.cmake +++ b/cmake/SundialsBuildOptionsPost.cmake @@ -11,13 +11,13 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------- -# SUNDIALS build options that are interepreted after all other +# SUNDIALS build options that are interpreted after all other # CMake configuration. # --------------------------------------------------------------- # --------------------------------------------------------------- -# 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..96e17ea087 100644 --- a/cmake/SundialsBuildOptionsPre.cmake +++ b/cmake/SundialsBuildOptionsPre.cmake @@ -11,7 +11,7 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------- -# SUNDIALS build options that are interepreted prior to any +# SUNDIALS build options that are interpreted prior to any # other CMake configuration. # --------------------------------------------------------------- @@ -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..017e867c73 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() @@ -147,10 +180,12 @@ endif() # if(DEFINED CUDA_ARCH) - print_warning("The CMake option CUDA_ARCH is deprecated. " - "Use CMAKE_CUDA_ARCHITECTURES instead.") + message(DEPRECATION "The CMake option CUDA_ARCH is deprecated. " + "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..187e597d40 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}") @@ -44,7 +41,7 @@ set(DOCSTR "Enable C++ compiler specific extensions") sundials_option(CMAKE_CXX_EXTENSIONS BOOL "${DOCSTR}" ON) message(STATUS "C++ extensions set to ${CMAKE_CXX_EXTENSIONS}") -# SYCL requries C++17 +# SYCL requires C++17 if(ENABLE_SYCL AND (CMAKE_CXX_STANDARD LESS "17")) message(SEND_ERROR "CMAKE_CXX_STANDARD must be >= 17 because ENABLE_SYCL=ON") endif() diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index 7790f61609..aad26bdaf7 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -21,16 +21,16 @@ include(SundialsIndexSize) # =============================================================== -# Platform specifc settings +# Platform specific settings # =============================================================== 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 + # insecure 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..ef01d0faba 100644 --- a/cmake/SundialsSetupCuda.cmake +++ b/cmake/SundialsSetupCuda.cmake @@ -11,7 +11,7 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------- -# Setup the CUDA languge and CUDA libraries. +# Setup the CUDA language and CUDA libraries. # --------------------------------------------------------------- # =============================================================== @@ -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..9d186c887f 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? @@ -47,10 +46,6 @@ sundials_option(ENABLE_PTHREAD BOOL "Enable Pthreads support" OFF) # ------------------------------------------------------------- sundials_option(ENABLE_CUDA BOOL "Enable CUDA support" OFF) -# CMake 3.18 adds this option. -sundials_option(CMAKE_CUDA_ARCHITECTURES STRING "Target CUDA architecture" "70" - DEPENDS_ON ENABLE_CUDA) - # ------------------------------------------------------------- # Enable HIP support? # ------------------------------------------------------------- @@ -61,112 +56,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 +204,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 +222,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 +254,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 +311,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 +338,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 +366,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 +391,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 +406,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..f28780129f 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. Specifically, 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..12d7b550b1 100644 --- a/cmake/tpl/SundialsHypre.cmake +++ b/cmake/tpl/SundialsHypre.cmake @@ -37,11 +37,12 @@ endif() # ----------------------------------------------------------------------------- if(ENABLE_HYPRE) - # Using hypre requres building with MPI enabled + # Using hypre requires 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 + # Using hypre requires C99 or newer if(CMAKE_C_STANDARD STREQUAL "90") message(SEND_ERROR "CMAKE_C_STANDARD must be >= c99 with ENABLE_HYPRE=ON") endif() @@ -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..ecc3e4475b 100644 --- a/cmake/tpl/SundialsLapack.cmake +++ b/cmake/tpl/SundialsLapack.cmake @@ -11,7 +11,7 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ----------------------------------------------------------------------------- -# Module to find and setup LAPACK/BLAS corrrectly. +# Module to find and setup LAPACK/BLAS correctly. # Created from the SundialsTPL.cmake template. # All SUNDIALS modules that find and setup a TPL must: # @@ -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" @@ -159,28 +160,30 @@ if(NEED_FORTRAN_NAME_MANGLING) list(LENGTH options imax) set(iopt 0) - # We will attempt to sucessfully generate the "ctest1" executable as long as - # there still are entries in the "options" list + # We will attempt to successfully generate the "ctest1" executable as long + # as there still are entries in the "options" list 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/arkode/examples/source/c_serial.rst b/doc/arkode/examples/source/c_serial.rst index 4a9fce62cf..81d8b6b248 100644 --- a/doc/arkode/examples/source/c_serial.rst +++ b/doc/arkode/examples/source/c_serial.rst @@ -326,7 +326,7 @@ The problem implements the following testing scenario: :math:`u_0=1.2`, Numerical method ---------------- -This program solves the problem with the default thrid order method. +This program solves the problem with the default third order method. The problem is run using a fixed slow step size :math:`hs=0.025` and fast step size :math:`0.001`. @@ -854,7 +854,7 @@ is the product of two matrices: only a subset of the :math:`3\times3` blocks). Four different runs are made for this problem. The product -preconditoner is applied on the left and on the right. In each case, +preconditioner is applied on the left and on the right. In each case, both the modified and classical Gram-Schmidt orthogonalization options are tested. In the series of runs, ``ARKodeInit``, ``SUNSPGMR``, ``ARKSpilsSetLinearSolver``, ``SUNSPGMRSetGSType``, diff --git a/doc/arkode/examples/source/conf.py b/doc/arkode/examples/source/conf.py index 826730c1f7..703861d658 100644 --- a/doc/arkode/examples/source/conf.py +++ b/doc/arkode/examples/source/conf.py @@ -442,7 +442,7 @@ texinfo_documents = [ ('index', 'ARKODE_example', u'ARKODE Example Documentation', u'Daniel R. Reynolds', 'ARKODE_example', - 'Example programs for the ARKODE time integration package for multi-rate systems of ordinary differntial equations.', + 'Example programs for the ARKODE time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/arkode/guide/source/Butcher.rst b/doc/arkode/guide/source/Butcher.rst index 678510cd4f..0b7e401a56 100644 --- a/doc/arkode/guide/source/Butcher.rst +++ b/doc/arkode/guide/source/Butcher.rst @@ -915,7 +915,7 @@ or :c:func:`ARKodeButcherTable_LoadERK`. Accessible via the string ``"ARKODE_VERNER_8_5_6"`` to :c:func:`ARKStepSetTableName`, :c:func:`ERKStepSetTableName` or :c:func:`ARKodeButcherTable_LoadERKByName`. -This is the default 6th order explicit method (from :cite:p:`Ver:78`). +This is the default 6th order explicit method (from :cite:p:`HEJ:76`). .. math:: diff --git a/doc/arkode/guide/source/Mathematics.rst b/doc/arkode/guide/source/Mathematics.rst index ddbd7c4122..9d9835c53d 100644 --- a/doc/arkode/guide/source/Mathematics.rst +++ b/doc/arkode/guide/source/Mathematics.rst @@ -548,7 +548,7 @@ can be ignored). Optionally, a different algorithm leveraging compensated summation can be used that is more robust to roundoff error at the expense of 2 extra vector operations per stage and an additional 5 per time step. It also requires one extra vector to -be stored. However, it is signficantly more robust to roundoff error accumulation +be stored. However, it is significantly more robust to roundoff error accumulation :cite:p:`Sof:02`. When compensated summation is enabled, the following incremental form is used to compute a time step: diff --git a/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst index a6c07ac5e6..5a21f7ea15 100644 --- a/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst @@ -841,7 +841,7 @@ Optional inputs for ARKStep The default is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for - ``tstop`` is disabled (and can be reenabled only though a new call to + ``tstop`` is disabled (and can be re-enabled only though a new call to :c:func:`ARKStepSetStopTime`). A stop time not reached before a call to :c:func:`ARKStepReInit` or @@ -886,7 +886,7 @@ Optional inputs for ARKStep * *ARK_MEM_NULL* if the ARKStep memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`ARKStepSetStopTime`. .. versionadded:: 5.5.1 diff --git a/doc/arkode/guide/source/Usage/ARKStep/XBraid.rst b/doc/arkode/guide/source/Usage/ARKStep/XBraid.rst index 665610283a..8245f0efc9 100644 --- a/doc/arkode/guide/source/Usage/ARKStep/XBraid.rst +++ b/doc/arkode/guide/source/Usage/ARKStep/XBraid.rst @@ -79,9 +79,9 @@ operations (e.g., computing vector sums or norms) as well as functions to initialize the problem state, access the current solution, and take a time step. The ARKBraid interface, built on the SUNBraidApp and SUNBraidVector structures, -provides all the functionaly needed combine ARKODE and XBraid for +provides all the functionality needed combine ARKODE and XBraid for parallel-in-time integration. As such, only a minimal number of changes are -necessary to update an exsting code that uses ARKODE to also use XBraid. +necessary to update an existing code that uses ARKODE to also use XBraid. @@ -123,7 +123,7 @@ Here, the SUNBraidOps structure is defined as typedef struct _SUNBraidOps *SUNBraidOps; The generic SUNBraidApp defines and implements the generic operations acting on -a SUNBraidApp obejct. These generic functions are nothing but wrappers to access +a SUNBraidApp object. These generic functions are nothing but wrappers to access the specific implementation through the object's operations structure. To illustrate this point we show below the implementation of the :c:func:`SUNBraidApp_GetVecTmpl()` function: @@ -876,7 +876,7 @@ A skeleton of the user's main program with XBraid In addition to the header files required for the integration of the ODE problem (see the section :numref:`ARKODE.Usage.Headers`), to use the ARKBraid -interace, the user's program must include the header file +interface, the user's program must include the header file ``arkode/arkode_xbraid.h`` which declares the needed function prototypes. The following is a skeleton of the user's main program (or calling program) for @@ -965,7 +965,7 @@ Advanced ARKBraid Utility Functions This section describes utility functions utilized in the ARKODE + XBraid interfacing. These functions are used internally by the above ARKBraid interface functions but are exposed to the user to assist in advanced usage of -ARKODE and XBraid that requries defining a custom SUNBraidApp implementation. +ARKODE and XBraid that requires defining a custom SUNBraidApp implementation. diff --git a/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst index 017aa17110..5bbb3e1f63 100644 --- a/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst @@ -625,7 +625,7 @@ Optional inputs for ERKStep The default is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for - ``tstop`` is disabled (and can be reenabled only though a new call to + ``tstop`` is disabled (and can be re-enabled only though a new call to :c:func:`ERKStepSetStopTime`). A stop time not reached before a call to :c:func:`ERKStepReInit` or @@ -672,7 +672,7 @@ Optional inputs for ERKStep * *ARK_MEM_NULL* if the ERKStep memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`ERKStepSetStopTime`. .. versionadded:: 5.5.1 diff --git a/doc/arkode/guide/source/Usage/MRIStep/MRIStepCoupling.rst b/doc/arkode/guide/source/Usage/MRIStep/MRIStepCoupling.rst index 88fb32a748..53d5a8c7d5 100644 --- a/doc/arkode/guide/source/Usage/MRIStep/MRIStepCoupling.rst +++ b/doc/arkode/guide/source/Usage/MRIStep/MRIStepCoupling.rst @@ -24,7 +24,7 @@ supply a custom set of slow-to-fast time scale coupling coefficients by constructing a coupling table and attaching it with :c:func:`MRIStepSetCoupling`. The MRI coupling tables are stored in an :c:func:`MRIStepCoupling` object which is a pointer to a -:c:struct:`MRIStepCouplingMem` strucutre: +:c:struct:`MRIStepCouplingMem` structure: .. c:type:: MRIStepCouplingMem *MRIStepCoupling diff --git a/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst index 95f13fb608..bf00365669 100644 --- a/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst @@ -23,7 +23,7 @@ by the user to setup and then solve an IVP using the MRIStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and are now deprecated -- each of these are clearly marked. However, some -of these user-callable functions are specific to ERKStep, as explained +of these user-callable functions are specific to MRIStep, as explained below. As discussed in the main :ref:`ARKODE user-callable function introduction @@ -303,7 +303,7 @@ Rootfinding initialization function *nrtfn = 0*. Rootfinding is only supported for the slow (outer) integrator and should not - be actived for the fast (inner) integrator. + be activated for the fast (inner) integrator. .. deprecated:: 6.1.0 @@ -676,7 +676,7 @@ Optional inputs for MRIStep The default is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for - ``tstop`` is disabled (and can be reenabled only though a new call to + ``tstop`` is disabled (and can be re-enabled only though a new call to :c:func:`MRIStepSetStopTime`). A stop time not reached before a call to :c:func:`MRIStepReInit` or @@ -723,7 +723,7 @@ Optional inputs for MRIStep * *ARK_MEM_NULL* if the MRIStep memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`MRIStepSetStopTime`. .. versionadded:: 5.5.1 @@ -830,7 +830,7 @@ Optional inputs for IVP method selection Select the default MRI method of a given order. - The default order is 3. An order less than 3 or greater than 4 will result in + The default order is 3. An order less than 1 or greater than 4 will result in using the default. **Arguments:** diff --git a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst index d8f4dec8f9..7d5950fa77 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst @@ -20,7 +20,7 @@ by the user to setup and then solve an IVP using the SPRKStep time-stepping module. The large majority of these routines merely wrap :ref:`underlying ARKODE functions `, and are now deprecated -- each of these are clearly marked. However, some -of these user-callable functions are specific to ERKStep, as explained +of these user-callable functions are specific to SPRKStep, as explained below. As discussed in the main :ref:`ARKODE user-callable function introduction @@ -336,7 +336,7 @@ Optional inputs for SPRKStep The default is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for - ``tstop`` is disabled (and can be reenabled only though a new call to + ``tstop`` is disabled (and can be re-enabled only though a new call to :c:func:`SPRKStepSetStopTime`). A stop time not reached before a call to :c:func:`SPRKStepReInit` or @@ -359,7 +359,7 @@ Optional inputs for SPRKStep Disables the stop time set with :c:func:`SPRKStepSetStopTime`. - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`SPRKStepSetStopTime`. :param arkode_mem: pointer to the SPRKStep memory block. @@ -486,7 +486,7 @@ Optional inputs for IVP method selection This increases the computational cost by 2 extra vector operations per stage and an additional 5 per time step. It also requires one extra vector to be - stored. However, it is signficantly more robust to roundoff error + stored. However, it is significantly more robust to roundoff error accumulation. :param arkode_mem: pointer to the SPRKStep memory block. diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index fd9261eaa3..fd9b572382 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -1235,7 +1235,7 @@ Set max number of constraint failures :c:func:`ARKodeSetMaxNumConstr The default is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for - ``tstop`` is disabled (and can be reenabled only though a new call to + ``tstop`` is disabled (and can be re-enabled only though a new call to :c:func:`ARKodeSetStopTime`). A stop time not reached before a call to ``*StepReInit`` or @@ -1271,7 +1271,7 @@ Set max number of constraint failures :c:func:`ARKodeSetMaxNumConstr .. note:: - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`ARKodeSetStopTime`. .. versionadded:: 6.1.0 diff --git a/doc/arkode/guide/source/conf.py b/doc/arkode/guide/source/conf.py index a0817d416f..2975c7bd36 100644 --- a/doc/arkode/guide/source/conf.py +++ b/doc/arkode/guide/source/conf.py @@ -290,7 +290,7 @@ texinfo_documents = [ ('index', 'ARKODE', u'ARKODE Documentation', u'Daniel R. Reynolds, David J. Gardner, Carol S. Woodward, Rujeko Chinomona, and Cody J. Balos', 'ARKODE', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/arkode/guide/source/sunlinsol/ARKODE_interface.rst b/doc/arkode/guide/source/sunlinsol/ARKODE_interface.rst index ea807ed00c..ab90aae357 100644 --- a/doc/arkode/guide/source/sunlinsol/ARKODE_interface.rst +++ b/doc/arkode/guide/source/sunlinsol/ARKODE_interface.rst @@ -184,7 +184,7 @@ In certain instances, users may wish to provide a custom SUNLinSol implementation to ARKODE in order to leverage the structure of a problem. While the "standard" API for these routines is typically sufficient for most users, others may need additional ARKODE-specific information on top of what is -provided. For these purposes, we note the following advanced ouptut functions +provided. For these purposes, we note the following advanced output functions available in ARKStep and MRIStep: diff --git a/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst b/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst index 92046f510c..5d0f0b02f3 100644 --- a/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst +++ b/doc/arkode/guide/source/sunnonlinsol/ARKODE_interface.rst @@ -141,7 +141,7 @@ of user-supplied SUNNonlinSol modules are as follows. This is only compatible with time-stepping modules that support implicit algebraic solvers. - This routine is intended for users who whish to attach a custom + This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to nonlinear system data to compute the nonlinear system function as part of @@ -150,7 +150,7 @@ of user-supplied SUNNonlinSol modules are as follows. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`ARKodeGetNonlinearSystemData()` **inside** the nonlinear system - function to access the requisite data for evaluting the nonlinear systen + function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` functions supplied by ARKODE (through @@ -259,7 +259,7 @@ of user-supplied SUNNonlinSol modules are as follows. .. note:: - This routine is intended for users who whish to attach a custom + This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to nonlinear system data to compute the nonlinear system function as part of @@ -268,7 +268,7 @@ of user-supplied SUNNonlinSol modules are as follows. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`ARKStepGetNonlinearSystemData()` **inside** the nonlinear system - function to access the requisite data for evaluting the nonlinear systen + function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` functions supplied by ARKStep (through @@ -362,7 +362,7 @@ of user-supplied SUNNonlinSol modules are as follows. .. note:: - This routine is intended for users who whish to attach a custom + This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn()`) or who need access to nonlinear system data to compute the nonlinear system function as part of @@ -371,7 +371,7 @@ of user-supplied SUNNonlinSol modules are as follows. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`MRIStepGetNonlinearSystemData()` **inside** the nonlinear system - function to access the requisite data for evaluting the nonlinear systen + function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` functions supplied by MRIStep (through diff --git a/doc/cvode/cv_ex_cuda.tex b/doc/cvode/cv_ex_cuda.tex index 26578e73d2..c6a0e0645a 100644 --- a/doc/cvode/cv_ex_cuda.tex +++ b/doc/cvode/cv_ex_cuda.tex @@ -28,7 +28,7 @@ \subsection{An unpreconditioned Krylov example: cvAdvDiff\_kry\_cuda}\label{ss:c model at the device. In the example, model right hand side and Jacobian-vector product are implemented as {\cuda} kernels \id{fKernel} and \id{jtvKernel}, respectively. User provided {\CC} functions \id{f} and \id{jtv}, which are called -directly by {\cvode}, set thread partitioning and launch thier respective +directly by {\cvode}, set thread partitioning and launch their respective {\cuda} kernels. Vector data on the device is accessed using \id{N\_VGetDeviceArrayPointer\_Cuda} function. diff --git a/doc/cvode/cv_ex_intro.tex b/doc/cvode/cv_ex_intro.tex index e761486efd..efd01e2b72 100644 --- a/doc/cvode/cv_ex_intro.tex +++ b/doc/cvode/cv_ex_intro.tex @@ -121,7 +121,7 @@ \section{Introduction}\label{s:ex_intro} interaction terms only, using block-grouping. \newline Four different runs are made for this problem. - The product preconditoner is applied on the left and on the right. + The product preconditioner is applied on the left and on the right. In each case, both the modified and classical Gram-Schmidt options are tested. \item \id{cvHeat2D\_klu} solves a discretized 2D heat equation using diff --git a/doc/cvode/cv_ex_parallel.tex b/doc/cvode/cv_ex_parallel.tex index 146df50eba..d2a5102456 100644 --- a/doc/cvode/cv_ex_parallel.tex +++ b/doc/cvode/cv_ex_parallel.tex @@ -149,7 +149,7 @@ \subsection{A user preconditioner example: cvDiurnal\_kry\_p}\label{ss:cvDiurnal iteration and {\spgmr}. The left preconditioner is the block-diagonal part of the Newton matrix, with $2 \times 2$ blocks, and the corresponding diagonal blocks of the Jacobian are saved each time the -preconditioner is generated, for re-use later under certain conditions. +preconditioner is generated, for reuse later under certain conditions. The organization of the \id{cvDiurnal\_kry\_p} program deserves some comments. The right-hand side routine \id{f} calls two other routines: \id{ucomm}, which diff --git a/doc/cvode/cv_ex_serial.tex b/doc/cvode/cv_ex_serial.tex index 35d62d5f79..4e48db6c25 100644 --- a/doc/cvode/cv_ex_serial.tex +++ b/doc/cvode/cv_ex_serial.tex @@ -79,7 +79,7 @@ \subsection{A dense example: cvRoberts\_dns}\label{ss:cvRoberts} \id{SUNLinearSolver}. The next several lines allocate memory for the \id{y} and \id{abstol} vectors using \id{N\_VNew\_Serial} with a length argument of \id{NEQ} ($= 3$). The -lines following that load the initial values of the dependendent +lines following that load the initial values of the dependent variable vector into \id{y} and the absolute tolerances into \id{abstol} using the \id{Ith} macro. @@ -492,14 +492,14 @@ \subsection{A Krylov example: cvDiurnal\_kry}\label{ss:cvDiurnal} to allocate space for $J_{bd}$, $P$, and the pivot arrays; \id{InitUserData} to load problem constants in the \id{data} block; \id{FreeUserData} to free that block; \id{SetInitialProfiles} to load the initial values in \id{y}; -\id{PrintOutput} to retreive and print selected solution values and +\id{PrintOutput} to retrieve and print selected solution values and statistics; \id{PrintFinalStats} to print statistics; and \id{check\_flag} to check return values for error conditions. The output generated by \id{cvDiurnal\_kry.c} is shown below. Note that the number of preconditioner evaluations, \id{npe}, is much smaller than the number of preconditioner setups, \id{nsetups}, as a result of the -Jacobian re-use scheme. +Jacobian reuse scheme. %% \includeOutput{cvDiurnal\_dns}{../../examples/cvode/serial/cvDiurnal_kry.out} diff --git a/doc/cvode/cv_ex_tests.tex b/doc/cvode/cv_ex_tests.tex index 8b747c2ff9..177da0e766 100644 --- a/doc/cvode/cv_ex_tests.tex +++ b/doc/cvode/cv_ex_tests.tex @@ -94,7 +94,7 @@ \section{Parallel tests}\label{s:ex_tests} grows. This means that the highly portable MPI version of {\cvode}, with an appropriate choice of MPI implementation, is fully competitive with the Cray-specific version using the SHMEM library. While the overall costs do -not prepresent a well-scaled parallel algorithm (because of the +not represent a well-scaled parallel algorithm (because of the preconditioner choice), the cost per function evaluation is quite flat for EPCC and SHMEM, at .033 to .037 (for MPICH it ranges from .044 to .068). diff --git a/doc/cvode/guide/source/Constants.rst b/doc/cvode/guide/source/Constants.rst index bf2a8a40d5..ebb0971921 100644 --- a/doc/cvode/guide/source/Constants.rst +++ b/doc/cvode/guide/source/Constants.rst @@ -84,7 +84,7 @@ the CVODE output constants. +----------------------------+-----+----------------------------------------------------------------------------------------+ | ``CV_FIRST_RHSFUNC_ERR`` | -9 | The right-hand side function failed at the first call. | +----------------------------+-----+----------------------------------------------------------------------------------------+ - | ``CV_REPTD_RHSFUNC_ERR`` | -10 | The right-hand side function had repetead recoverable errors. | + | ``CV_REPTD_RHSFUNC_ERR`` | -10 | The right-hand side function had repeated recoverable errors. | +----------------------------+-----+----------------------------------------------------------------------------------------+ | ``CV_UNREC_RHSFUNC_ERR`` | -11 | The right-hand side function had a recoverable error, but no recovery is possible. | +----------------------------+-----+----------------------------------------------------------------------------------------+ diff --git a/doc/cvode/guide/source/Introduction.rst b/doc/cvode/guide/source/Introduction.rst index 651efba809..ba5bd22a84 100644 --- a/doc/cvode/guide/source/Introduction.rst +++ b/doc/cvode/guide/source/Introduction.rst @@ -47,7 +47,7 @@ and VODPK have been combined in the C-language package CVODE :cite:p:`CoHi:96`. At present, CVODE may utilize a variety of Krylov methods provided -in SUNDIALS that can be used in conjuction with Newton iteration: +in SUNDIALS that can be used in conjunction with Newton iteration: these include the GMRES (Generalized Minimal RESidual) :cite:p:`SaSc:86`, FGMRES (Flexible Generalized Minimum RESidual) :cite:p:`Saa:93`, Bi-CGStab (Bi-Conjugate diff --git a/doc/cvode/guide/source/Usage/index.rst b/doc/cvode/guide/source/Usage/index.rst index 722e20533e..3c56d48587 100644 --- a/doc/cvode/guide/source/Usage/index.rst +++ b/doc/cvode/guide/source/Usage/index.rst @@ -440,7 +440,7 @@ makes no sense (and is overly costly) after ``y[i]`` is below some noise level. ``abstol`` (if scalar) or ``abstol[i]`` (if a vector) needs to be set to that noise level. If the different components have different noise levels, then ``abstol`` should be a vector. See the example ``cvsRoberts_dns`` in the CVODE package, and the discussion of it in the CVODE Examples document -:cite:p:`cvodes_ex`. In that problem, the three components vary betwen 0 and 1, +:cite:p:`cvodes_ex`. In that problem, the three components vary between 0 and 1, and have different noise levels; hence the ``abstol`` vector. It is impossible to give any general advice on ``abstol`` values, because the appropriate noise levels are completely problem-dependent. The user or modeler hopefully has some idea as to what those @@ -764,7 +764,7 @@ rootfinding. In the ``CV_ONE_STEP`` mode, ``tout`` is used only on the first call, and only to get the direction and a rough scale of the independent variable. - If a stop time is enabled (through a call to ``CVodeSetStopTime``), then ``CVode`` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be reenabled only though a new call to ``CVodeSetStopTime``). + If a stop time is enabled (through a call to ``CVodeSetStopTime``), then ``CVode`` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be re-enabled only though a new call to ``CVodeSetStopTime``). All failure return values are negative and so the test ``flag < 0`` will trap all ``CVode`` failures. @@ -909,7 +909,7 @@ Main solver optional input functions **Arguments:** * ``cvode_mem`` -- pointer to the CVODE memory block. - * ``nst`` -- number of successful steps inbetween calls to the monitor function 0 by default; a 0 input will turn off monitoring. + * ``nst`` -- number of successful steps in between calls to the monitor function 0 by default; a 0 input will turn off monitoring. **Return value:** * ``CV_SUCCESS`` -- The optional value has been successfully set. @@ -1051,7 +1051,7 @@ Main solver optional input functions **Notes:** The default, if this routine is not called, is that no stop time is imposed. - Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be reenabled only though a new call to ``CVodeSetStopTime``). + Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be re-enabled only though a new call to ``CVodeSetStopTime``). A stop time not reached before a call to :c:func:`CVodeReInit` will remain active but can be disabled by calling :c:func:`CVodeClearStopTime`. @@ -1084,7 +1084,7 @@ Main solver optional input functions * ``CV_MEM_NULL`` if the CVODE memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`CVodeSetStopTime`. .. versionadded:: 6.5.1 @@ -2627,7 +2627,7 @@ described next. The values returned in ``ele`` are valid only if :c:func:`CVode` returned a non-negative value. - The ``ele`` vector, togther with the ``eweight`` vector from :c:func:`CVodeGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose components are the products of the components of these two vectors. Thus, for example, if there were recent error test failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. + The ``ele`` vector, together with the ``eweight`` vector from :c:func:`CVodeGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose components are the products of the components of these two vectors. Thus, for example, if there were recent error test failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. @@ -3145,7 +3145,7 @@ solver, a suffix (for Linear Solver) has been added here (e.g. ``lenrwLS``). * ``leniwLS`` -- the number of integer values in the CVDIAG workspace. **Return value:** - * ``CVDIAG_SUCCESS`` -- The optional output valus have been successfully set. + * ``CVDIAG_SUCCESS`` -- The optional output values have been successfully set. * ``CVDIAG_MEM_NULL`` -- The ``cvode_mem`` pointer is ``NULL``. * ``CVDIAG_LMEM_NULL`` -- The CVDIAG linear solver has not been initialized. @@ -3232,7 +3232,7 @@ known, simply make that location a value of tout. To stop when the location of the discontinuity is determined by the solution, use the rootfinding feature. In either case, it is critical that the RHS function *not* incorporate the discontinuity, but rather have a smooth -extention over the discontinuity, so that the step across it (and +extension over the discontinuity, so that the step across it (and subsequent rootfinding, if used) can be done efficiently. Then use a switch within the RHS function (communicated through ``user_data``) that can be flipped between the stopping of the integration and the restart, so that @@ -3383,7 +3383,7 @@ These weights will be used in place of those defined by Eq. .. warning:: - The error weight vector must have all components positive. It is the user's responsiblity to perform this test and return -1 if it is not satisfied. + The error weight vector must have all components positive. It is the user's responsibility to perform this test and return -1 if it is not satisfied. .. _CVODE.Usage.CC.user_fct_sim.rootFn: @@ -3406,7 +3406,7 @@ follows: * ``user_data`` a pointer to user data, the same as the ``user_data`` parameter passed to :c:func:`CVodeSetUserData`. **Return value:** - A ``CVRootFn`` should return 0 if successful or a non-zero value if an error occured (in which case the integration is haled and ``CVode`` returns ``CV_RTFUNC_FAIL``. + A ``CVRootFn`` should return 0 if successful or a non-zero value if an error occurred (in which case the integration is haled and ``CVode`` returns ``CV_RTFUNC_FAIL``. **Notes:** Allocation of memory for ``gout`` is automatically handled within CVODE. @@ -3429,7 +3429,7 @@ user-defined projection operation the projection function must have type * ``t`` -- the current value of the independent variable. * ``ycur`` -- the current value of the dependent variable vector :math:`y(t)`. * ``corr`` -- the correction, :math:`c`, to the dependent variable vector so that :math:`y(t) + c` satisfies the constraint equation. - * ``epsProj`` -- the tolerance to use in the nonlinear solver stopping test when solving the nonlinear constrainted least squares problem. + * ``epsProj`` -- the tolerance to use in the nonlinear solver stopping test when solving the nonlinear constrained least squares problem. * ``err`` -- is on input the current error estimate, if error projection is enabled (the default) then this should be overwritten with the projected error on output. If error projection is disabled then ``err`` is ``NULL``. * ``user_data`` a pointer to user data, the same as the ``user_data`` parameter passed to :c:func:`CVodeSetUserData`. @@ -3934,7 +3934,7 @@ the CVBANDPRE module: **Arguments:** * ``cvode_mem`` -- pointer to the CVODE memory block. - * ``lenrwBP`` -- the number of ``sunrealtype`` values in teh CVBANDPRE workspace. + * ``lenrwBP`` -- the number of ``sunrealtype`` values in the CVBANDPRE workspace. * ``leniwBP`` -- the number of integer values in the CVBANDPRE workspace. **Return value:** diff --git a/doc/cvode/guide/source/conf.py b/doc/cvode/guide/source/conf.py index 3d86ad65cb..4377102f1e 100644 --- a/doc/cvode/guide/source/conf.py +++ b/doc/cvode/guide/source/conf.py @@ -291,7 +291,7 @@ texinfo_documents = [ ('index', 'CVODE', u'CVODE Documentation', u'Alan C. Hindmarsh, Radu Serban, Cody J. Balos, David J. Gardner, Daniel R. Reynolds, and Carol S. Woodward', 'CVODE', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/cvode/guide/source/sunnonlinsol/CVODE_interface.rst b/doc/cvode/guide/source/sunnonlinsol/CVODE_interface.rst index be0259cf57..4300c48f3f 100644 --- a/doc/cvode/guide/source/sunnonlinsol/CVODE_interface.rst +++ b/doc/cvode/guide/source/sunnonlinsol/CVODE_interface.rst @@ -111,7 +111,7 @@ might need access to the current value of :math:`\gamma` to compute Jacobian dat custom ``SUNNonlinearSolver`` object. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`CVodeGetNonlinearSystemData` inside the - nonlinear system function to access the requisite data for evaluting + nonlinear system function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` diff --git a/doc/cvodes/cvs_ex_adj.tex b/doc/cvodes/cvs_ex_adj.tex index 00269acf6f..e7b6fc8ebb 100644 --- a/doc/cvodes/cvs_ex_adj.tex +++ b/doc/cvodes/cvs_ex_adj.tex @@ -132,7 +132,7 @@ \subsection{A serial dense example: cvsRoberts\_ASAi\_dns}\label{ss:cvsRoberts_A checkpoint information printed). The next segment of code deals with the setup of the backward problem. -First, a serial vector \id{yB} of length \id{NEQ} is allocated and initalized with the +First, a serial vector \id{yB} of length \id{NEQ} is allocated and initialized with the value of $\lambda (= 0.0)$ at the final time (\id{TB1} = 4.0E7). A second serial vector \id{qB} of dimension \id{NP} is created and initialized to $0.0$. This vector corresponds to the quadrature variables $\xi$ whose values at $t_0$ @@ -415,7 +415,7 @@ \subsection{A parallel example using CVBBDPRE: cvsAtmDisp\_ASAi\_kry\_bbd\_p} \id{f\_comm}, called in \id{f} and \id{fB} before evaluation of the local residual components. Since there is no additional communication required for the {\cvbbdpre} preconditioner, a \id{NULL} pointer is passed for \id{gloc} and \id{glocB} in the -calls to \id{CVBBDPrecInit} and \id{CVBBDPrecInitB}, respectivley. +calls to \id{CVBBDPrecInit} and \id{CVBBDPrecInitB}, respectively. For the sake of clarity, the \id{cvsAtmDisp\_ASAi\_kry\_bbd\_p} example does not use the most memory-efficient implementation possible, as the local segment of the diff --git a/doc/cvodes/cvs_ex_fwd.tex b/doc/cvodes/cvs_ex_fwd.tex index ec8f23fa9e..6c1d8f8803 100644 --- a/doc/cvodes/cvs_ex_fwd.tex +++ b/doc/cvodes/cvs_ex_fwd.tex @@ -252,7 +252,7 @@ \subsection{A serial dense example: cvsRoberts\_FSA\_dns} \id{pbar} (\id{pbar}$_i$ = \id{p}$_i$, which can typically be used for nonzero model parameters). Next, the program allocates memory for \id{yS}, by calling the {\nvecs} function -\id{N\_VCloneVectorArray\_Serial}, and initializaes all sensitivity variables to $0.0$. +\id{N\_VCloneVectorArray\_Serial}, and initializes all sensitivity variables to $0.0$. The call to \id{CVodeSensInit1} specifies the sensitivity solution method through the argument \id{sensi\_meth} (read from the command @@ -290,7 +290,7 @@ \subsection{A serial dense example: cvsRoberts\_FSA\_dns} The user-supplied functions \id{f} (for the right-hand side of the original ODEs) and \id{Jac} (for the system Jacobian) are identical to those in \id{cvRoberts\_dns.c}, -with the notable exeption that model parameters are extracted from the user-defined +with the notable exception that model parameters are extracted from the user-defined data structure \id{data}, which must first be cast to the \id{UserData} type. Similarly, the user-supplied function \id{ewt} is identical to that in \id{cvRoberts\_dns\_uw.c}. The user-supplied function \id{fS} computes the diff --git a/doc/cvodes/cvs_ex_intro.tex b/doc/cvodes/cvs_ex_intro.tex index 6ac7624626..efa1a58264 100644 --- a/doc/cvodes/cvs_ex_intro.tex +++ b/doc/cvodes/cvs_ex_intro.tex @@ -167,7 +167,7 @@ \section{Introduction}\label{s:ex_intro} interaction terms only, using block-grouping. \newline Four different runs are made for this problem. - The product preconditoner is applied on the left and on the right. + The product preconditioner is applied on the left and on the right. In each case, both the modified and classical Gram-Schmidt options are tested. diff --git a/doc/cvodes/guide/source/Constants.rst b/doc/cvodes/guide/source/Constants.rst index cbd469ad51..4be7173ac0 100644 --- a/doc/cvodes/guide/source/Constants.rst +++ b/doc/cvodes/guide/source/Constants.rst @@ -137,7 +137,7 @@ CVODES output constants | ``CV_FIRST_RHSFUNC_ERR`` | -9 | The right-hand side function failed at the first | | | | call. | +----------------------------------+------+--------------------------------------------------------+ - | ``CV_REPTD_RHSFUNC_ERR`` | -10 | The right-hand side function had repetead | + | ``CV_REPTD_RHSFUNC_ERR`` | -10 | The right-hand side function had repeated | | | | recoverable errors. | +----------------------------------+------+--------------------------------------------------------+ | ``CV_UNREC_RHSFUNC_ERR`` | -11 | The right-hand side function had a recoverable | @@ -180,7 +180,7 @@ CVODES output constants | ``CV_FIRST_QRHSFUNC_ERR`` | -32 | The quadrature right-hand side function failed at | | | | the first call. | +----------------------------------+------+--------------------------------------------------------+ - | ``CV_REPTD_QRHSFUNC_ERR`` | -33 | The quadrature ight-hand side function had repetead | + | ``CV_REPTD_QRHSFUNC_ERR`` | -33 | The quadrature ight-hand side function had repeated | | | | recoverable errors. | +----------------------------------+------+--------------------------------------------------------+ | ``CV_UNREC_QRHSFUNC_ERR`` | -34 | The quadrature right-hand side function had a | @@ -194,7 +194,7 @@ CVODES output constants | ``CV_FIRST_SRHSFUNC_ERR`` | -42 | The sensitivity right-hand side function failed at | | | | the first call. | +----------------------------------+------+--------------------------------------------------------+ - | ``CV_REPTD_SRHSFUNC_ERR`` | -43 | The sensitivity ight-hand side function had repetead | + | ``CV_REPTD_SRHSFUNC_ERR`` | -43 | The sensitivity ight-hand side function had repeated | | | | recoverable errors. | +----------------------------------+------+--------------------------------------------------------+ | ``CV_UNREC_SRHSFUNC_ERR`` | -44 | The sensitivity right-hand side function had a | @@ -211,7 +211,7 @@ CVODES output constants | ``CV_FIRST_QSRHSFUNC_ERR`` | -52 | The sensitivity right-hand side function failed at | | | | the first call. | +----------------------------------+------+--------------------------------------------------------+ - | ``CV_REPTD_QSRHSFUNC_ERR`` | -53 | The sensitivity ight-hand side function had repetead | + | ``CV_REPTD_QSRHSFUNC_ERR`` | -53 | The sensitivity ight-hand side function had repeated | | | | recoverable errors. | +----------------------------------+------+--------------------------------------------------------+ | ``CV_UNREC_QSRHSFUNC_ERR`` | -54 | The sensitivity right-hand side function had a | diff --git a/doc/cvodes/guide/source/Introduction.rst b/doc/cvodes/guide/source/Introduction.rst index fbf0685067..419fd7ee20 100644 --- a/doc/cvodes/guide/source/Introduction.rst +++ b/doc/cvodes/guide/source/Introduction.rst @@ -46,7 +46,7 @@ capabilities of both VODE and VODPK have been combined in the C-language package CVODE :cite:p:`CoHi:96`. At present, CVODE may utilize a variety of Krylov methods provided in SUNDIALS -that can be used in conjuction with Newton iteration: these include the GMRES +that can be used in conjunction with Newton iteration: these include the GMRES (Generalized Minimal RESidual) :cite:p:`SaSc:86`, FGMRES (Flexible Generalized Minimum RESidual) :cite:p:`Saa:93`, Bi-CGStab (Bi-Conjugate Gradient Stabilized) :cite:p:`Van:92`, TFQMR (Transpose-Free Quasi-Minimal Residual) @@ -77,7 +77,7 @@ resulting in PVODE :cite:p:`ByHi:99`, the parallel variant of CVODE. CVODES is written with a functionality that is a superset of that of the pair CVODE/PVODE. Sensitivity analysis capabilities, both forward and adjoint, have -been added to the main integrator. Enabling forward sensititivity computations +been added to the main integrator. Enabling forward sensitivity computations in CVODES will result in the code integrating the so-called *sensitivity equations* simultaneously with the original IVP, yielding both the solution and its sensitivity with respect to parameters in the model. Adjoint sensitivity @@ -181,7 +181,7 @@ The structure of this document is as follows: addition to those already described in Chapter :numref:`CVODES.Usage.SIM`. Following that we provide detailed descriptions of the user-callable interface routines specific to forward sensitivity analysis and - of the additonal optional user-defined routines. + of the additional optional user-defined routines. - Chapter :numref:`CVODES.Usage.ADJ` describes the usage of CVODES for adjoint sensitivity analysis. We begin by describing the CVODES checkpointing implementation for interpolation of diff --git a/doc/cvodes/guide/source/Mathematics.rst b/doc/cvodes/guide/source/Mathematics.rst index 6424a6b98f..6f5ec2b285 100644 --- a/doc/cvodes/guide/source/Mathematics.rst +++ b/doc/cvodes/guide/source/Mathematics.rst @@ -850,7 +850,7 @@ the solution of the combined ODE and sensitivity system for the vector matrix of the above linear system is based on exactly the same information as the matrix :math:`M` in :eq:`CVODES_Newtonmat`, it must be updated and factored at every step of the integration, in contrast to an - evalutaion of :math:`M` which is updated only occasionally. For problems with + evaluation of :math:`M` which is updated only occasionally. For problems with many parameters (relative to the problem size), the staggered direct method can outperform the methods described below :cite:p:`LPZ:99`. However, the computational cost associated with matrix updates and factorizations makes @@ -1132,7 +1132,7 @@ the gradient of :math:`G` with respect to :math:`p` is nothing but :label: CVODES_dgdp_1 The gradient of :math:`g(T,y,p)` with respect to :math:`p` can be then obtained -by using the Leibnitz differentiation rule. Indeed, from :eq:`CVODES_G`, +by using the Leibniz differentiation rule. Indeed, from :eq:`CVODES_G`, .. math:: \frac{\mathrm dg}{\mathrm dp}(T) = \frac{\mathrm d}{\mathrm dT}\frac{\mathrm dG}{\mathrm dp} diff --git a/doc/cvodes/guide/source/Usage/ADJ.rst b/doc/cvodes/guide/source/Usage/ADJ.rst index fde6cd2261..6ab2b68396 100644 --- a/doc/cvodes/guide/source/Usage/ADJ.rst +++ b/doc/cvodes/guide/source/Usage/ADJ.rst @@ -1142,7 +1142,7 @@ potentially non-differentiable factor. Krylov linear solver's convergence test constant is reduced from the nonlinear iteration test constant. This routine can be used in both the cases where the backward problem does and does not depend on the forward - sensitvities. + sensitivities. **Arguments:** * ``cvode_mem`` -- pointer to the CVODES memory block. @@ -1171,7 +1171,7 @@ potentially non-differentiable factor. converting from the integrator tolerance (WRMS norm) to the linear solver tolerance (L2 norm) for Newton linear system solves e.g., ``tol_L2 = fac * tol_WRMS``. This routine can be used in both the cases wherethe backward - problem does and does not depend on the forward sensitvities. + problem does and does not depend on the forward sensitivities. **Arguments:** * ``cvode_mem`` -- pointer to the CVODES memory block. @@ -1527,7 +1527,7 @@ provide a ``rhsBS`` function of type :c:type:`CVRhsFnBS` defined as follows: **Arguments:** * ``t`` -- is the current value of the independent variable. * ``y`` -- is the current value of the forward solution vector. - * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitvities of the forward solution. + * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitivities of the forward solution. * ``yB`` -- is the current value of the backward dependent variable vector. * ``yBdot`` -- is the output vector containing the right-hand side. * ``user_dataB`` -- is a pointer to user data, same as passed to ``CVodeSetUserDataB``. @@ -1596,7 +1596,7 @@ by of the correct accessor macros from each ``N_Vector`` implementation). For the sake of computational efficiency, the vector functions in the two ``N_Vector`` implementations provided with CVODES do not perform any - consistency checks with repsect to their ``N_Vector`` arguments + consistency checks with respect to their ``N_Vector`` arguments (see :numref:`NVectors`). The ``user_dataB`` pointer is passed to the user's ``fQB`` function every time it is called and can be the same as the ``user_data`` pointer used for the forward problem. @@ -1626,7 +1626,7 @@ defined by **Arguments:** * ``t`` -- is the current value of the independent variable. * ``y`` -- is the current value of the forward solution vector. - * ``yS`` -- a pointer to an array of ``Ns`` vectors continaing the sensitvities of the forward solution. + * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitivities of the forward solution. * ``yB`` -- is the current value of the backward dependent variable vector. * ``qBdot`` -- is the output vector containing the right-hand side ``fQBS`` of the backward quadrature equations. * ``user_dataB`` -- is a pointer to user data, same as passed to ``CVodeSetUserDataB``. @@ -1645,7 +1645,7 @@ defined by data consistently (including the use of the correct accessor macros from each ``N_Vector`` implementation). For the sake of computational efficiency, the vector functions in the two ``N_Vector`` implementations - provided with CVODES do not perform any consistency checks with repsect to + provided with CVODES do not perform any consistency checks with respect to their ``N_Vector`` arguments (see :numref:`NVectors`). The ``user_dataB`` pointer is passed to the user's ``fQBS`` function every time it is called and can be the same as the ``user_data`` pointer used @@ -1729,7 +1729,7 @@ non-``NULL`` ``SUNMatrix`` object was supplied to **Arguments:** * ``t`` -- is the current value of the independent variable. * ``y`` -- is the current value of the forward solution vector. - * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitvities of the forward solution. + * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitivities of the forward solution. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the backward right-hand side function :math:`f_B`. * ``JacB`` -- is the output approximate Jacobian matrix. @@ -1795,7 +1795,7 @@ J_B` (or an approximation of it) for the backward problem. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the backward right-hand side function :math:`f_B`. * ``AB`` -- is the output approximate linear system matrix. - * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or informtion saved from a previous information can be safely used (``jokB = SUNTRUE``). + * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous information can be safely used (``jokB = SUNTRUE``). * ``jcurB`` -- is an output flag which must be set to ``SUNTRUE`` if Jacobian-related data was recomputed or ``SUNFALSE`` otherwise. * ``gammaB`` -- is the scalar appearing in the matrix :math:`M_B = I - \gamma_B J_B`. * ``user_dataB`` -- is a pointer to the same user data passed to ``CVodeSetUserDataB``. @@ -1838,7 +1838,7 @@ J_B` (or an approximation of it) for the backward problem. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the backward right-hand side function :math:`f_B`. * ``AB`` -- is the output approximate linear system matrix. - * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or informtion saved from a previous information can be safely used (``jokB = SUNTRUE``). + * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous information can be safely used (``jokB = SUNTRUE``). * ``jcurB`` -- is an output flag which must be set to ``SUNTRUE`` if Jacobian-related data was recomputed or ``SUNFALSE`` otherwise. * ``gammaB`` -- is the scalar appearing in the matrix * ``user_dataB`` -- is a pointer to the same user data passed to ``CVodeSetUserDataB``. @@ -2010,7 +2010,7 @@ function of type :c:type:`CVLsJacTimesSetupFnB` or **Arguments:** * ``t`` -- is the current value of the independent variable. * ``y`` -- is the current value of the dependent variable vector, :math:`y(t)`. - * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitvities of the forward solution. + * ``yS`` -- a pointer to an array of ``Ns`` vectors containing the sensitivities of the forward solution. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the right-hand-side function for the backward problem. * ``user_dataB`` -- is a pointer to the same user data provided to ``CVodeSetUserDataB``. @@ -2128,7 +2128,7 @@ function of one of the following two types: * ``y`` -- is the current value of the forward solution vector. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the backward right-hand side function :math:`f_B`. - * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous invokation can be safely used (``jokB = SUNTRUE``). + * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous invocation can be safely used (``jokB = SUNTRUE``). * ``jcurPtr`` -- is an output flag which must be set to ``SUNTRUE`` if Jacobian-related data was recomputed or ``SUNFALSE`` otherwise. * ``gammaB`` -- is the scalar appearing in the matrix :math:`M_B = I - \gamma_B J_B`. * ``user_dataB`` -- is a pointer to the same user data passed to ``CVodeSetUserDataB``. @@ -2156,7 +2156,7 @@ function of one of the following two types: * ``yS`` -- is a pointer to an array containing the forward sensitivity vectors. * ``yB`` -- is the current value of the backward dependent variable vector. * ``fyB`` -- is the current value of the backward right-hand side function :math:`f_B`. - * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous invokation can be safely used (``jokB = SUNTRUE``). + * ``jokB`` -- is an input flag indicating whether Jacobian-related data needs to be recomputed (``jokB = SUNFALSE``) or information saved from a previous invocation can be safely used (``jokB = SUNTRUE``). * ``jcurPtr`` -- is an output flag which must be set to ``SUNTRUE`` if Jacobian-related data was recomputed or ``SUNFALSE`` otherwise. * ``gammaB`` -- is the scalar appearing in the matrix :math:`M_B = I - \gamma_B J_B`. * ``user_dataB`` -- is a pointer to the same user data passed to ``CVodeSetUserDataB``. diff --git a/doc/cvodes/guide/source/Usage/FSA.rst b/doc/cvodes/guide/source/Usage/FSA.rst index bec66d6d76..17723f0607 100644 --- a/doc/cvodes/guide/source/Usage/FSA.rst +++ b/doc/cvodes/guide/source/Usage/FSA.rst @@ -320,7 +320,7 @@ one, respectively. The form of the call to each of these routines is as follows: Passing ``fS1 = NULL`` indicates using the default internal difference quotient sensitivity right-hand side routine. If an error occurred, :c:func:`CVodeSensInit1` also sends an error message to the error handler - funciton. + function. In terms of the problem size :math:`N`, number of sensitivity vectors @@ -1317,7 +1317,7 @@ steps are in bold. #. :silver:`Create sensitivity nonlinear solver object` -#. :silver:`Attach the sensitvity nonlinear solver module` +#. :silver:`Attach the sensitivity nonlinear solver module` #. :silver:`Set sensitivity nonlinear solver optional inputs` @@ -1394,7 +1394,7 @@ of the call to this function is as follows: **Notes:** .. warning:: Before calling :c:func:`CVodeQuadSensInit`, the user must enable the - sensitivites by calling :c:func:`CVodeSensInit` or :c:func:`CVodeSensInit1`. If + sensitivities by calling :c:func:`CVodeSensInit` or :c:func:`CVodeSensInit1`. If an error occurred, :c:func:`CVodeQuadSensInit` also sends an error message to the error handler function. diff --git a/doc/cvodes/guide/source/Usage/SIM.rst b/doc/cvodes/guide/source/Usage/SIM.rst index 18dce59206..8bc54ff2a2 100644 --- a/doc/cvodes/guide/source/Usage/SIM.rst +++ b/doc/cvodes/guide/source/Usage/SIM.rst @@ -443,7 +443,7 @@ makes no sense (and is overly costly) after ``y[i]`` is below some noise level. ``abstol`` (if scalar) or ``abstol[i]`` (if a vector) needs to be set to that noise level. If the different components have different noise levels, then ``abstol`` should be a vector. See the example ``cvsRoberts_dns`` in the CVODES package, and the discussion of it in the CVODES Examples document -:cite:p:`cvodes_ex`. In that problem, the three components vary betwen 0 and 1, +:cite:p:`cvodes_ex`. In that problem, the three components vary between 0 and 1, and have different noise levels; hence the ``abstol`` vector. It is impossible to give any general advice on ``abstol`` values, because the appropriate noise levels are completely problem-dependent. The user or modeler hopefully has some idea as to what those @@ -772,7 +772,7 @@ rootfinding. In the ``CV_ONE_STEP`` mode, ``tout`` is used only on the first call, and only to get the direction and a rough scale of the independent variable. - If a stop time is enabled (through a call to ``CVodeSetStopTime``), then ``CVode`` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be reenabled only though a new call to ``CVodeSetStopTime``). + If a stop time is enabled (through a call to ``CVodeSetStopTime``), then ``CVode`` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be re-enabled only though a new call to ``CVodeSetStopTime``). All failure return values are negative and so the test ``flag < 0`` will trap all ``CVode`` failures. @@ -914,7 +914,7 @@ Main solver optional input functions **Arguments:** * ``cvode_mem`` -- pointer to the CVODES memory block. - * ``nst`` -- number of successful steps inbetween calls to the monitor function 0 by default; a 0 input will turn off monitoring. + * ``nst`` -- number of successful steps in between calls to the monitor function 0 by default; a 0 input will turn off monitoring. **Return value:** * ``CV_SUCCESS`` -- The optional value has been successfully set. @@ -1056,7 +1056,7 @@ Main solver optional input functions **Notes:** The default, if this routine is not called, is that no stop time is imposed. - Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be reenabled only though a new call to ``CVodeSetStopTime``). + Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and can be re-enabled only though a new call to ``CVodeSetStopTime``). A stop time not reached before a call to :c:func:`CVodeReInit` will remain active but can be disabled by calling :c:func:`CVodeClearStopTime`. @@ -1089,7 +1089,7 @@ Main solver optional input functions * ``CV_MEM_NULL`` if the CVODES memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`CVodeSetStopTime`. .. versionadded:: 6.5.1 @@ -2627,7 +2627,7 @@ described next. The values returned in ``ele`` are valid only if :c:func:`CVode` returned a non-negative value. - The ``ele`` vector, togther with the ``eweight`` vector from :c:func:`CVodeGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose components are the products of the components of these two vectors. Thus, for example, if there were recent error test failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. + The ``ele`` vector, together with the ``eweight`` vector from :c:func:`CVodeGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose components are the products of the components of these two vectors. Thus, for example, if there were recent error test failures, the components causing the failures are those with largest values for the products, denoted loosely as ``eweight[i]*ele[i]``. @@ -3136,7 +3136,7 @@ solver, a suffix (for Linear Solver) has been added here (e.g. ``lenrwLS``). * ``leniwLS`` -- the number of integer values in the CVDIAG workspace. **Return value:** - * ``CVDIAG_SUCCESS`` -- The optional output valus have been successfully set. + * ``CVDIAG_SUCCESS`` -- The optional output values have been successfully set. * ``CVDIAG_MEM_NULL`` -- The ``cvode_mem`` pointer is ``NULL``. * ``CVDIAG_LMEM_NULL`` -- The CVDIAG linear solver has not been initialized. @@ -3223,7 +3223,7 @@ known, simply make that location a value of tout. To stop when the location of the discontinuity is determined by the solution, use the rootfinding feature. In either case, it is critical that the RHS function *not* incorporate the discontinuity, but rather have a smooth -extention over the discontinuity, so that the step across it (and +extension over the discontinuity, so that the step across it (and subsequent rootfinding, if used) can be done efficiently. Then use a switch within the RHS function (communicated through ``user_data``) that can be flipped between the stopping of the integration and the restart, so that @@ -3382,7 +3382,7 @@ These weights will be used in place of those defined by Eq. .. warning:: - The error weight vector must have all components positive. It is the user's responsiblity to perform this test and return -1 if it is not satisfied. + The error weight vector must have all components positive. It is the user's responsibility to perform this test and return -1 if it is not satisfied. .. _CVODES.Usage.SIM.user_supplied.rootFn: @@ -3405,7 +3405,7 @@ follows: * ``user_data`` a pointer to user data, the same as the ``user_data`` parameter passed to :c:func:`CVodeSetUserData`. **Return value:** - A ``CVRootFn`` should return 0 if successful or a non-zero value if an error occured (in which case the integration is haled and ``CVode`` returns ``CV_RTFUNC_FAIL``. + A ``CVRootFn`` should return 0 if successful or a non-zero value if an error occurred (in which case the integration is haled and ``CVode`` returns ``CV_RTFUNC_FAIL``. **Notes:** Allocation of memory for ``gout`` is automatically handled within CVODES. @@ -3428,7 +3428,7 @@ user-defined projection operation the projection function must have type * ``t`` -- the current value of the independent variable. * ``ycur`` -- the current value of the dependent variable vector :math:`y(t)`. * ``corr`` -- the correction, :math:`c`, to the dependent variable vector so that :math:`y(t) + c` satisfies the constraint equation. - * ``epsProj`` -- the tolerance to use in the nonlinear solver stopping test when solving the nonlinear constrainted least squares problem. + * ``epsProj`` -- the tolerance to use in the nonlinear solver stopping test when solving the nonlinear constrained least squares problem. * ``err`` -- is on input the current error estimate, if error projection is enabled (the default) then this should be overwritten with the projected error on output. If error projection is disabled then ``err`` is ``NULL``. * ``user_data`` a pointer to user data, the same as the ``user_data`` parameter passed to :c:func:`CVodeSetUserData`. @@ -3855,7 +3855,7 @@ are in bold. #. **Set optional inputs for quadrature integration** Call :c:func:`CVodeSetQuadErrCon` to indicate whether or not quadrature - variables shoule be used in the step size control mechanism, and to specify + variables should be used in the step size control mechanism, and to specify the integration tolerances for quadrature variables. See :numref:`CVODES.Usage.purequad.optional_inputs` for details. diff --git a/doc/cvodes/guide/source/conf.py b/doc/cvodes/guide/source/conf.py index a8a21e28a1..a8e4f703f7 100644 --- a/doc/cvodes/guide/source/conf.py +++ b/doc/cvodes/guide/source/conf.py @@ -291,7 +291,7 @@ texinfo_documents = [ ('index', 'CVODES', u'CVODES Documentation', u'Alan C. Hindmarsh, Radu Serban, Cody J. Balos, David J. Gardner, Daniel R. Reynolds, and Carol S. Woodward', 'CVODES', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/cvodes/guide/source/sunnonlinsol/CVODES_interface.rst b/doc/cvodes/guide/source/sunnonlinsol/CVODES_interface.rst index fa046db709..3d4a42140d 100644 --- a/doc/cvodes/guide/source/sunnonlinsol/CVODES_interface.rst +++ b/doc/cvodes/guide/source/sunnonlinsol/CVODES_interface.rst @@ -49,7 +49,7 @@ the combined state and sensitivity nonlinear systems are also reformulated in terms of the correction to the predicted state and sensitivities. The nonlinear system functions provided by CVODES to the nonlinear solver module -internally update the current value of the new state (and the sensitvities) +internally update the current value of the new state (and the sensitivities) based on the input correction vector(s) i.e., :math:`y^n = y_{pred} + y_{cor}` and :math:`s_i^n = s_{i,pred} + s_{i,cor}`. The updated vector(s) are used when calling the right-hand side function and when setting up linear solves (e.g., @@ -125,7 +125,7 @@ need access to the current value of :math:`\gamma` to compute Jacobian data. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`CVodeGetNonlinearSystemData` inside the - nonlinear system function to access the requisite data for evaluting + nonlinear system function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` @@ -208,15 +208,15 @@ need access to the current value of :math:`\gamma` to compute Jacobian data. * ``CV_MEM_NULL`` -- The ``cvode_mem`` pointer is ``NULL``. **Notes:** - This routine is intended for users who whish to attach a custom + This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to ``SUNNonlinSolSetSysFn``) or who need access to - nonlinear system data to compute the nonlinear system fucntion as part of + nonlinear system data to compute the nonlinear system function as part of a custom ``SUNNonlinearSolver`` object. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`CVodeGetNonlinearSystemDataSens` inside the nonlinear system function used in the sensitivity nonlinear solve to access the - requisite data for evaluting the nonlinear system function of their + requisite data for evaluating the nonlinear system function of their choosing. This could be the same function used for solving for the new state (the simultaneous approach) or a different function (the staggered or stagggered1 approaches). Additionlly, the vectors ``ySn`` are only diff --git a/doc/ida/guide/source/Introduction.rst b/doc/ida/guide/source/Introduction.rst index 029b9a3523..b100289002 100644 --- a/doc/ida/guide/source/Introduction.rst +++ b/doc/ida/guide/source/Introduction.rst @@ -37,7 +37,7 @@ LLNL to support the ordinary differential equation (ODE) solvers CVODE nonlinear system solver KINSOL :cite:p:`kinsol_ug`. At present, IDA may utilize a variety of Krylov methods provided in SUNDIALS -that can be used in conjuction with Newton iteration: these include the GMRES +that can be used in conjunction with Newton iteration: these include the GMRES (Generalized Minimal RESidual) :cite:p:`SaSc:86`, FGMRES (Flexible Generalized Minimum RESidual) :cite:p:`Saa:93`, Bi-CGStab (Bi-Conjugate Gradient Stabilized) :cite:p:`Van:92`, TFQMR (Transpose-Free Quasi-Minimal Residual) diff --git a/doc/ida/guide/source/Usage/index.rst b/doc/ida/guide/source/Usage/index.rst index 2402ae83eb..36b20b743e 100644 --- a/doc/ida/guide/source/Usage/index.rst +++ b/doc/ida/guide/source/Usage/index.rst @@ -449,7 +449,7 @@ For many users, the appropriate choices for tolerance values in ``reltol`` and different components have different noise levels, then ``abstol`` should be a vector. See the example ``idaRoberts_dns`` in the IDA package, and the discussion of it in the IDA Examples document :cite:p:`ida_ex`. In that - problem, the three components vary betwen 0 and 1, and have different noise + problem, the three components vary between 0 and 1, and have different noise levels; hence the ``abstol`` vector. It is impossible to give any general advice on ``abstol`` values, because the appropriate noise levels are completely problem-dependent. The user or modeler hopefully has some idea as @@ -840,7 +840,7 @@ rootfinding (with :c:func:`IDARootInit`). If a stop time is enabled (through a call to :c:func:`IDASetStopTime`), then :c:func:`IDASolve` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and - can be reenabled only though a new call to :c:func:`IDASetStopTime`). + can be re-enabled only though a new call to :c:func:`IDASetStopTime`). All failure return values are negative and therefore a test ``flag < 0`` will trap all :c:func:`IDASolve` failures. @@ -1067,7 +1067,7 @@ Main solver optional input functions **Notes:** The default, if this routine is not called, is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for ``tstop`` - is disabled (and can be reenabled only though a new call to + is disabled (and can be re-enabled only though a new call to :c:func:`IDASetStopTime`). A stop time not reached before a call to :c:func:`IDAReInit` will @@ -1085,7 +1085,7 @@ Main solver optional input functions * ``IDA_MEM_NULL`` if the IDA memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`IDASetStopTime`. .. versionadded:: 6.5.1 @@ -2492,7 +2492,7 @@ described next. .. note:: - The ``ele`` vector, togther with the ``eweight`` vector from + The ``ele`` vector, together with the ``eweight`` vector from :c:func:`IDAGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose @@ -3054,7 +3054,7 @@ To stop when the location of the discontinuity is known, simply make that location a value of :math:`t_{\text{out}}`. To stop when the location of the discontinuity is determined by the solution, use the rootfinding feature. In either case, it is critical that the residual function *not* incorporate the -discontinuity, but rather have a smooth extention over the discontinuity, so +discontinuity, but rather have a smooth extension over the discontinuity, so that the step across it (and subsequent rootfinding, if used) can be done efficiently. Then use a switch within the residual function (communicated through ``user_data``) that can be flipped between the stopping of the @@ -3164,7 +3164,7 @@ Error weight function **Return value:** * ``0`` -- if it the error weights were successfully set. - * ``-1`` -- if any error occured. + * ``-1`` -- if any error occurred. **Notes:** Allocation of memory for ``ewt`` is handled within IDA. @@ -3172,7 +3172,7 @@ Error weight function .. warning:: The error weight vector must have all components positive. It is the - user's responsiblity to perform this test and return -1 if it is not + user's responsibility to perform this test and return -1 if it is not satisfied. @@ -3203,8 +3203,8 @@ as follows: parameter passed to :c:func:`IDASetUserData`. **Return value:** - ``0`` if successful or non-zero if an error occured (in which case the - integration is halted and :c:func:`IDASolve` returs ``IDA_RTFUNC_FAIL``). + ``0`` if successful or non-zero if an error occurred (in which case the + integration is halted and :c:func:`IDASolve` returns ``IDA_RTFUNC_FAIL``). **Notes:** Allocation of memory for ``gout`` is handled within IDA. @@ -3247,7 +3247,7 @@ user may provide a function of type :c:type:`IDALsJacFn` defined as follows: value if a recoverable error occurred, or a negative value if a nonrecoverable error occurred. - In the case of a recoverable eror return, the integrator will attempt to + In the case of a recoverable error return, the integrator will attempt to recover by reducing the stepsize, and hence changing :math:`\alpha` in :eq:`IDA_DAE_Jacobian`. diff --git a/doc/ida/guide/source/conf.py b/doc/ida/guide/source/conf.py index a92a878cf5..53f27fadba 100644 --- a/doc/ida/guide/source/conf.py +++ b/doc/ida/guide/source/conf.py @@ -291,7 +291,7 @@ texinfo_documents = [ ('index', 'IDA', u'IDA Documentation', u'Alan C. Hindmarsh, Radu Serban, Cody J. Balos, David J. Gardner, Daniel R. Reynolds, and Carol S. Woodward', 'IDA', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/ida/guide/source/sunnonlinsol/IDA_interface.rst b/doc/ida/guide/source/sunnonlinsol/IDA_interface.rst index 36feccee89..2ec40ffb7a 100644 --- a/doc/ida/guide/source/sunnonlinsol/IDA_interface.rst +++ b/doc/ida/guide/source/sunnonlinsol/IDA_interface.rst @@ -117,13 +117,13 @@ the current :math:`y` and :math:`\dot{y}` vectors to compute Jacobian data. This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to - nonlinear system data to compute the nonlinear system fucntion as part of a + nonlinear system data to compute the nonlinear system function as part of a custom ``SUNNonlinearSolver`` object. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`IDAGetNonlinearSystemData` inside the nonlinear system function to - access the requisite data for evaluting the nonlinear system function of + access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` functions supplied by IDA (through calls to diff --git a/doc/ida/ida_ex_fortran.tex b/doc/ida/ida_ex_fortran.tex index af9260e4dc..60ab483870 100644 --- a/doc/ida/ida_ex_fortran.tex +++ b/doc/ida/ida_ex_fortran.tex @@ -66,7 +66,7 @@ \subsection{A parallel example: fidaHeat2D\_kry\_bbd\_p}\label{ss:fidaHeat2D_bbd a call to \id{FNVINITP} to initialize {\nvecp}, and a call to \id{SETINITPROFILE} to initialize the \id{UU}, \id{UP}, \id{ID}, and \id{CONSTR} arrays (containing the solution vector, solution derivative vector, -the differential/algebraic bit vector, and the contraint specification +the differential/algebraic bit vector, and the constraint specification vector, respectively). A call to \id{FIDASETIIN} and two calls to \id{FIDASETVIN} are made to suppress error control on the algebraic variables, and to supply the \id{ID} array and constraints array (making diff --git a/doc/ida/ida_ex_serial.tex b/doc/ida/ida_ex_serial.tex index fb9e8fd934..6322125609 100644 --- a/doc/ida/ida_ex_serial.tex +++ b/doc/ida/ida_ex_serial.tex @@ -61,7 +61,7 @@ \subsection{A dense example: idaRoberts\_dns}\label{ss:idaRoberts} After various declarations, the \id{main} program begins by allocating memory for the \id{yy}, \id{yp}, and \id{avtol} vectors using \id{N\_VNew\_Serial} with a length argument of \id{NEQ} ($= 3$). The -lines following that load the initial values of the dependendent +lines following that load the initial values of the dependent variable vectors into \id{yy} and \id{yp}, and set the relative tolerance \id{rtol} and absolute tolerance vector \id{avtol}. Serial \id{N\_Vector} values are set by first accessing the pointer to their underlying data using @@ -389,7 +389,7 @@ \subsection{A Krylov example: idaHeat2D\_kry}\label{ss:idaHeat2D} of the PDE (using central differences) in the rest of the domain. The user-supplied functions \id{PsetupHeat} and \id{PsolveHeat} together define the -left preconditoner matrix $P$ approximating the system Jacobian matrix +left preconditioner matrix $P$ approximating the system Jacobian matrix $J = \partial F/ \partial u + \alpha \partial F/ \partial u'$ (where the DAE system is $F(t,u,u') = 0$), and solve the linear systems $P z = r$. Preconditioning is done in this case by keeping only the diagonal elements of diff --git a/doc/ida/ida_ex_trilinos.tex b/doc/ida/ida_ex_trilinos.tex index aa4ad1140e..58dc769c4b 100644 --- a/doc/ida/ida_ex_trilinos.tex +++ b/doc/ida/ida_ex_trilinos.tex @@ -49,7 +49,7 @@ \subsection{A nonstiff shared memory parallel example: idaHeat2D\_kry\_tpetra} changing the example code. Once the communicator and map are set, a Tpetra vector is created as: \begin{verbatim} - /* Create a Tpetra vector and return refernce counting pointer to it. */ + /* Create a Tpetra vector and return reference counting pointer to it. */ Teuchos::RCP rcpuu = Teuchos::rcp(new vector_type(mpiMap)); \end{verbatim} diff --git a/doc/idas/guide/source/Introduction.rst b/doc/idas/guide/source/Introduction.rst index 771da6ec5b..5f1b554c5f 100644 --- a/doc/idas/guide/source/Introduction.rst +++ b/doc/idas/guide/source/Introduction.rst @@ -37,7 +37,7 @@ at LLNL to support the ordinary differential equation (ODE) solvers CVODE nonlinear system solver KINSOL :cite:p:`kinsol_ug`. At present, IDAS may utilize a variety of Krylov methods provided in SUNDIALS -that can be used in conjuction with Newton iteration: these include the GMRES +that can be used in conjunction with Newton iteration: these include the GMRES (Generalized Minimal RESidual) :cite:p:`SaSc:86`, FGMRES (Flexible Generalized Minimum RESidual) :cite:p:`Saa:93`, Bi-CGStab (Bi-Conjugate Gradient Stabilized) :cite:p:`Van:92`, TFQMR (Transpose-Free Quasi-Minimal Residual) @@ -119,7 +119,7 @@ The structure of this document is as follows: that are required in addition to those already described in Chapter :numref:`IDAS.Usage.SIM`. Following that we provide detailed descriptions of the user-callable interface routines specific to forward - sensitivity analysis and of the additonal optional user-defined routines. + sensitivity analysis and of the additional optional user-defined routines. * Chapter :numref:`IDAS.Usage.ADJ` describes the usage of IDAS for adjoint sensitivity analysis. We begin by describing the IDAS checkpointing diff --git a/doc/idas/guide/source/Usage/ADJ.rst b/doc/idas/guide/source/Usage/ADJ.rst index 60c76147d7..af8b782a28 100644 --- a/doc/idas/guide/source/Usage/ADJ.rst +++ b/doc/idas/guide/source/Usage/ADJ.rst @@ -1115,7 +1115,7 @@ setting increments for the finite-difference approximation, via a call to increments used in the difference quotient approximations to matrix-vector products for the backward problem. This routine can be used in both the cases where the backward problem does and does not depend on the forward - sensitvities. + sensitivities. **Arguments:** * ``ida_mem`` -- pointer to the IDAS memory block. @@ -1245,7 +1245,7 @@ These may be accomplished through calling the following functions: Krylov linear solver's convergence test constant is reduced from the nonlinear iteration test constant. (See :numref:`IDAS.Mathematics.ivp_sol`). This routine can be used in both the cases wherethe backward problem does - and does not depend on the forward sensitvities. + and does not depend on the forward sensitivities. **Arguments:** * ``ida_mem`` -- pointer to the IDAS memory block. @@ -1275,7 +1275,7 @@ These may be accomplished through calling the following functions: converting from the integrator tolerance (WRMS norm) to the linear solver tolerance (L2 norm) for Newton linear system solves e.g., ``tol_L2 = fac * tol_WRMS``. This routine can be used in both the cases wherethe backward - problem does and does not depend on the forward sensitvities. + problem does and does not depend on the forward sensitivities. **Arguments:** * ``ida_mem`` -- pointer to the IDAS memory block. @@ -1746,7 +1746,7 @@ The user must provide an ``fQB`` function of type ``IDAQuadRhsFnB`` defined by data consistently (including the use of the correct accessor macros from each ``N_Vector`` implementation). For the sake of computational efficiency, the vector functions in the two ``N_Vector`` implementations - provided with IDAS do not perform any consistency checks with repsect to + provided with IDAS do not perform any consistency checks with respect to their ``N_Vector`` arguments (see :numref:`NVectors`). The ``user_dataB`` pointer is passed to the user's ``fQB`` function every time it is called and can be the same as the ``user_data`` pointer used for the forward diff --git a/doc/idas/guide/source/Usage/FSA.rst b/doc/idas/guide/source/Usage/FSA.rst index 6309026184..38f5608634 100644 --- a/doc/idas/guide/source/Usage/FSA.rst +++ b/doc/idas/guide/source/Usage/FSA.rst @@ -1224,7 +1224,7 @@ in the notation of :eq:`IDAS_QUAD`. The form of the call to this function is as .. warning:: Before calling :c:func:`IDAQuadSensInit`, the user must enable the - sensitivites by calling :c:func:`IDASensInit`. If an error occurred, + sensitivities by calling :c:func:`IDASensInit`. If an error occurred, :c:func:`IDAQuadSensInit` also sends an error message to the error handler function. diff --git a/doc/idas/guide/source/Usage/SIM.rst b/doc/idas/guide/source/Usage/SIM.rst index 981291a4aa..f8bbe96021 100644 --- a/doc/idas/guide/source/Usage/SIM.rst +++ b/doc/idas/guide/source/Usage/SIM.rst @@ -447,7 +447,7 @@ For many users, the appropriate choices for tolerance values in ``reltol`` and different components have different noise levels, then ``abstol`` should be a vector. See the example ``idaRoberts_dns`` in the IDAS package, and the discussion of it in the IDAS Examples document :cite:p:`ida_ex`. In that - problem, the three components vary betwen 0 and 1, and have different noise + problem, the three components vary between 0 and 1, and have different noise levels; hence the ``abstol`` vector. It is impossible to give any general advice on ``abstol`` values, because the appropriate noise levels are completely problem-dependent. The user or modeler hopefully has some idea as @@ -845,7 +845,7 @@ rootfinding (with :c:func:`IDARootInit`). If a stop time is enabled (through a call to :c:func:`IDASetStopTime`), then :c:func:`IDASolve` returns the solution at ``tstop``. Once the integrator returns at a stop time, any future testing for ``tstop`` is disabled (and - can be reenabled only though a new call to :c:func:`IDASetStopTime`). + can be re-enabled only though a new call to :c:func:`IDASetStopTime`). All failure return values are negative and therefore a test ``flag < 0`` will trap all :c:func:`IDASolve` failures. @@ -1072,7 +1072,7 @@ Main solver optional input functions **Notes:** The default, if this routine is not called, is that no stop time is imposed. Once the integrator returns at a stop time, any future testing for ``tstop`` - is disabled (and can be reenabled only though a new call to + is disabled (and can be re-enabled only though a new call to :c:func:`IDASetStopTime`). A stop time not reached before a call to :c:func:`IDAReInit` will @@ -1090,7 +1090,7 @@ Main solver optional input functions * ``IDA_MEM_NULL`` if the IDA memory is ``NULL`` **Notes:** - The stop time can be reenabled though a new call to + The stop time can be re-enabled though a new call to :c:func:`IDASetStopTime`. .. versionadded:: 6.5.1 @@ -1802,7 +1802,7 @@ to set optional inputs controlling the initial condition calculation. If :c:func:`IDASetMaxBacksIC` is called in a Forward Sensitivity Analysis, the the limit ``maxbacks`` applies in the calculation of both the initial state - values and the initial sensititivies. + values and the initial sensitivities. .. c:function:: int IDASetLineSearchOffIC(void * ida_mem, sunbooleantype lsoff) @@ -2518,7 +2518,7 @@ described next. .. note:: - The ``ele`` vector, togther with the ``eweight`` vector from + The ``ele`` vector, together with the ``eweight`` vector from :c:func:`IDAGetErrWeights`, can be used to determine how the various components of the system contributed to the estimated local error test. Specifically, that error test uses the RMS norm of a vector whose @@ -3084,7 +3084,7 @@ To stop when the location of the discontinuity is known, simply make that location a value of :math:`t_{\text{out}}`. To stop when the location of the discontinuity is determined by the solution, use the rootfinding feature. In either case, it is critical that the residual function *not* incorporate the -discontinuity, but rather have a smooth extention over the discontinuity, so +discontinuity, but rather have a smooth extension over the discontinuity, so that the step across it (and subsequent rootfinding, if used) can be done efficiently. Then use a switch within the residual function (communicated through ``user_data``) that can be flipped between the stopping of the @@ -3204,7 +3204,7 @@ Error weight function **Return value:** * ``0`` -- if it the error weights were successfully set. - * ``-1`` -- if any error occured. + * ``-1`` -- if any error occurred. **Notes:** Allocation of memory for ``ewt`` is handled within IDAS. @@ -3212,7 +3212,7 @@ Error weight function .. warning:: The error weight vector must have all components positive. It is the - user's responsiblity to perform this test and return -1 if it is not + user's responsibility to perform this test and return -1 if it is not satisfied. @@ -3243,7 +3243,7 @@ as follows: parameter passed to :c:func:`IDASetUserData`. **Return value:** - ``0`` if successful or non-zero if an error occured (in which case the + ``0`` if successful or non-zero if an error occurred (in which case the integration is halted and :c:func:`IDASolve` returns ``IDA_RTFUNC_FAIL``). **Notes:** @@ -3287,7 +3287,7 @@ user may provide a function of type :c:type:`IDALsJacFn` defined as follows: value if a recoverable error occurred, or a negative value if a nonrecoverable error occurred. - In the case of a recoverable eror return, the integrator will attempt to + In the case of a recoverable error return, the integrator will attempt to recover by reducing the stepsize, and hence changing :math:`\alpha` in :eq:`IDAS_DAE_Jacobian`. @@ -3658,7 +3658,7 @@ steps are in bold. #. **Set optional inputs for quadrature integration** Call :c:func:`IDASetQuadErrCon` to indicate whether or not quadrature - variables shoule be used in the step size control mechanism, and to specify + variables should be used in the step size control mechanism, and to specify the integration tolerances for quadrature variables. See :numref:`IDAS.Usage.Purequad.quad_optional_input` for details. diff --git a/doc/idas/guide/source/conf.py b/doc/idas/guide/source/conf.py index 8613adcf6a..e0da18474a 100644 --- a/doc/idas/guide/source/conf.py +++ b/doc/idas/guide/source/conf.py @@ -292,7 +292,7 @@ texinfo_documents = [ ('index', 'IDAS', u'IDAS Documentation', u'Alan C. Hindmarsh, Radu Serban, Cody J. Balos, David J. Gardner, Daniel R. Reynolds, and Carol S. Woodward', 'IDAS', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/idas/guide/source/sunnonlinsol/IDAS_interface.rst b/doc/idas/guide/source/sunnonlinsol/IDAS_interface.rst index d2d6cc8746..54f8375db9 100644 --- a/doc/idas/guide/source/sunnonlinsol/IDAS_interface.rst +++ b/doc/idas/guide/source/sunnonlinsol/IDAS_interface.rst @@ -40,7 +40,7 @@ reformulated in terms of the correction to the predicted sensitivities. The nonlinear system function provided by IDAS to the nonlinear solver module internally updates the current value of the new state and its derivative based -on the current corretion passed to the function (as well as the sensitivities). +on the current correction passed to the function (as well as the sensitivities). These values are used when calling the DAE residual function and when setting up linear solves (e.g., for updating the Jacobian or preconditioner). @@ -149,13 +149,13 @@ the current :math:`y` and :math:`\dot{y}` vectors to compute Jacobian data. This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to - nonlinear system data to compute the nonlinear system fucntion as part of a + nonlinear system data to compute the nonlinear system function as part of a custom ``SUNNonlinearSolver`` object. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`IDAGetNonlinearSystemData` inside the nonlinear system function to - access the requisite data for evaluting the nonlinear system function of + access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the ``SUNNonlinearSolver`` object (existing or custom) leverages the :c:type:`SUNNonlinSolLSetupFn` and/or :c:type:`SUNNonlinSolLSolveFn` functions supplied by IDAS (through calls to @@ -203,11 +203,11 @@ the current :math:`y` and :math:`\dot{y}` vectors to compute Jacobian data. This routine is intended for users who wish to attach a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object (through a call to :c:func:`SUNNonlinSolSetSysFn`) or who need access to - nonlinear system data to compute the nonlinear system fucntion as part of + nonlinear system data to compute the nonlinear system function as part of a custom ``SUNNonlinearSolver`` object. When supplying a custom :c:type:`SUNNonlinSolSysFn` to an existing ``SUNNonlinearSolver`` object, the user should call :c:func:`IDAGetNonlinearSystemDataSens` inside the - nonlinear system function to access the requisite data for evaluting the + nonlinear system function to access the requisite data for evaluating the nonlinear system function of their choosing. Additionlly, if the the vectors ``yySn`` and ``ypSn`` are provided as additional workspace and do not need to be filled in by the user's :c:type:`SUNNonlinSolSysFn`. If diff --git a/doc/idas/idas_ex_intro.tex b/doc/idas/idas_ex_intro.tex index fde54914d3..d2ca2de7eb 100644 --- a/doc/idas/idas_ex_intro.tex +++ b/doc/idas/idas_ex_intro.tex @@ -296,7 +296,7 @@ \section{Introduction}\label{s:ex_intro} {\em builddir}\id{/lib/libsundials\_idas.}{\em lib} instead of {\em builddir}\id{/lib/libsundials\_ida.}{\em lib}. -We also give our output files for each of thes examples described below, +We also give our output files for each of the examples described below, but users should be cautioned that their results may differ slightly from these. Differences in solution values may differ within the tolerances, and differences in cumulative counters, such as numbers of steps or Newton iterations, may differ diff --git a/doc/kinsol/guide/source/Usage/index.rst b/doc/kinsol/guide/source/Usage/index.rst index dd1bcacec1..ebe2aeef76 100644 --- a/doc/kinsol/guide/source/Usage/index.rst +++ b/doc/kinsol/guide/source/Usage/index.rst @@ -1030,7 +1030,7 @@ negative, so a test ``retval`` :math:`<0` will catch any error. .. c:function:: int KINSetDampingAA(void * kin_mem, sunrealtype beta) The function :c:func:`KINSetDampingAA` specifies the value of the Anderson - acceleration damping paramter. + acceleration damping parameter. **Arguments:** * ``kin_mem`` -- pointer to the KINSOL memory block. @@ -1946,7 +1946,7 @@ supplied, the default is a difference quotient approximation to these products. This function computes the product :math:`J v` (or an approximation to it). **Arguments:** - * ``v`` -- is the vector by which the Jacobian must be multplied to the right. + * ``v`` -- is the vector by which the Jacobian must be multiplied to the right. * ``Jv`` -- is the computed output vector. * ``u`` -- is the current value of the dependent variable vector. * ``user_data`` -- is a pointer to user data, the same as the ``user_data`` @@ -1999,7 +1999,7 @@ of type :c:type:`KINLsPrecSolveFn`, defined as follows: * ``uscale`` -- is a vector containing diagonal elements of the scaling matrix ``u`` * ``fval`` -- is the vector :math:`F(u)` evaluated at ``u`` * ``fscale`` -- is a vector containing diagonal elements of the scaling matrix for ``fval`` - * ``v`` -- on inpuut, ``v`` is set to the right-hand side vector of the linear system, ``r``. On output, ``v`` must contain the solution ``z`` of the linear system :math:`Pz=r` + * ``v`` -- on input, ``v`` is set to the right-hand side vector of the linear system, ``r``. On output, ``v`` must contain the solution ``z`` of the linear system :math:`Pz=r` * ``user_data`` -- is a pointer to user data, the same as the ``user_data`` parameter passed to :c:func:`KINSetUserData`. @@ -2131,7 +2131,7 @@ communication. **Return value:** An :c:type:`KINBBDLocalFn` function type should return 0 to indicate success, - or non-zero if an error occured. + or non-zero if an error occurred. **Notes:** This function must assume that all inter-processor communication of data @@ -2155,7 +2155,7 @@ communication. **Return value:** An :c:type:`KINBBDLocalFn` function type should return 0 to indicate success, - or non-zero if an error occured. + or non-zero if an error occurred. **Notes:** The ``Gcomm`` function is expected to save communicated data in space defined diff --git a/doc/kinsol/guide/source/conf.py b/doc/kinsol/guide/source/conf.py index c8cef7c6ac..074821a0a3 100644 --- a/doc/kinsol/guide/source/conf.py +++ b/doc/kinsol/guide/source/conf.py @@ -296,7 +296,7 @@ texinfo_documents = [ ('index', 'KINSOL', u'KINSOL Documentation', u'Alan C. Hindmarsh, Radu Serban, Cody J. Balos, David J. Gardner, Daniel R. Reynolds, and Carol S. Woodward', 'KINSOL', - 'Time integration package for multi-rate systems of ordinary differntial equations.', + 'Time integration package for multi-rate systems of ordinary differential equations.', 'Miscellaneous'), ] diff --git a/doc/kinsol/kin_ex_c.tex b/doc/kinsol/kin_ex_c.tex index 74fd91f289..8fea81bf05 100644 --- a/doc/kinsol/kin_ex_c.tex +++ b/doc/kinsol/kin_ex_c.tex @@ -89,7 +89,7 @@ \subsection{A serial dense example: kinFerTron\_dns}\label{ss:kinFerTron_dns} functions \id{SetInitialGuess1} and \id{SetInitialGuess2} and the constraint vector \id{c} is initialized to $[0,0,1,-1,1,-1]$ indicating that there are no additional constraints on the first two components of \id{u} (i.e. $x_1$ and -$x_2$) and that the 3rd and 5th compnents should be non-negative, while +$x_2$) and that the 3rd and 5th components should be non-negative, while the 4th and 6th should be non-positive. The calls to \id{N\_VNew\_Serial}, and also later calls to various \id{KIN***} @@ -275,7 +275,7 @@ \subsection{A serial Krylov example: kinFoodWeb\_kry}\label{ss:kinFoodWeb_kry} to load problem constants in the \id{data} block; \id{FreeUserData} to free that block; \id{SetInitialProfiles} to load the initial values in \id{cc}; \id{PrintHeader} to print the heading for the output; -\id{PrintOutput} to retreive and print selected solution values; +\id{PrintOutput} to retrieve and print selected solution values; \id{PrintFinalStats} to print statistics; and \id{check\_flag} to check return values for error conditions. @@ -326,7 +326,7 @@ \subsection{A parallel example: kinFoodWeb\_kry\_bbd\_p}\label{ss:kinFoodWeb_kry The function \id{func\_local} is also passed as the \id{gloc} argument to \id{KINBBDPrecInit}. Since all communication needed for the evaluation of the -local aproximation of $f$ used in building the band-block-diagonal preconditioner +local approximation of $f$ used in building the band-block-diagonal preconditioner is already done for the evaluation of $f$ in \id{func}, a \id{NULL} pointer is passed as the \id{gcomm} argument to \id{KINBBDPrecInit}. diff --git a/doc/kinsol/kin_ex_fortran.tex b/doc/kinsol/kin_ex_fortran.tex index 2c7b263144..c8c1f25c69 100644 --- a/doc/kinsol/kin_ex_fortran.tex +++ b/doc/kinsol/kin_ex_fortran.tex @@ -95,7 +95,7 @@ \subsection{A parallel example: fkinDiagon\_kry\_p}\label{ss:fkinDiagon_kry_p} \id{fkinDiagon\_kry}. Upon successful return from \id{fkinsol}, the solution segment local to the process with id equal to $0$ is printed to unit 6. Finally, the {\kinsol} memory is released and the {\mpi} -environent is terminated. +environment is terminated. For this simple example, no inter-process communication is required to evaluate the nonlinear system function $f$ or the preconditioner. diff --git a/doc/shared/Changelog.rst b/doc/shared/Changelog.rst index 2ce7b9c951..bc9d5c1ad9 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 ==================================== @@ -1991,7 +1999,7 @@ implemented a custom :c:type:`SUNMatrix` will need to at least update their code to set the corresponding ``ops`` structure member, ``matvecsetup``, to ``NULL``. The generic :c:type:`SUNMatrix` API now defines error codes to be returned by -matrix operations. Operations which return an integer flag indiciating +matrix operations. Operations which return an integer flag indicating success/failure may return different values than previously. A new :c:type:`SUNMatrix` (and :c:type:`SUNLinearSolver`) implementation was @@ -2104,7 +2112,7 @@ function signatures have been changed including :c:func:`MRIStepCreate` which now takes an ARKStep memory structure for the fast integration as an input. The reinitialization functions :c:func:`ERKStepReInit`, :c:func:`ARKStepReInit`, -and :c:func:`MRIStepReInit` have been updated to retain the minimum and maxiumum +and :c:func:`MRIStepReInit` have been updated to retain the minimum and maximum step size values from before reinitialization rather than resetting them to the default values. @@ -2130,7 +2138,7 @@ being built. Fixed a memory leak in the PETSc :c:type:`N_Vector` clone function. -Fixed a memeory leak in the ARKODE, CVODE, and IDA F77 interfaces when not using +Fixed a memory leak in the ARKODE, CVODE, and IDA F77 interfaces when not using the default nonlinear solver. Fixed a bug in the ARKStep time-stepping module in ARKODE that would result in @@ -2870,7 +2878,7 @@ with sparse direct solvers. *KINSOL* -The Picard iteration return was chanegd to always return the newest iterate upon +The Picard iteration return was changed to always return the newest iterate upon success. A minor bug in the line search was fixed to prevent an infinite loop when the diff --git a/doc/shared/RecentChanges.rst b/doc/shared/RecentChanges.rst index 0340eed7c8..0cd3986ee3 100644 --- a/doc/shared/RecentChanges.rst +++ b/doc/shared/RecentChanges.rst @@ -1,3 +1,18 @@ +**Major Features** + +**New Features and Enhancements** + +The default value of :cmakeop:`CMAKE_CUDA_ARCHITECTURES` is no longer set to +``70`` and is now determined automatically by CMake. The previous default was +only valid for Volta GPUs while the automatically selected value will vary +across compilers and compiler versions. As such, users are encouraged to +override this value with the architecture for their system. + **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. + +Fixed a CMake bug regarding usage of missing "print_warning" macro +that was only triggered when the deprecated ``CUDA_ARCH`` option was used. + +**Deprecation Notices** diff --git a/doc/shared/nvectors/NVector_CUDA.rst b/doc/shared/nvectors/NVector_CUDA.rst index df27c93672..d81ba70e7c 100644 --- a/doc/shared/nvectors/NVector_CUDA.rst +++ b/doc/shared/nvectors/NVector_CUDA.rst @@ -45,7 +45,7 @@ if the vector owns the execution policies and memory helper objects (i.e., it is in change of freeing the objects), :c:type:`SUNMemory` objects for the vector data on the host and device, pointers to execution policies that control how streaming and reduction kernels are launched, a :c:type:`SUNMemoryHelper` for performing memory -operations, and a private data structure which holds additonal members that +operations, and a private data structure which holds additional members that should not be accessed directly. When instantiated with :c:func:`N_VNew_Cuda`, the underlying data will be @@ -84,7 +84,7 @@ accessor functions: .. c:function:: sunbooleantype N_VIsManagedMemory_Cuda(N_Vector v) - This function returns a boolean flag indiciating if the vector + This function returns a boolean flag indicating if the vector data array is in managed memory or not. @@ -272,7 +272,7 @@ options as the vector they are cloned from while vectors created with **Notes** * When there is a need to access components of an ``N_Vector_Cuda``, ``v``, - it is recommeded to use functions :c:func:`N_VGetDeviceArrayPointer_Cuda()` or + it is recommended to use functions :c:func:`N_VGetDeviceArrayPointer_Cuda()` or :c:func:`N_VGetHostArrayPointer_Cuda()`. However, when using managed memory, the function :c:func:`N_VGetArrayPointer` may also be used. @@ -375,7 +375,7 @@ In total, SUNDIALS provides 3 execution policies: .. cpp:function:: SUNCudaBlockReduceExecPolicy(const size_t blockDim, const cudaStream_t stream = 0) - Is for kernels performing a reduction across indvidual thread blocks. The + Is for kernels performing a reduction across individual thread blocks. The number of threads per block (blockDim) can be set to any valid multiple of the CUDA warp size. The grid size (gridDim) can be set to any value greater than 0. If it is set to 0, then the grid size will be chosen so @@ -384,7 +384,7 @@ In total, SUNDIALS provides 3 execution policies: .. cpp:function:: SUNCudaBlockReduceAtomicExecPolicy(const size_t blockDim, const cudaStream_t stream = 0) - Is for kernels performing a reduction across indvidual thread blocks using + Is for kernels performing a reduction across individual thread blocks using atomic operations. The number of threads per block (blockDim) can be set to any valid multiple of the CUDA warp size. The grid size (gridDim) can be set to any value greater than 0. If it is set to 0, then the grid size diff --git a/doc/shared/nvectors/NVector_HIP.rst b/doc/shared/nvectors/NVector_HIP.rst index f722e9cfac..050e379982 100644 --- a/doc/shared/nvectors/NVector_HIP.rst +++ b/doc/shared/nvectors/NVector_HIP.rst @@ -44,7 +44,7 @@ The content members are the vector length (size), a boolean flag that signals if the vector owns the data (i.e. it is in charge of freeing the data), pointers to vector data on the host and the device, pointers to :cpp:type:`SUNHipExecPolicy` implementations that control how the HIP kernels are launched for streaming and -reduction vector kernels, and a private data structure which holds additonal members +reduction vector kernels, and a private data structure which holds additional members that should not be accessed directly. When instantiated with :c:func:`N_VNew_Hip`, the underlying data will be @@ -81,7 +81,7 @@ accessor functions: .. c:function:: sunbooleantype N_VIsManagedMemory_Hip(N_Vector v) - This function returns a boolean flag indiciating if the vector + This function returns a boolean flag indicating if the vector data array is in managed memory or not. @@ -255,7 +255,7 @@ options as the vector they are cloned from while vectors created with **Notes** * When there is a need to access components of an ``N_Vector_Hip``, ``v``, - it is recommeded to use functions :c:func:`N_VGetDeviceArrayPointer_Hip()` or + it is recommended to use functions :c:func:`N_VGetDeviceArrayPointer_Hip()` or :c:func:`N_VGetHostArrayPointer_Hip()`. However, when using managed memory, the function :c:func:`N_VGetArrayPointer` may also be used. @@ -359,7 +359,7 @@ In total, SUNDIALS provides 4 execution policies: .. cpp:function:: SUNHipBlockReduceExecPolicy(const size_t blockDim, const hipStream_t stream = 0) - Is for kernels performing a reduction across indvidual thread blocks. The + Is for kernels performing a reduction across individual thread blocks. The number of threads per block (blockDim) can be set to any valid multiple of the HIP warp size. The grid size (gridDim) can be set to any value greater than 0. If it is set to 0, then the grid size will be chosen so that there @@ -368,7 +368,7 @@ In total, SUNDIALS provides 4 execution policies: .. cpp:function:: SUNHipBlockReduceAtomicExecPolicy(const size_t blockDim, const hipStream_t stream = 0) - Is for kernels performing a reduction across indvidual thread blocks using + Is for kernels performing a reduction across individual thread blocks using atomic operations. The number of threads per block (blockDim) can be set to any valid multiple of the HIP warp size. The grid size (gridDim) can be set to any value greater than 0. If it is set to 0, then the grid size diff --git a/doc/shared/nvectors/NVector_MPIManyVector.rst b/doc/shared/nvectors/NVector_MPIManyVector.rst index fdaeaf31c9..f7907c446c 100644 --- a/doc/shared/nvectors/NVector_MPIManyVector.rst +++ b/doc/shared/nvectors/NVector_MPIManyVector.rst @@ -27,7 +27,7 @@ construction of distinct NVECTOR modules for each component, that are then combined together to form the NVECTOR_MPIMANYVECTOR. Three potential use cases for this module include: -A. *Heterogenous computational architectures (single-node or multi-node)*: +A. *Heterogeneous computational architectures (single-node or multi-node)*: for data partitioning between different computing resources on a node, architecture-specific subvectors may be created for each partition. For example, a user could create one MPI-parallel component based on diff --git a/doc/shared/nvectors/NVector_MPIPlusX.rst b/doc/shared/nvectors/NVector_MPIPlusX.rst index 88905edd50..d22070eaef 100644 --- a/doc/shared/nvectors/NVector_MPIPlusX.rst +++ b/doc/shared/nvectors/NVector_MPIPlusX.rst @@ -71,7 +71,7 @@ user-callable routines: .. c:function:: N_Vector N_VMake_MPIPlusX(MPI_Comm comm, N_Vector *local_vector, SUNContext sunctx) - This function creates a MPIPlusX vector from an exisiting local + This function creates a MPIPlusX vector from an existing local (i.e. on node) NVECTOR object, and a user-created MPI communicator. The input *comm* should be this user-created MPI communicator. diff --git a/doc/shared/nvectors/NVector_ManyVector.rst b/doc/shared/nvectors/NVector_ManyVector.rst index cded89fd73..5afeccb8dc 100644 --- a/doc/shared/nvectors/NVector_ManyVector.rst +++ b/doc/shared/nvectors/NVector_ManyVector.rst @@ -24,7 +24,7 @@ construction of distinct NVECTOR modules for each component, that are then combined together to form the NVECTOR_MANYVECTOR. Two potential use cases for this flexibility include: -A. *Heterogenous computational architectures*: +A. *Heterogeneous computational architectures*: for data partitioning between different computing resources on a node, architecture-specific subvectors may be created for each partition. For example, a user could create one GPU-accelerated component based diff --git a/doc/shared/nvectors/NVector_OpenMP.rst b/doc/shared/nvectors/NVector_OpenMP.rst index 4f84694770..2947c403db 100644 --- a/doc/shared/nvectors/NVector_OpenMP.rst +++ b/doc/shared/nvectors/NVector_OpenMP.rst @@ -276,7 +276,7 @@ options as the vector they are cloned from while vectors created with loop than it is to use ``NV_Ith_OMP(v,i)`` within the loop. * :c:func:`N_VNewEmpty_OpenMP` and :c:func:`N_VMake_OpenMP` set the field - *own_data* to ``SUNFALSE``. The implemenation of :c:func:`N_VDestroy` will + *own_data* to ``SUNFALSE``. The implementation of :c:func:`N_VDestroy` will not attempt to free the pointer data for any ``N_Vector`` with *own_data* set to ``SUNFALSE``. In such a case, it is the user's responsibility to deallocate the data pointer. diff --git a/doc/shared/nvectors/NVector_Operations.rst b/doc/shared/nvectors/NVector_Operations.rst index e184b829de..475abc4a84 100644 --- a/doc/shared/nvectors/NVector_Operations.rst +++ b/doc/shared/nvectors/NVector_Operations.rst @@ -104,7 +104,7 @@ operations below. Returns a pointer to a ``sunrealtype`` array from the ``N_Vector`` *v*. Note that this assumes that the internal data in the ``N_Vector`` is a contiguous array of ``sunrealtype`` and is - accesible from the CPU. + accessible from the CPU. This routine is only used in the solver-specific interfaces to the dense and banded diff --git a/doc/shared/nvectors/NVector_PETSc.rst b/doc/shared/nvectors/NVector_PETSc.rst index f7284ae7f8..3d0983e149 100644 --- a/doc/shared/nvectors/NVector_PETSc.rst +++ b/doc/shared/nvectors/NVector_PETSc.rst @@ -162,7 +162,7 @@ options as the vector they are cloned from while vectors created with **Notes** * When there is a need to access components of an ``N_Vector_Petsc v``, it - is recommeded to extract the PETSc vector via ``x_vec = N_VGetVector_Petsc(v);`` + is recommended to extract the PETSc vector via ``x_vec = N_VGetVector_Petsc(v);`` and then access components using appropriate PETSc functions. * The functions :c:func:`N_VNewEmpty_Petsc` and :c:func:`N_VMake_Petsc`, set the diff --git a/doc/shared/nvectors/NVector_Trilinos.rst b/doc/shared/nvectors/NVector_Trilinos.rst index c891f07ab6..d5b404ea58 100644 --- a/doc/shared/nvectors/NVector_Trilinos.rst +++ b/doc/shared/nvectors/NVector_Trilinos.rst @@ -104,7 +104,7 @@ The module NVECTOR_TRILINOS provides the following additional user-callable rout in SUNDIALS. * When there is a need to access components of an ``N_Vector_Trilinos v``, - it is recommeded to extract the Trilinos vector object via ``x_vec = + it is recommended to extract the Trilinos vector object via ``x_vec = N_VGetVector_Trilinos(v)`` and then access components using the appropriate Trilinos functions. diff --git a/doc/shared/sunadaptcontroller/SUNAdaptController_Soderlind.rst b/doc/shared/sunadaptcontroller/SUNAdaptController_Soderlind.rst index 6c8a77bcb8..0c1b0cc620 100644 --- a/doc/shared/sunadaptcontroller/SUNAdaptController_Soderlind.rst +++ b/doc/shared/sunadaptcontroller/SUNAdaptController_Soderlind.rst @@ -254,7 +254,7 @@ also provides the following additional user-callable routines: h' = h_n \varepsilon_n^{-\hat{k}_1/(p+1)} \left(\frac{\varepsilon_n}{\varepsilon_{n-1}}\right)^{-\hat{k}_2/(p+1)}. The inputs to this function correspond to the values of :math:`\hat{k}_1` and :math:`\hat{k}_2`, - which are internally transformed into the Soderlind coeficients :math:`k_1 = \hat{k}_1+\hat{k}_2` + which are internally transformed into the Soderlind coefficients :math:`k_1 = \hat{k}_1+\hat{k}_2` and :math:`k_2 = -\hat{k}_2`. :param C: the SUNAdaptController_Soderlind object. @@ -300,7 +300,7 @@ also provides the following additional user-callable routines: h' = h_n \varepsilon_n^{-\hat{k}_1/(p+1)} \left(\frac{\varepsilon_n}{\varepsilon_{n-1}}\right)^{-\hat{k}_2/(p+1)} \left(\frac{h_n}{h_{n-1}}\right). The inputs to this function correspond to the values of :math:`\hat{k}_1` and :math:`\hat{k}_2`, - which are internally transformed into the Soderlind coeficients :math:`k_1 = \hat{k}_1+\hat{k}_2`, + which are internally transformed into the Soderlind coefficients :math:`k_1 = \hat{k}_1+\hat{k}_2`, :math:`k_2 = -\hat{k}_2`, and :math:`k_4=1`. :param C: the SUNAdaptController_Soderlind object. diff --git a/doc/shared/sundials.bib b/doc/shared/sundials.bib index 1f9d585a91..b000f2c3dc 100644 --- a/doc/shared/sundials.bib +++ b/doc/shared/sundials.bib @@ -1880,6 +1880,14 @@ @article{Gust:94 doi = {10.1145/198429.198437} } +@techreport{HEJ:76, + title = {User's guide for {DVERK}: {A} subroutine for solving non-stiff {ODE}'s}, + author = {Hull, TE and Enright, WH and Jackson, KR}, + year = {1976}, + number = {100}, + institution={University of Toronto. Department of Computer Science} +} + @article{Jay:21, title = {Symplecticness conditions of some low order partitioned methods for non-autonomous Hamiltonian systems}, author = {Jay, Laurent O}, @@ -2133,17 +2141,6 @@ @article{Sof:04 doi = {10.1016/j.mcm.2005.01.010} } -@article{Ver:78, - author = {Verner, J.H}, - title = {Explicit Runge-Kutta methods with estimates of the local truncation error}, - journal = {SIAM Journal of Numerical Analysis}, - volume = {15}, - number = {4}, - pages = {772-790}, - year = {1978}, - doi = {10.1137/0715051} -} - @article{Ver:10, author = {Verner, J.H}, title = {Numerically optimal {Runge–Kutta} pairs with interpolants}, diff --git a/doc/shared/sundials/Errors.rst b/doc/shared/sundials/Errors.rst index 20cbcc5405..ce273ea76e 100644 --- a/doc/shared/sundials/Errors.rst +++ b/doc/shared/sundials/Errors.rst @@ -18,7 +18,7 @@ Error Checking .. versionadded:: 7.0.0 Until version 7.0.0, error reporting and handling was inconsistent throughout SUNDIALS. Starting with version 7.0.0 all of SUNDIALS (the core, implementations of core modules, and -packages) reports error mesages through the :c:type:`SUNLogger` API. Furthermore, functions in the +packages) reports error messages through the :c:type:`SUNLogger` API. Furthermore, functions in the SUNDIALS core API (i.e., ``SUN`` or ``N_V`` functions only) either return a :c:type:`SUNErrCode`, or (if they don't return a :c:type:`SUNErrCode`) they internally record an error code (if an error occurs) within the :c:type:`SUNContext` for the execution stream. This "last error" is accessible @@ -45,17 +45,17 @@ Thus, in user code, SUNDIALS core API functions can be checked for errors in one length = 2; v = N_VNew_Serial(length, sunctx); sunerr = SUNContext_GetLastError(sunctx); - if (sunerr) { /* an error occured, do something */ } + if (sunerr) { /* an error occurred, do something */ } // If the function returns a SUNErrCode, we can check it directly sunerr = N_VLinearCombination(...); - if (sunerr) { /* an error occured, do something */ } + if (sunerr) { /* an error occurred, do something */ } // Another function that does not return a SUNErrCode. dotprod = N_VDotProd(...); SUNContext_GetLastError(sunctx); if (sunerr) { - /* an error occured, do something */ + /* an error occurred, do something */ } else { print("dotprod = %.2f\n", dotprod); } @@ -114,11 +114,11 @@ The error handlers provided in SUNDIALS are: Logs the error that occurred using the :c:type:`SUNLogger` from ``sunctx``. This is the default error handler. - :param line: the line number at which the error occured - :param func: the function in which the error occured - :param file: the file in which the error occured + :param line: the line number at which the error occurred + :param func: the function in which the error occurred + :param file: the file in which the error occurred :param msg: the message to log, if this is ``NULL`` then the default error message for the error code will be used - :param err_code: the error code for the error that occured + :param err_code: the error code for the error that occurred :param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler` :param sunctx: pointer to a valid :c:type:`SUNContext` object @@ -128,13 +128,13 @@ The error handlers provided in SUNDIALS are: const char* msg, SUNErrCode err_code, \ void* err_user_data, SUNContext sunctx) - Logs the error and aborts the program if an error occured. + Logs the error and aborts the program if an error occurred. - :param line: the line number at which the error occured - :param func: the function in which the error occured - :param file: the file in which the error occured + :param line: the line number at which the error occurred + :param func: the function in which the error occurred + :param file: the file in which the error occurred :param msg: this parameter is ignored - :param err_code: the error code for the error that occured + :param err_code: the error code for the error that occurred :param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler` :param sunctx: pointer to a valid :c:type:`SUNContext` object @@ -145,13 +145,13 @@ The error handlers provided in SUNDIALS are: const char* msg, SUNErrCode err_code, \ void* err_user_data, SUNContext sunctx) - Logs the error and calls ``MPI_Abort`` if an error occured. + Logs the error and calls ``MPI_Abort`` if an error occurred. - :param line: the line number at which the error occured - :param func: the function in which the error occured - :param file: the file in which the error occured + :param line: the line number at which the error occurred + :param func: the function in which the error occurred + :param file: the file in which the error occurred :param msg: this parameter is ignored - :param err_code: the error code for the error that occured + :param err_code: the error code for the error that occurred :param err_user_data: the user pointer provided to :c:func:`SUNContext_PushErrHandler` :param sunctx: pointer to a valid :c:type:`SUNContext` object diff --git a/doc/shared/sundials/GPU.rst b/doc/shared/sundials/GPU.rst index 8607643adf..e3c12bb41c 100644 --- a/doc/shared/sundials/GPU.rst +++ b/doc/shared/sundials/GPU.rst @@ -64,7 +64,7 @@ data partitioning (achievable with the NVECTOR_MANYVECTOR, see programming environments they support, and what class of memory they support (unmanaged or UVM). Users may also supply their own GPU-enabled :c:type:`N_Vector`, :c:type:`SUNMatrix`, or :c:type:`SUNLinearSolver` - implementation, and the capabilties will be leveraged since SUNDIALS operates + implementation, and the capabilities will be leveraged since SUNDIALS operates on data through these APIs. .. ifconfig:: package_name != 'kinsol' @@ -77,7 +77,7 @@ data partitioning (achievable with the NVECTOR_MANYVECTOR, see programming environments they support, and what class of memory they support (unmanaged or UVM). Users may also supply their own GPU-enabled :c:type:`N_Vector`, :c:type:`SUNMatrix`, :c:type:`SUNLinearSolver`, or - :c:type:`SUNNonlinearSolver` implementation, and the capabilties will be + :c:type:`SUNNonlinearSolver` implementation, and the capabilities will be leveraged since SUNDIALS operates on data through these APIs. In addition, SUNDIALS provides a memory management helper module @@ -174,7 +174,7 @@ accelerated SUNDIALS are: #. Write user-supplied functions so that they use data only in the device memory space (again, unless an atypical data partitioning is used). A few examples of these functions are the right-hand side evaluation function, the Jacobian - evalution function, or the preconditioner evaulation function. In the context + evaluation function, or the preconditioner evaluation function. In the context of CUDA and the right-hand side function, one way a user might ensure data is accessed on the device is, for example, calling a CUDA kernel, which does all of the computation, from a CPU function which simply extracts the underlying diff --git a/doc/shared/sundials/Install.rst b/doc/shared/sundials/Install.rst index d666fc7b29..3d730dd594 100644 --- a/doc/shared/sundials/Install.rst +++ b/doc/shared/sundials/Install.rst @@ -31,7 +31,7 @@ by cloning the `SUNDIALS GitHub repository `_ SUNDIALS release compressed archives (``.tar.gz``) from the SUNDIALS `website `_. -The compressed archives allow for downloading of indvidual SUNDIALS packages. +The compressed archives allow for downloading of individual SUNDIALS packages. The name of the distribution archive is of the form ``SOLVER-7.1.0.tar.gz``, where ``SOLVER`` is one of: ``sundials``, ``cvode``, ``cvodes``, ``arkode``, ``ida``, ``idas``, or ``kinsol``, and ``7.1.0`` @@ -187,7 +187,7 @@ Using CMake with the ``cmake-gui`` GUI follows a similar process: #. The first time you click ``Configure``, make sure to pick the appropriate generator (the following will assume generation of Unix - Makfiles). + Makefiles). #. New values are highlighted in red @@ -523,9 +523,19 @@ illustration only. .. cmakeoption:: CMAKE_CUDA_ARCHITECTURES - Specifies the CUDA architecture to compile for. + Specifies the CUDA architecture to compile for i.e., ``60`` for Pascal, + ``70`` Volta, ``80`` for Ampere, ``90`` for Hopper, etc. See the `GPU compute + capability tables `_ on the NVIDIA + webpage and the `GPU Compilation `_ + section of the CUDA documentation for more information. - Default: ``sm_30`` + Default: Determined automatically by CMake. Users are encouraged to override + this value with the architecture for their system as the default varies + across compilers and compiler versions. + + .. versionchanged:: x.y.z + + In prior versions ``CMAKE_CUDA_ARCHITECTURES`` defaulted to ``70``. .. cmakeoption:: EXAMPLES_ENABLE_C @@ -591,7 +601,7 @@ illustration only. Default: ``OFF`` .. warning:: There is a known issue with MSYS/gfortran and SUNDIALS shared libraries - that causes linking the Fortran interfaces to fail when buidling SUNDIALS. For + that causes linking the Fortran interfaces to fail when building SUNDIALS. For now the work around is to only build with static libraries when using MSYS with gfortran on Windows. @@ -612,7 +622,7 @@ illustration only. .. cmakeoption:: SUNDIALS_BUILD_WITH_MONITORING - Build SUNDIALS with capabilties for fine-grained monitoring of solver progress + Build SUNDIALS with capabilities for fine-grained monitoring of solver progress and statistics. This is primarily useful for debugging. Default: OFF @@ -624,7 +634,7 @@ illustration only. .. cmakeoption:: SUNDIALS_BUILD_WITH_PROFILING - Build SUNDIALS with capabilties for fine-grained profiling. + Build SUNDIALS with capabilities for fine-grained profiling. This requires POSIX timers or the Windows ``profileapi.h`` timers. Default: OFF @@ -669,8 +679,8 @@ illustration only. .. cmakeoption:: SUNDIALS_GINKGO_BACKENDS - Semi-colon separated list of Ginkgo target architecutres/executors to build for. - Options currenty supported are REF (the Ginkgo reference executor), OMP, CUDA, HIP, and SYCL. + Semi-colon separated list of Ginkgo target architectures/executors to build for. + Options currently supported are REF (the Ginkgo reference executor), OMP, CUDA, HIP, and SYCL. Default: "REF;OMP" @@ -901,7 +911,7 @@ illustration only. .. cmakeoption:: PETSC_INCLUDES - Semi-colon separated list of PETSc include directroies. Unless provided by + Semi-colon separated list of PETSc include directories. Unless provided by the user, this is autopopulated based on the PETSc installation found in ``PETSC_DIR``. @@ -935,7 +945,7 @@ illustration only. Default: ``OFF`` - .. note:: See additional information on building wtih + .. note:: See additional information on building with SuperLU_DIST enabled in :numref:`Installation.CMake.ExternalLibraries`. .. cmakeoption:: SUPERLUDIST_DIR @@ -1264,7 +1274,7 @@ CUDA (for NVIDIA devices), HIP (for AMD devices) and SYCL/DPC++ (for Intel devic supported hardware). To enable Ginkgo in SUNDIALS, set the :cmakeop:`ENABLE_GINKGO` to ``ON`` and provide the path to the root of the Ginkgo installation in :cmakeop:`Ginkgo_DIR`. Additionally, :cmakeop:`SUNDIALS_GINKGO_BACKENDS` must be set to a list of Ginkgo target -architecutres/executors. E.g., +architectures/executors. E.g., .. code-block:: bash 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/shared/sunlinsol/SUNLinSol_API.rst b/doc/shared/sunlinsol/SUNLinSol_API.rst index 6650b88d20..9bc00e30da 100644 --- a/doc/shared/sunlinsol/SUNLinSol_API.rst +++ b/doc/shared/sunlinsol/SUNLinSol_API.rst @@ -900,7 +900,7 @@ SUNLinSol implementations. As SUNDIALS packages utilize generic SUNLinSol modules they may naturally leverage user-supplied ``SUNLinearSolver`` implementations, thus there exist a wide range of possible linear solver combinations. Some intended use cases for both the -SUNDIALS-provided and user-supplied SUNLinSol modules are discussd in the +SUNDIALS-provided and user-supplied SUNLinSol modules are discussed in the sections below. @@ -949,7 +949,7 @@ Matrix-based iterative linear solvers (reusing :math:`A`) Matrix-based iterative linear solver modules require a matrix and compute an inexact solution to the linear system *defined by the matrix*. This -matrix will be updated infrequently and resued across multiple solves +matrix will be updated infrequently and reused across multiple solves to amortize the cost of matrix construction. As in the direct linear solver case, only thin SUNMATRIX and SUNLinSol wrappers for the underlying matrix and linear solver structures need to be created to utilize diff --git a/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst b/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst index 34fd25c82d..5b1a4e0a3d 100644 --- a/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst +++ b/doc/shared/sunlinsol/SUNLinSol_Ginkgo.rst @@ -45,9 +45,9 @@ Using SUNLINEARSOLVER_GINKGO After choosing a compatible ``N_Vector`` (see :numref:`SUNMatrix.Ginkgo.CompatibleNVectors`) and creating a Ginkgo-enabled ``SUNMatrix`` (see :numref:`SUNMatrix.Ginkgo`) to use the SUNLINEARSOLVER_GINKGO module, we first create a Ginkgo stopping criteria object. Importantly, the ``sundials::ginkgo::DefaultStop`` class provided -by SUNDIALS implements a stopping critierion that matches the default SUNDIALS stopping critierion. +by SUNDIALS implements a stopping criterion that matches the default SUNDIALS stopping criterion. Namely, it checks if the max iterations (5 by default) were reached or if the absolute residual -norm was below a speicified tolerance. The critierion can be created just like any other +norm was below a specified tolerance. The criterion can be created just like any other Ginkgo stopping criteria: .. code-block:: cpp @@ -59,7 +59,7 @@ Ginkgo stopping criteria: but it is optional. However, to use the Ginkgo multigrid or cbgmres linear solvers, different Ginkgo criterion must be used. -Once we have created our stopping critierion, we create a Ginkgo solver factory object and +Once we have created our stopping criterion, we create a Ginkgo solver factory object and wrap it in a :cpp:type:`sundials::ginkgo::LinearSolver` object. In this example, we create a Ginkgo conjugate gradient solver: @@ -185,7 +185,7 @@ In this section we list the public API of the :cpp:type:`sundials::ginkgo::Linea .. cpp:function:: gko::LinOp* Solve(N_Vector b, N_Vector x, sunrealtype tol) - Solve the linear system Ax = b to the specificed tolerance. + Solve the linear system Ax = b to the specified tolerance. :param b: the right-hand side vector :param x: the solution vector diff --git a/doc/shared/sunlinsol/SUNLinSol_SuperLUDIST.rst b/doc/shared/sunlinsol/SUNLinSol_SuperLUDIST.rst index 177d9558b2..462c0c7c7e 100644 --- a/doc/shared/sunlinsol/SUNLinSol_SuperLUDIST.rst +++ b/doc/shared/sunlinsol/SUNLinSol_SuperLUDIST.rst @@ -164,7 +164,7 @@ information: * ``berr`` -- the componentwise relative backward error of the computed solution, -* ``grid`` -- pointer to the SuperLU_DIST structure that strores the 2D process grid +* ``grid`` -- pointer to the SuperLU_DIST structure that stores the 2D process grid * ``lu`` -- pointer to the SuperLU_DIST structure that stores the distributed ``L`` and ``U`` factors, @@ -172,7 +172,7 @@ information: * ``scaleperm`` -- pointer to the SuperLU_DIST structure that stores vectors describing the transformations done to the matrix ``A``, -* ``options`` -- pointer to the SuperLU_DIST stucture which contains options that control +* ``options`` -- pointer to the SuperLU_DIST structure which contains options that control how the linear system is factorized and solved, * ``solve`` -- pointer to the SuperLU_DIST solve structure, diff --git a/doc/shared/sunlinsol/SUNLinSol_cuSolverSp.rst b/doc/shared/sunlinsol/SUNLinSol_cuSolverSp.rst index 23894bd7ef..58ce79681d 100644 --- a/doc/shared/sunlinsol/SUNLinSol_cuSolverSp.rst +++ b/doc/shared/sunlinsol/SUNLinSol_cuSolverSp.rst @@ -125,7 +125,7 @@ In addition, the module provides the following user-callable routines: The function ``SUNLinSol_cuSolverSp_batchQR_GetDeviceSpace`` returns the cuSOLVER batch QR method internal buffer size, in bytes, in the argument ``cuSolverInternal`` and the cuSOLVER - batch QR workspace buffer size, in bytes, in the agrument + batch QR workspace buffer size, in bytes, in the argument ``cuSolverWorkspace``. The size of the internal buffer is proportional to the number of matrix blocks while the size of the workspace is almost independent of the number of blocks. diff --git a/doc/shared/sunmatrix/SUNMatrix_Description.rst b/doc/shared/sunmatrix/SUNMatrix_Description.rst index 11f69ab896..fe17e6f3f2 100644 --- a/doc/shared/sunmatrix/SUNMatrix_Description.rst +++ b/doc/shared/sunmatrix/SUNMatrix_Description.rst @@ -207,7 +207,7 @@ set and all operations are copied when cloning a matrix. SUNMATRIX_CUSPARSE CUDA sparse CSR matrix SUNMATRIX_CUSTOM User-provided custom matrix SUNMATRIX_DENSE Dense :math:`M \times N` matrix - SUNMATRIX_GINKGO SUNMatrix wraper for Ginkgo matrices + SUNMATRIX_GINKGO SUNMatrix wrapper for Ginkgo matrices SUNMATRIX_MAGMADENSE Dense :math:`M \times N` matrix SUNMATRIX_ONEMKLDENSE oneMKL dense :math:`M \times N` matrix SUNMATRIX_SLUNRLOC SUNMatrix wrapper for SuperLU_DIST SuperMatrix diff --git a/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst b/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst index 899782dcbf..bbcadfe20c 100644 --- a/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst +++ b/doc/shared/sunmatrix/SUNMatrix_KokkosDense.rst @@ -142,7 +142,7 @@ class. :param rows: number of matrix rows :param cols: number of matrix columns - :param ex: an execuation space + :param ex: an execution space :param sunctx: the SUNDIALS simulation context object (:c:type:`SUNContext`) .. cpp:function:: DenseMatrix(size_type blocks, size_type block_rows, \ @@ -166,7 +166,7 @@ class. :param blocks: number of matrix blocks :param block_rows: number of rows in a block :param block_cols: number of columns in a block - :param ex: an execuation space + :param ex: an execution space :param sunctx: the SUNDIALS simulation context object (:c:type:`SUNContext`) .. cpp:function:: DenseMatrix(DenseMatrix&& that_matrix) noexcept diff --git a/doc/shared/sunmemory/SUNMemory_Description.rst b/doc/shared/sunmemory/SUNMemory_Description.rst index 3499367c7b..2efc154aa4 100644 --- a/doc/shared/sunmemory/SUNMemory_Description.rst +++ b/doc/shared/sunmemory/SUNMemory_Description.rst @@ -70,7 +70,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, .. c:enumerator:: SUNMEMTYPE_PINNED - Page-locked memory accesible on the host + Page-locked memory accessible on the host .. c:enumerator:: SUNMEMTYPE_DEVICE diff --git a/doc/shared/sunnonlinsol/SUNNonlinSol_API.rst b/doc/shared/sunnonlinsol/SUNNonlinSol_API.rst index d169c83001..4715ee8e29 100644 --- a/doc/shared/sunnonlinsol/SUNNonlinSol_API.rst +++ b/doc/shared/sunnonlinsol/SUNNonlinSol_API.rst @@ -122,7 +122,7 @@ initialization (:c:func:`SUNNonlinSolInitialize`), setup * *mem* -- the SUNDIALS integrator memory structure. **Return value:** - The return value is zero for a successul solve, a positive value + The return value is zero for a successful solve, a positive value for a recoverable error (i.e., the solve failed and the integrator should reduce the step size and reattempt the step), and a negative value for an unrecoverable error (i.e., the solve failed the and @@ -357,7 +357,7 @@ module have types defined in the header file * *mem* -- is the SUNDIALS integrator memory structure. **Return value:** - The return value is zero for a successul solve, a positive value for + The return value is zero for a successful solve, a positive value for a recoverable error, and a negative value for an unrecoverable error. **Notes:** @@ -383,7 +383,7 @@ module have types defined in the header file * *mem* -- is the SUNDIALS integrator memory structure. **Return value:** - The return value is zero for a successul solve, a positive value for + The return value is zero for a successful solve, a positive value for a recoverable error, and a negative value for an unrecoverable error. **Notes:** @@ -415,7 +415,7 @@ module have types defined in the header file * *mem* -- is the SUNDIALS integrator memory structure. **Return value:** - The return value is zero for a successul solve, a positive value for + The return value is zero for a successful solve, a positive value for a recoverable error, and a negative value for an unrecoverable error. **Notes:** diff --git a/doc/shared/sunnonlinsol/SUNNonlinSol_PetscSNES.rst b/doc/shared/sunnonlinsol/SUNNonlinSol_PetscSNES.rst index e9d9c856f1..1cb332300d 100644 --- a/doc/shared/sunnonlinsol/SUNNonlinSol_PetscSNES.rst +++ b/doc/shared/sunnonlinsol/SUNNonlinSol_PetscSNES.rst @@ -25,7 +25,7 @@ configured to use PETSc. Instructions on how to do this are given in SUNNonlinSol_PetscSNES module, include the header file ``sunnonlinsol/sunnonlinsol_petscsnes.h``. The library to link to is ``libsundials_sunnonlinsolpetsc.lib`` where ``.lib`` is typically ``.so`` for -shared libaries and ``.a`` for static libraries. Users of the +shared libraries and ``.a`` for static libraries. Users of the SUNNonlinSol_PetscSNES module should also see :numref:`NVectors.NVPETSc` which discusses the NVECTOR interface to the PETSc ``Vec`` API. @@ -184,4 +184,4 @@ These entries of the *content* field contain the following information: * ``r`` -- the nonlinear residual, * ``y`` -- wrapper for PETSc vectors used in the system function, * ``f`` -- wrapper for PETSc vectors used in the system function, -* ``Sys`` -- nonlinear system definining function. +* ``Sys`` -- nonlinear system defining function. diff --git a/doc/sundials/ug.tex b/doc/sundials/ug.tex index aa3d25945c..a7478dc4e8 100644 --- a/doc/sundials/ug.tex +++ b/doc/sundials/ug.tex @@ -486,7 +486,7 @@ \setlength{\leftmargin}{\labelwidth+\labelsep}}} {\end{list}} %%----------------------------------------------------- -%% Underlying list environemnt for function definitions +%% Underlying list environment for function definitions %%----------------------------------------------------- \newenvironment{Ventry}[1][\quad] {\begin{list}{}{ @@ -652,7 +652,7 @@ \makeatletter \long\def\addDepName#1{\def\@tempa{#1}\ifx\@tempa\empty\item[Deprecated Name]{None}\else\item[Deprecated Name]{For backward compatibility, the wrapper - function \id{#1} with idential input and output arguments is also + function \id{#1} with identical input and output arguments is also provided.}\fi} \makeatother diff --git a/doc/superbuild/source/contributing/index.rst b/doc/superbuild/source/contributing/index.rst index 947443d9f5..4bc71a6bc5 100644 --- a/doc/superbuild/source/contributing/index.rst +++ b/doc/superbuild/source/contributing/index.rst @@ -16,7 +16,7 @@ Contributing ============ -There are two primary ways of contributing to SUNDIALS. The first way is by particpating +There are two primary ways of contributing to SUNDIALS. The first way is by participating in the development of SUNDIALS directly through contributions of code to the primary `SUNDIALS repository `_. This is the best way to contribute bug fixes and minor improvements. At this time, the SUNDIALS team does not have the resources diff --git a/doc/superbuild/source/developers/appendix/GitCheatSheet.rst b/doc/superbuild/source/developers/appendix/GitCheatSheet.rst index 3e3c7f2a5c..1f7d86fa7d 100644 --- a/doc/superbuild/source/developers/appendix/GitCheatSheet.rst +++ b/doc/superbuild/source/developers/appendix/GitCheatSheet.rst @@ -248,7 +248,7 @@ the :ref:`Workflow` section. reordering, squashing, updating commit messages, etc.) before pushing to the remote repository. - Rebase the commited but not pushed changes on the current branch and execute + Rebase the committed but not pushed changes on the current branch and execute a given command (``cmd``) between each step in the rebase .. code-block:: none diff --git a/doc/superbuild/source/developers/getting_started/Workflow.rst b/doc/superbuild/source/developers/getting_started/Workflow.rst index 5da388e53a..52967d44b8 100644 --- a/doc/superbuild/source/developers/getting_started/Workflow.rst +++ b/doc/superbuild/source/developers/getting_started/Workflow.rst @@ -149,7 +149,7 @@ branches and the ``master`` for maintenance branches. work. #. During the development cycle it is a good practice to periodically push local - commits to the remote repo. To push your locally commited changes use: + commits to the remote repo. To push your locally committed changes use: .. code-block:: none @@ -259,7 +259,7 @@ Manually resolve the conflicts in an editor: $ git rebase --continue -#. If desired, push the updated local brach to the remote repo with +#. If desired, push the updated local branch to the remote repo with .. code-block:: none @@ -293,7 +293,7 @@ merge tool: $ git rebase --continue -#. If desired, push the updated local brach to the remote repo with +#. If desired, push the updated local branch to the remote repo with .. code-block:: none diff --git a/doc/superbuild/source/developers/style_guide/SourceCode.rst b/doc/superbuild/source/developers/style_guide/SourceCode.rst index 473409d987..ba5a9c4ff8 100644 --- a/doc/superbuild/source/developers/style_guide/SourceCode.rst +++ b/doc/superbuild/source/developers/style_guide/SourceCode.rst @@ -17,7 +17,7 @@ Naming ====== -All exported symbols that will be publically available must be namespaced +All exported symbols that will be publicly available must be namespaced appropriately! * ``SUN_`` or ``SUNDIALS_`` for macros @@ -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/doc/superbuild/source/developers/testing/Answers.rst b/doc/superbuild/source/developers/testing/Answers.rst index ecefcfbd4d..6d64f7e4ea 100644 --- a/doc/superbuild/source/developers/testing/Answers.rst +++ b/doc/superbuild/source/developers/testing/Answers.rst @@ -32,7 +32,7 @@ Due to difference in microarichtectures and the nature of floating point arithme possible that the output generated on one machine may differ from the output generated on another. As such, we specify that the the answer files that are embedded in ``examples/`` (the ``.out`` files) should match what is produced on the Jenkins CI machine. We also have a `separate git -repostiory `_ which holds answers for other machines, +repository `_ which holds answers for other machines, such as the GitHub Actions virtual machines. diff --git a/doc/superbuild/source/developers/testing/CI.rst b/doc/superbuild/source/developers/testing/CI.rst index 00ded30a77..a71b4e5930 100644 --- a/doc/superbuild/source/developers/testing/CI.rst +++ b/doc/superbuild/source/developers/testing/CI.rst @@ -94,7 +94,7 @@ environment so that its buildcache can be leveraged. We also maintain two containers for the {int32, double} pair that are built automatically (in a GitHub action) every week against the latest Spack develop commit. This allows us to test against -the latest versions of dependencies reguarly and detect interface breakages. +the latest versions of dependencies regularly and detect interface breakages. GitLab CI Testing @@ -264,7 +264,7 @@ These submodules work in conjunction with ``spack_packages/sundials/package.py`` to configure and build any third-party libraries needed by the SUNDIALS configuration and generates an initial CMake cache file for building SUNDIALS. Other packages can be added to ``spack_packages//package.py`` -if the default Spack package needs to be overriden. We do this currently for +if the default Spack package needs to be overridden. We do this currently for Caliper, as we need a newer version than in the Spack commit currently used. Updating Spack 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/ark_brusselator1D.h b/examples/arkode/CXX_parallel/ark_brusselator1D.h index b95390bc4a..8f4b873e9e 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D.h +++ b/examples/arkode/CXX_parallel/ark_brusselator1D.h @@ -148,7 +148,7 @@ struct UserData N_Vector vmask; N_Vector wmask; - /* problem paramaters */ + /* problem parameters */ int nvar; /* number of species */ long int nx; /* number of intervals globally */ int nxl; /* number of intervals locally */ @@ -197,7 +197,7 @@ typedef struct SUNNonlinearSolver local_nls; }* TaskLocalNewton_Content; -/* Content accessor macors */ +/* Content accessor macros */ #define GET_NLS_CONTENT(NLS) ((TaskLocalNewton_Content)(NLS->content)) #define LOCAL_NLS(NLS) (GET_NLS_CONTENT(NLS)->local_nls) diff --git a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp index 8bee143d0b..b5029ca9a5 100644 --- a/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp +++ b/examples/arkode/CXX_parallel/ark_brusselator1D_task_local_nls.cpp @@ -22,7 +22,7 @@ * w_t = -c * w_x + (B - w) / ep - w * u * * for t in [0, 10], x in [0, xmax] with periodic boundary conditions. The - * initial condition is a Gaussian pertubation of the steady state + * initial condition is a Gaussian perturbation of the steady state * solution without advection * * u(0,x) = k1 * A / k4 + p(x) @@ -1730,7 +1730,7 @@ void InputError(char* name) * opt == 0 means the function allocates memory and returns a * pointer so check if a NULL pointer was returned * opt == 1 means the function returns an integer where a - * value < 0 indicates an error occured + * value < 0 indicates an error occurred * --------------------------------------------------------------*/ int check_retval(void* returnvalue, const char* funcname, int opt) { diff --git a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp index 63108a9bd2..5643211620 100644 --- a/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp +++ b/examples/arkode/CXX_parallel/ark_diffusion_reaction_p.cpp @@ -16,7 +16,7 @@ * u_t = Dux u_xx + Duy u_yy + A + u * u * v - (B + 1) * u * v_t = Dvx u_xx + Dvy u_yy + B * u - u * u * v * - * where u and v represent the concentrations of the two chemcial species, the + * where u and v represent the concentrations of the two chemical species, the * diffusion rates are Dux = Duy = Dvx = Dvy = 1e-3, and the species with * constant concentration over time are A = 1 and B = 3. * @@ -159,7 +159,7 @@ struct UserData bool reaction = true; // -------------------------- - // Discretization parameteres + // Discretization parameters // -------------------------- // Global and local number of nodes in the x and y directions @@ -228,7 +228,7 @@ struct UserData sunrealtype* SWsend = NULL; sunrealtype* NErecv = NULL; - // Recieve and send requests + // Receive and send requests MPI_Request reqRW, reqRE, reqRS, reqRN; MPI_Request reqSW, reqSE, reqSS, reqSN; MPI_Request reqRC, reqSC; @@ -307,7 +307,7 @@ struct UserData N_Vector diag = NULL; // inverse of Jacobian diagonal // --------------- - // Ouput variables + // Output variables // --------------- int output = 1; // 0 = no output, 1 = output stats, 2 = write to disk @@ -597,7 +597,7 @@ int main(int argc, char* argv[]) sunrealtype dTout = udata.tf / udata.nout; sunrealtype tout = dTout; - // Inital output + // Initial output flag = OpenOutput(&udata); if (check_flag(&flag, "OpenOutput", 1)) { return 1; } @@ -2349,14 +2349,14 @@ static void InputHelp() << " --mri-cvode-local : use MRI with CVODE task-local stepper" << endl; cout << " --rtol_imex : IMEX relative tolerance" << endl; - cout << " --atol_imex : IMEX absoltue tolerance" << endl; + cout << " --atol_imex : IMEX absolute tolerance" << endl; cout << " --h_imex : IMEX fixed step size" << endl; cout << " --order_imex : IMEX method order" << endl; cout << " --rtol_slow : MRI slow relative tolerance" << endl; - cout << " --atol_slow : MRI slow absoltue tolerance" << endl; + cout << " --atol_slow : MRI slow absolute tolerance" << endl; cout << " --h_slow : MRI slow step size" << endl; cout << " --rtol_fast : MRI fast relative tolerance" << endl; - cout << " --atol_fast : MRI fast absoltue tolerance" << endl; + cout << " --atol_fast : MRI fast absolute tolerance" << endl; cout << " --h_fast : MRI fast step size" << endl; cout << " --controller : time step adaptivity" << endl; cout << " --nonlinear : nonlinearly implicit" << endl; @@ -2839,7 +2839,7 @@ static int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper stepper, return 0; } -// Ouput timing stats +// Output timing stats static int OutputTiming(UserData* udata) { if (udata->outproc) diff --git a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp index 566a7a4b41..0bf8d97ba7 100644 --- a/examples/arkode/CXX_parallel/ark_heat2D_p.cpp +++ b/examples/arkode/CXX_parallel/ark_heat2D_p.cpp @@ -153,7 +153,7 @@ struct UserData sunrealtype* Ssend; sunrealtype* Nsend; - // Send requests for neighor exchange + // Send requests for neighbor exchange MPI_Request reqSW; MPI_Request reqSE; MPI_Request reqSS; @@ -180,7 +180,7 @@ struct UserData // Inverse of Jacobian diagonal for preconditioner N_Vector d; - // Ouput variables + // Output variables int output; // output level int nout; // number of output times ofstream uout; // output file stream @@ -486,7 +486,7 @@ int main(int argc, char* argv[]) sunrealtype dTout = udata->tf / udata->nout; sunrealtype tout = dTout; - // Inital output + // Initial output flag = OpenOutput(udata); if (check_flag(&flag, "OpenOutput", 1)) { return 1; } @@ -1576,7 +1576,7 @@ static void InputHelp() cout << " --noforcing : disable forcing term" << endl; cout << " --tf