diff --git a/.cmake-format.py b/.cmake-format.py index c6d5938ef6..e54ca58d3a 100644 --- a/.cmake-format.py +++ b/.cmake-format.py @@ -59,6 +59,7 @@ 'EXTRA_ARGS': '+', 'FLOAT_PRECISION': 1, 'INTEGER_PRECISION': 1, + 'LABELS': '+', 'MPI_NPROCS': 1, 'TEST_ARGS': '+'}, 'pargs': {'flags': ['NODIFF'], 'nargs': '2+'}}, diff --git a/.github/PULL_REQUEST_TEMPLATE/release.md b/.github/PULL_REQUEST_TEMPLATE/release.md index dd127ed8d2..ca168ed6e2 100644 --- a/.github/PULL_REQUEST_TEMPLATE/release.md +++ b/.github/PULL_REQUEST_TEMPLATE/release.md @@ -27,7 +27,7 @@ This is a list of tasks that need to be done before a SUNDIALS release. * `doc/shared/History.rst` * `doc/shared/sundials.bib` * `doc/sundials/biblio.bib` - * `scripts/tarscript` + * `scripts/tarscript.sh` The following files are no longer maintaianed: diff --git a/.github/actions/apply-style/checkout.sh b/.github/actions/apply-style/checkout.sh new file mode 100755 index 0000000000..34a6f15b43 --- /dev/null +++ b/.github/actions/apply-style/checkout.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +### +# Attempt to find the branch of the PR from the detached head state +## + +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "Attempting to find branch that matches commit..." + +# Get the current commit SHA +current_commit_sha=$(git rev-parse HEAD) +# List all branches containing the current commit SHA +branches=$(git branch -r --contains $current_commit_sha) + +echo "all branches:" +echo "$(git branch -a)" +echo "branches with SHA $current_commit_sha:" +echo "$branches" + +# Loop over the string split by whitespace +branch="" +num_branches_found=0 +for _possible_branch in $branches; do + # Skip items that start with "pull/" + if [[ $_possible_branch == pull/* ]]; then + continue + fi + if [[ $_possible_branch == origin/* ]]; then + _possible_branch=$(echo "$_possible_branch" | sed 's/origin\///') + fi + echo "Possible Branch: $_possible_branch" + branch=$_possible_branch + num_branches_found=$((num_branches_found+1)) +done + +if [ "$num_branches_found" -ne 1 ]; then + echo "Error: Unable to find a single branch that matched git sha $current_commit_sha" + exit 1 +fi + +echo "Found branch: $branch" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +git checkout $branch +git submodule update --init --recursive diff --git a/.github/actions/test-driver/action.yml b/.github/actions/test-driver/action.yml index f56126095e..47c0fab83f 100644 --- a/.github/actions/test-driver/action.yml +++ b/.github/actions/test-driver/action.yml @@ -8,6 +8,9 @@ inputs: indexsize: description: SUNDIALS_INDEX_SIZE required: true + tpls: + description: "enable/disable TPLs" + required: true runs: using: composite @@ -26,5 +29,10 @@ runs: run: | git config --global --add safe.directory $GITHUB_WORKSPACE cd test - ./test_driver.sh --testtype CUSTOM --env env/docker.sh --tpls --sunrealtype ${{ inputs.precision }} --indexsize ${{ inputs.indexsize }} + ./test_driver.sh \ + --testtype CUSTOM \ + --env env/docker.sh \ + --tpls ${{ inputs.tpls }} \ + --sunrealtype ${{ inputs.precision }} \ + --indexsize ${{ inputs.indexsize }} shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml index df4d15b35c..3bc7efbf9d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,4 @@ updates: schedule: # Check for updates to GitHub Actions every week interval: "weekly" + target-branch: "develop" diff --git a/.github/workflows/build-ci-containers-e4s.yml b/.github/workflows/build-ci-containers-e4s.yml index ad6cb16a2f..d3254f9ea9 100644 --- a/.github/workflows/build-ci-containers-e4s.yml +++ b/.github/workflows/build-ci-containers-e4s.yml @@ -26,7 +26,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker images - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.15.0 with: context: "./docker/sundials-ci/e4s-base" build-args: e4s_version=22.05 @@ -56,7 +56,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker images - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.15.0 with: context: "./docker/sundials-ci/e4s-quarterly" build-args: spack_yaml=./int${{ matrix.indexsize }}-${{ matrix.precision }}/spack.yaml diff --git a/.github/workflows/build-ci-containers-nightly.yml b/.github/workflows/build-ci-containers-nightly.yml index 5045a62a3b..6ef4fdbce7 100644 --- a/.github/workflows/build-ci-containers-nightly.yml +++ b/.github/workflows/build-ci-containers-nightly.yml @@ -32,7 +32,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker images - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.15.0 with: context: "./docker/sundials-ci/spack-nightly" build-args: spack_yaml=./int${{ matrix.indexsize }}-${{ matrix.precision }}/spack.yaml diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index b3d0850ca9..87493c1a06 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -3,9 +3,16 @@ name: Checks - formatting on: pull_request: workflow_dispatch: + issue_comment: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true jobs: format_check: + if: ${{ github.event_name != 'issue_comment' || (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} runs-on: ubuntu-latest container: image: ghcr.io/llnl/sundials_spack_cache:llvm-17.0.4-h4lflucc3v2vage45opbo2didtcuigsn.spack @@ -37,10 +44,18 @@ jobs: run: clang-format --version - name: Check out repository code + if: github.event_name != 'issue_comment' uses: actions/checkout@v4 with: submodules: true + - name: Check out repository code + if: github.event_name == 'issue_comment' + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + - name: Add safe directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" @@ -49,16 +64,59 @@ jobs: ./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 + run: /usr/bin/git diff --exit-code - name: Run git diff if we failed if: failure() run: /usr/bin/git diff > format.patch - name: Archive diff as a patch if we failed - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: format.patch path: | ${{ github.workspace }}/format.patch + + apply_format: + if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} + needs: format_check + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # Checkout the GitHub created reference for the PR. + # The only way to do this is by using the "issue" number + # but that is really the PR number in this context. + # This is due to using an `issue_comment` event which + # is due to the GitHub Actions API that does not have + # a `pull_request_comment` event or something similar. + # This leaves us in a detached head state which is corrected + # in `apply-style/checkout.sh` + - name: Checkout repository code + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + + - name: Checkout the right git ref + run: ./.github/actions/apply-style/checkout.sh + + - name: Download the git diff from format_check + uses: actions/download-artifact@v4 + with: + name: format.patch + + - name: Apply patch + run: | + git apply format.patch + rm format.patch + + - name: Commit fixes + run: | + git config user.name "format-robot" + git config user.email "no-reply@llnl.gov" + if [ -n "$(git status --porcelain)" ]; then + git commit -am 'apply format updates' + git push + fi diff --git a/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml index 8825e58b06..067e82449f 100644 --- a/.github/workflows/check-spelling.yml +++ b/.github/workflows/check-spelling.yml @@ -3,9 +3,16 @@ name: Checks - spelling on: pull_request: workflow_dispatch: + issue_comment: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true jobs: spelling_check: + if: ${{ github.event_name != 'issue_comment' || (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} runs-on: ubuntu-latest steps: - name: Install python3-pip @@ -20,25 +27,76 @@ jobs: run: codespell --version - name: Check out repository code + if: github.event_name != 'issue_comment' uses: actions/checkout@v4 with: submodules: true + - name: Check out repository code + if: github.event_name == 'issue_comment' + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + - 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 + run: /usr/bin/git diff --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 + uses: actions/upload-artifact@v4 if: failure() with: name: spelling.patch path: | ${{ github.workspace }}/spelling.patch + + apply_spelling: + if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} + needs: spelling_check + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # Checkout the GitHub created reference for the PR. + # The only way to do this is by using the "issue" number + # but that is really the PR number in this context. + # This is due to using an `issue_comment` event which + # is due to the GitHub Actions API that does not have + # a `pull_request_comment` event or something similar. + # This leaves us in a detached head state which is corrected + # in `apply-style/checkout.sh` + - name: Checkout repository code + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + + - name: Checkout the right git ref + run: ./.github/actions/apply-style/checkout.sh + + - name: Download the git diff from spelling_check + uses: actions/download-artifact@v4 + with: + name: spelling.patch + + - name: Apply patch + run: | + git apply spelling.patch + rm spelling.patch + + - name: Commit fixes + run: | + git config user.name "format-robot" + git config user.email "no-reply@llnl.gov" + if [ -n "$(git status --porcelain)" ]; then + git commit -am 'apply spelling updates' + git push + fi diff --git a/.github/workflows/check-swig.yml b/.github/workflows/check-swig.yml index 2a4193a239..e61991982f 100644 --- a/.github/workflows/check-swig.yml +++ b/.github/workflows/check-swig.yml @@ -3,27 +3,45 @@ name: Checks - swig on: pull_request: workflow_dispatch: + issue_comment: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true jobs: - swig: + swig_check: + if: ${{ github.event_name != 'issue_comment' || (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} runs-on: ubuntu-latest - steps: + - name: Install pcre + run: | + sudo apt install libpcre3-dev + - name: Install swig run: | git clone https://github.com/sundials-codes/swig cd swig ./autogen.sh ./configure --prefix=/usr/ - make + make sudo make install swig -version - name: Check out repository code + if: github.event_name != 'issue_comment' uses: actions/checkout@v4 with: submodules: true + - name: Check out repository code + if: github.event_name == 'issue_comment' + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + - name: Add safe directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" @@ -34,16 +52,59 @@ jobs: make all64 - name: Run git diff to see if anything changed - run: /usr/bin/git diff --name-only --exit-code + run: /usr/bin/git diff --exit-code - name: Run git diff if we failed if: failure() run: /usr/bin/git diff > swig.patch - name: Archive diff as a patch if we failed - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: swig.patch path: | ${{ github.workspace }}/swig.patch + + apply_swig: + if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/autofix')) }} + needs: swig_check + runs-on: ubuntu-latest + permissions: + contents: write + steps: + # Checkout the GitHub created reference for the PR. + # The only way to do this is by using the "issue" number + # but that is really the PR number in this context. + # This is due to using an `issue_comment` event which + # is due to the GitHub Actions API that does not have + # a `pull_request_comment` event or something similar. + # This leaves us in a detached head state which is corrected + # in `apply-style/checkout.sh` + - name: Checkout repository code + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + fetch-depth: 0 + + - name: Checkout the right git ref + run: ./.github/actions/apply-style/checkout.sh + + - name: Download the git diff from swig_check + uses: actions/download-artifact@v4 + with: + name: swig.patch + + - name: Apply patch + run: | + git apply swig.patch + rm swig.patch + + - name: Commit fixes + run: | + git config user.name "format-robot" + git config user.email "no-reply@llnl.gov" + if [ -n "$(git status --porcelain)" ]; then + git commit -am 'apply swig updates' + git push + fi diff --git a/.github/workflows/docs-pdfs.yml b/.github/workflows/docs-pdfs.yml new file mode 100644 index 0000000000..b2745ebb22 --- /dev/null +++ b/.github/workflows/docs-pdfs.yml @@ -0,0 +1,211 @@ +name: Docs - PDFs + +on: + push: + branches: + - main + - develop + pull_request: + merge_group: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + docs_install_guide_pdf: + runs-on: ubuntu-latest + + steps: + - name: Install latex + run: | + sudo apt update + sudo apt install -y --no-install-recommends \ + fonts-texgyre \ + latexmk \ + tex-gyre \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-plain-generic + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install sphinx + run: | + pip install -r doc/requirements.txt + + - name: Build docs + run: cd doc/install_guide && make latexpdf + + - name: Archive files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: latex_build_files + path: | + ${{github.workspace}}/doc/install_guide/build/latex + + - name: Archive PDF from successful build + uses: actions/upload-artifact@v4 + if: success() + with: + name: install_guide + path: | + ${{github.workspace}}/doc/install_guide/build/latex/INSTALL_GUIDE.pdf + + docs_package_pdf: + runs-on: ubuntu-latest + + strategy: + max-parallel: 2 + matrix: + package: [arkode, cvode, cvodes, ida, idas, kinsol] + # TODO(DJG): when all user guides and example docs use sphinx remove + # the example documentation jobs below and use the alternative lines + # commented out in this job + # type: [guide, examples] + + steps: + - name: Install latex + run: | + sudo apt update + sudo apt install -y --no-install-recommends \ + fonts-texgyre \ + latexmk \ + tex-gyre \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-plain-generic + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install sphinx + run: | + pip install -r doc/requirements.txt + + - name: Build docs + run: cd doc/${{matrix.package}}/guide && make latexpdf + # run: cd doc/${{matrix.package}}/${{matrix.type}} && make latexpdf + + - name: Archive files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: latex_build_files + path: | + ${{github.workspace}}/doc/${{matrix.package}}/guide/build/latex + # path: | + # ${{github.workspace}}/doc/${{matrix.package}}/${{matrix.type}}/build/latex + + - name: Archive PDFs from successful build + uses: actions/upload-artifact@v4 + if: success() + with: + name: ${{matrix.package}}_user_guide + path: | + ${{github.workspace}}/doc/${{matrix.package}}/guide/build/latex/*_guide.pdf + # name: ${{matrix.package}}_${{matrix.type}} + # path: | + # ${{github.workspace}}/doc/${{matrix.package}}/${{matrix.type}}/build/latex/*_${{matrix.type}}.pdf + + # Sphinx examples documentation PDFs + docs_examples_sphinx_pdf: + runs-on: ubuntu-latest + + strategy: + max-parallel: 2 + matrix: + package: [arkode] + + steps: + - name: Install latex + run: | + sudo apt update + sudo apt install -y --no-install-recommends \ + fonts-texgyre \ + latexmk \ + tex-gyre \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-plain-generic + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install sphinx + run: | + pip install -r doc/requirements.txt + + - name: Build docs + run: cd doc/${{matrix.package}}/examples && make latexpdf + + - name: Archive files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: latex_build_files + path: | + ${{github.workspace}}/doc/${{matrix.package}}/examples/build/latex + + - name: Archive PDFs from successful build + uses: actions/upload-artifact@v4 + if: success() + with: + name: ${{matrix.package}}_examples_docs + path: | + ${{github.workspace}}/doc/${{matrix.package}}/examples/build/latex/*_examples.pdf + + # Latex examples documentation PDFs + docs_examples_latex_pdf: + runs-on: ubuntu-latest + + strategy: + max-parallel: 2 + matrix: + package: [cvode, cvodes, ida, idas, kinsol] + + steps: + - name: Install latex + run: | + sudo apt update + sudo apt install -y --no-install-recommends \ + fonts-texgyre \ + latexmk \ + tex-gyre \ + texlive-latex-extra \ + texlive-fonts-recommended \ + texlive-plain-generic + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build docs + run: cd doc/${{matrix.package}} && make ex + + - name: Archive files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: latex_build_files + path: | + ${{github.workspace}}/doc/${{matrix.package}} + !${{github.workspace}}/doc/${{matrix.package}}/guide + + - name: Archive PDFs from successful build + uses: actions/upload-artifact@v4 + if: success() + with: + name: ${{matrix.package}}_examples_docs + path: | + ${{github.workspace}}/doc/${{matrix.package}}/*_examples.pdf diff --git a/.github/workflows/spack-develop.yml b/.github/workflows/spack-develop.yml index 41f312164f..adf15d2de3 100644 --- a/.github/workflows/spack-develop.yml +++ b/.github/workflows/spack-develop.yml @@ -33,7 +33,7 @@ jobs: indexsize: ${{ matrix.indexsize }} precision: ${{ matrix.precision }} - name: Archive build files from failed build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: build_files @@ -41,7 +41,7 @@ jobs: ${{ github.workspace }}/test/build_* !${{ github.workspace }}/test/build_*/Testing/output - name: Archive output files from failed build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: output_files diff --git a/.github/workflows/test-address-sanitizer.yml b/.github/workflows/test-address-sanitizer.yml new file mode 100644 index 0000000000..bc4b96c9d1 --- /dev/null +++ b/.github/workflows/test-address-sanitizer.yml @@ -0,0 +1,60 @@ +# +name: Build and Test - Ubuntu/gcc (Address Sanitizer) + +on: + push: + branches: + - main + - develop + pull_request: + merge_group: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + sanitizer_build_and_test: + runs-on: ubuntu-latest + container: + image: ghcr.io/llnl/sundials-ci-int${{ matrix.indexsize }}-${{ matrix.precision }}:latest + options: --user root + strategy: + fail-fast: false + max-parallel: 2 + matrix: + indexsize: [32, 64] + precision: ['double'] + buildtype: ['Debug'] + # Address sanitizer is enabled in test_driver.sh with TPLs OFF + tpls: ['OFF'] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Run test_driver.sh + uses: ./.github/actions/test-driver + with: + indexsize: ${{ matrix.indexsize }} + precision: ${{ matrix.precision }} + tpls: ${{ matrix.tpls }} + env: + CMAKE_BUILD_TYPE: ${{ matrix.buildtype }} + - name: Archive build files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: build_files_${{ matrix.indexsize }}_${{ matrix.precision }}_${{ matrix.buildtype }}_${{ matrix.tpls }} + path: | + ${{ github.workspace }}/test/build_* + !${{ github.workspace }}/test/build_*/Testing/output + - name: Archive output files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: output_files_${{ matrix.indexsize }}_${{ matrix.precision }}_${{ matrix.buildtype }}_${{ matrix.tpls }} + path: | + ${{ github.workspace }}/test/build_*/Testing/ diff --git a/.github/workflows/ubuntu-clang-latest.yml b/.github/workflows/ubuntu-clang-latest.yml index 2010b54dbf..3e36f682a2 100644 --- a/.github/workflows/ubuntu-clang-latest.yml +++ b/.github/workflows/ubuntu-clang-latest.yml @@ -26,11 +26,6 @@ jobs: logging_level: [0, 1, 2, 3, 4, 5] steps: - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: "14.0" - - uses: actions/checkout@v4 - name: Configure CMake @@ -43,12 +38,42 @@ jobs: -D CMAKE_CXX_COMPILER=$(which clang++) \ -D SUNDIALS_LOGGING_LEVEL=${{matrix.logging_level}} \ -D ENABLE_ALL_WARNINGS=ON \ - -D ENABLE_WARNINGS_AS_ERRORS=ON + -D ENABLE_WARNINGS_AS_ERRORS=ON \ + -D SUNDIALS_TEST_ENABLE_DEV_TESTS=ON \ + -D SUNDIALS_TEST_ENABLE_UNIT_TESTS=ON \ + -D SUNDIALS_TEST_ENABLE_GTEST=OFF \ + -D SUNDIALS_TEST_FLOAT_PRECISION=4 \ + -D SUNDIALS_TEST_INTEGER_PRECISION=10 - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + - name: Test + # Run logging tests + run: | + ctest \ + --test-dir ${{github.workspace}}/build \ + --label-regex logging \ + --verbose + + - name: Archive build files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: build_files_logging_level_${{ matrix.logging_level }} + path: | + ${{ github.workspace }}/build + !${{ github.workspace }}/build/Testing/output + + - name: Archive output files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: output_files_logging_level_${{ matrix.logging_level }} + path: | + ${{ github.workspace }}/build/Testing/ + build_cycle_profiling: runs-on: ubuntu-latest @@ -57,11 +82,6 @@ jobs: profiling: ['OFF', 'ON'] steps: - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: "14.0" - - uses: actions/checkout@v4 - name: Configure CMake @@ -79,3 +99,20 @@ jobs: - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Archive build files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: build_files_profiling_${{ matrix.profiling }} + path: | + ${{ github.workspace }}/build + !${{ github.workspace }}/build/Testing/output + + - name: Archive output files from failed build + uses: actions/upload-artifact@v4 + if: failure() + with: + name: output_files_profiling_${{ matrix.profiling }} + path: | + ${{ github.workspace }}/build/Testing/ diff --git a/.github/workflows/ubuntu-latest-oneapi.yml b/.github/workflows/ubuntu-latest-oneapi.yml new file mode 100644 index 0000000000..bebd04efad --- /dev/null +++ b/.github/workflows/ubuntu-latest-oneapi.yml @@ -0,0 +1,45 @@ +name: Build - Ubuntu/dpcpp + +on: + pull_request: + merge_group: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + strategy: + matrix: + ONEAPI_VERSION: [ + '2024.2.1-0-devel-ubuntu22.04', + 'latest' # 2025.0.0-0-devel-ubuntu24.04 at the time of commit + ] + + runs-on: ubuntu-latest + container: intel/oneapi-basekit:${{ matrix.ONEAPI_VERSION }} + + steps: + - uses: actions/checkout@v4 + + - name: Configure CMake + run: | + cmake \ + -B ${{github.workspace}}/build \ + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -D CMAKE_C_COMPILER=$(which icx) \ + -D CMAKE_CXX_COMPILER=$(which icpx) \ + -D CMAKE_CXX_FLAGS="-fsycl" \ + -D SUNDIALS_BUILD_WITH_PROFILING=ON \ + -D ENABLE_ALL_WARNINGS=ON \ + -D ENABLE_WARNINGS_AS_ERRORS=ON \ + -D ENABLE_SYCL=ON + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/ubuntu-latest.yml b/.github/workflows/ubuntu-latest.yml index 0bc9ab7510..56892881ec 100644 --- a/.github/workflows/ubuntu-latest.yml +++ b/.github/workflows/ubuntu-latest.yml @@ -21,12 +21,14 @@ jobs: image: ghcr.io/llnl/sundials-ci-int${{ matrix.indexsize }}-${{ matrix.precision }}:latest options: --user root strategy: + fail-fast: false max-parallel: 2 matrix: indexsize: [32, 64] # Disable extended tests until compiler warnings are addressed precision: ['single', 'double'] buildtype: ['Debug', 'Release', 'RelWithDebInfo'] + tpls: ['ON'] exclude: - buildtype: Debug precision: single @@ -49,20 +51,21 @@ jobs: with: indexsize: ${{ matrix.indexsize }} precision: ${{ matrix.precision }} + tpls: ${{ matrix.tpls }} env: CMAKE_BUILD_TYPE: ${{ matrix.buildtype }} - name: Archive build files from failed build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: - name: build_files + name: build_files_${{ matrix.indexsize }}_${{ matrix.precision }}_${{ matrix.buildtype }}_${{ matrix.tpls }} path: | ${{ github.workspace }}/test/build_* !${{ github.workspace }}/test/build_*/Testing/output - name: Archive output files from failed build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: - name: output_files + name: output_files_${{ matrix.indexsize }}_${{ matrix.precision }}_${{ matrix.buildtype }}_${{ matrix.tpls }} path: | ${{ github.workspace }}/test/build_*/Testing/ diff --git a/.github/workflows/windows-latest-intel.yml b/.github/workflows/windows-latest-intel.yml index 6ea4e35c34..3e30312ccc 100644 --- a/.github/workflows/windows-latest-intel.yml +++ b/.github/workflows/windows-latest-intel.yml @@ -22,7 +22,7 @@ jobs: id: setup-fortran with: compiler: intel - version: '2023.2' + version: '2025.0' - name: Install Ninja run: choco install ninja @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - name: Configure CMake (Static) - run: cmake -G "Ninja" -B ${{github.workspace}}/build_static -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-Wno-deprecated-declarations -DCMAKE_C_COMPILER=icx-cl -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_Fortran_COMPILER=ifx -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_UNITTESTS=OFF -DEXAMPLES_ENABLE_CXX=ON + run: cmake -G "Ninja" -B ${{github.workspace}}/build_static -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-Wno-deprecated-declarations -DCMAKE_C_COMPILER=icx-cl -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_Fortran_COMPILER=ifx -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_ENABLE_UNIT_TESTS=OFF -DEXAMPLES_ENABLE_CXX=ON - name: Build (Static) run: cmake --build ${{github.workspace}}/build_static --verbose @@ -40,7 +40,7 @@ jobs: run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure - name: Configure CMake (Shared) - run: cmake -G "Ninja" -B ${{github.workspace}}/build_shared -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-Wno-deprecated-declarations -DCMAKE_C_COMPILER=icx-cl -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_Fortran_COMPILER=ifx -DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_UNITTESTS=OFF -DEXAMPLES_ENABLE_CXX=ON + run: cmake -G "Ninja" -B ${{github.workspace}}/build_shared -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-Wno-deprecated-declarations -DCMAKE_C_COMPILER=icx-cl -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_Fortran_COMPILER=ifx -DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_ENABLE_UNIT_TESTS=OFF -DEXAMPLES_ENABLE_CXX=ON - name: Build (Shared) run: cmake --build ${{github.workspace}}/build_shared --verbose diff --git a/.github/workflows/windows-latest-mingw.yml b/.github/workflows/windows-latest-mingw.yml index c4a93a5d46..bb103d049f 100644 --- a/.github/workflows/windows-latest-mingw.yml +++ b/.github/workflows/windows-latest-mingw.yml @@ -58,7 +58,7 @@ jobs: -DBUILD_SHARED_LIBS=OFF \ -DSUNDIALS_BUILD_WITH_PROFILING=ON \ -DSUNDIALS_LOGGING_LEVEL=2 \ - -DSUNDIALS_TEST_UNITTESTS=OFF \ + -DSUNDIALS_TEST_ENABLE_UNIT_TESTS=OFF \ -DEXAMPLES_ENABLE_CXX=ON \ -DENABLE_KLU=ON @@ -85,7 +85,7 @@ jobs: -DBUILD_STATIC_LIBS=OFF \ -DSUNDIALS_BUILD_WITH_PROFILING=ON \ -DSUNDIALS_LOGGING_LEVEL=2 \ - -DSUNDIALS_TEST_UNITTESTS=OFF \ + -DSUNDIALS_TEST_ENABLE_UNIT_TESTS=OFF \ -DEXAMPLES_ENABLE_CXX=ON \ -DENABLE_KLU=ON diff --git a/.github/workflows/windows-latest.yml b/.github/workflows/windows-latest.yml index c94026c3b8..ea1c4bbcfc 100644 --- a/.github/workflows/windows-latest.yml +++ b/.github/workflows/windows-latest.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - name: Configure CMake - run: cmake -G "Visual Studio 17 2022" -B ${{github.workspace}}/build -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_UNITTESTS=ON -DEXAMPLES_ENABLE_CXX=ON + run: cmake -G "Visual Studio 17 2022" -B ${{github.workspace}}/build -DSUNDIALS_BUILD_WITH_PROFILING=ON -DSUNDIALS_TEST_ENABLE_UNIT_TESTS=ON -DEXAMPLES_ENABLE_CXX=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --verbose diff --git a/.gitignore b/.gitignore index 3e9185713d..fcaaffcbd6 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,8 @@ compile_commands.json *.orig *.nvvp *.ptp-sync* +*.project +*.cproject *~ \#* @@ -75,3 +77,6 @@ uberenv_libs # swig /swig/swig + +# tools +/tools/suntools/__pycache__ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c02b239373..716377a2e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,23 @@ -# --------------------------------------------------------------- +############################################################################### +# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS +# project contributors. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# SPDX-License-Identifier: (MIT) +############################################################################### +# Modifications to this file have been made under the folllowing copyright. +# ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -8,129 +25,97 @@ # # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End -# --------------------------------------------------------------- +# ----------------------------------------------------------------------------- +# DESCRIPTION: ############################################################################### # General GitLab pipelines configurations for supercomputers and Linux clusters # at Lawrence Livermore National Laboratory (LLNL). -############################################################################### - -# We define the following GitLab pipeline variables (all of which can be -# set from the GitLab CI "run pipeline" UI): -# -# GIT_SUBMODULE_STRATEGY: -# Tells Gitlab to recursively update the submodules when cloning. -# -# ALLOC_NAME: -# Allocation unique name. -# -# BUILD_ROOT: -# The path to the shared resources between all jobs. The BUILD_ROOT is unique to -# the pipeline, preventing any form of concurrency with other pipelines. This -# also means that the BUILD_ROOT directory will never be cleaned. -# -# DEFAULT_TIME: -# Default time to let the jobs run will be 30 minutes. -# -# BUILD_JOBS: -# Number of threads to use for builds. -# -# NCPU: -# Number of CPUs to alloc. +# This entire pipeline is LLNL-specific # -# VERBOSE_BUILD: -# Sets CMAKE_VERBOSE_MAKEFILE to TRUE when "ON". +# Important note: This file is a template provided by llnl/radiuss-shared-ci. +# Remains to set variable values, change the reference to the radiuss-shared-ci +# repo, opt-in and out optional features. The project can then extend it with +# additional stages. # -# VERBOSE_TEST: -# Passes --verbose to CTest when "ON". +# In addition, each project should copy over and complete: +# - .gitlab/custom-jobs-and-variables.yml +# - .gitlab/subscribed-pipelines.yml # -# ON_LASSEN: -# Should the Lassen pipeline run? Set to "ON" or "OFF" to enable/disable. -# -# ON_QUARTZ: -# Should the Quartz pipeline run? Set to "ON" or "OFF" to enable/disable. -# -# SPACK_PREFIX: prefix used for shared spack installation. -# Usually this a spack version number that matches the version set in the uberenv_config.json file. -# Spack installs go in /usr/workspace/sundials/spack_installs/${SPACK_PREFIX}/$(hostname). -# -# SHARED_SPACK: -# If "ON", then a shared spack install that has been pre-configured is utilized. -# If "OFF", then a new spack instance is created for every build (meaning all TPLs have to be installed). -# If "UPSTREAM" (the default), then the shared spack is used as an upstream for a build specific spack. -# -# BENCHMARK: -# If "ON", then the SUNDIALS benchmark problems are run and generate profiles. -# -# BENCHMARK_NNODES: -# Number of nodes to use for benchmarks. Default is 4. -# -# BENCHMARK_QUEUE: -# What queue to submit the benchmarks too. Default is pbatch (for Livermore). +# The jobs should be specified in a file local to the project, +# - .gitlab/jobs/${CI_MACHINE}.yml +# or generated (see LLNL/Umpire for an example). +############################################################################### +# We define the following GitLab pipeline variables: variables: +##### LC GITLAB CONFIGURATION +# Use an LLNL service user to run CI. This prevents from running pipelines as +# an actual user. + LLNL_SERVICE_USER: "" +# Use the service user workspace. Solves permission issues, stores everything +# at the same location whoever triggers a pipeline. + CUSTOM_CI_BUILDS_DIR: "/usr/workspace/sundials/ci/.builds/" +# Tells Gitlab to recursively update the submodules when cloning the project. GIT_SUBMODULE_STRATEGY: recursive - ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID} - BUILD_ROOT: ${CI_PROJECT_DIR} - DEFAULT_TIME: 30 - BUILD_JOBS: 32 - NCPUS: 12 - VERBOSE_BUILD: "OFF" - VERBOSE_TEST: "OFF" - ON_LASSEN: "ON" - ON_QUARTZ: "ON" - ON_CORONA: "ON" - SPACK_PREFIX: "v0.19.1" - SHARED_SPACK: "UPSTREAM" - BENCHMARK: "OFF" - BENCHMARK_NNODES: 4 - BENCHMARK_QUEUE: "pbatch" - -# Normally, stages are blocking in Gitlab. However, using the keyword "needs" we -# can express dependencies between job that break the ordering of stages, in -# favor of a DAG. -# In practice q_*, l_* and c_* stages are independently run and start immediately. -stages: - - q_build_and_test - - l_build_and_test - - l_build_and_bench - - c_build_and_test +##### PROJECT VARIABLES +# We build the projects in the CI clone directory. +# Used in script/gitlab/build_and_test.sh script. +# TODO: add a clean-up mechanism. + BUILD_ROOT: ${CI_PROJECT_DIR} + SPACK_REF: "594a376c521cc746978571b1181a47bbcff30a21" # v0.22.2 -# These are also templates (.name) that define project specific build commands. -# If an allocation exist with the name defined in this pipeline, the job will -# use it (slurm specific). -.build_toss_3_x86_64_ib_script: - script: - - echo ${ALLOC_NAME} - - srun -p pdebug -N 1 -n ${NCPUS} --interactive -t ${DEFAULT_TIME} - --job-name=${ALLOC_NAME} .gitlab/build_and_test.sh +##### SHARED_CI CONFIGURATION +# Required information about GitHub repository + GITHUB_PROJECT_NAME: "sundials" + GITHUB_PROJECT_ORG: "LLNL" +# Set the build-and-test command. +# Nested variables are allowed and useful to customize the job command. We +# prevent variable expansion so that you can define them at job level. + JOB_CMD: + value: ".gitlab/build_and_test.sh" + expand: false +# Override the pattern describing branches that will skip the "draft PR filter +# test". Add protected branches here. See default value in +# preliminary-ignore-draft-pr.yml. +# ALWAYS_RUN_PATTERN: "" -# Corona -.build_toss_4_x86_64_ib_corona_script: - script: - - echo ${ALLOC_NAME} - - flux alloc -N 1 -t ${DEFAULT_TIME} .gitlab/build_and_test.sh +# We organize the build-and-test stage with sub-pipelines. Each sub-pipeline +# corresponds to a test batch on a given machine. -# CORAL systems use spectrum LSF instead of SLURM -.build_blueos_3_ppc64le_ib_script: - script: - - echo ${ALLOC_NAME} - - bsub -q pdebug -J ${ALLOC_NAME} -nnodes 1 -W ${DEFAULT_TIME} -Is .gitlab/build_and_test.sh +# High level stages +stages: + - prerequisites + - build-and-test -# Benchmark job for CORAL systems -.build_blueos_3_ppc64le_ib_bench: - script: - - echo ${ALLOC_NAME} - - bsub -q ${BENCHMARK_QUEUE} -J ${ALLOC_NAME} -nnodes ${BENCHMARK_NNODES} -W ${DEFAULT_TIME} -Is .gitlab/build_and_bench.sh +# Template for jobs triggering a build-and-test sub-pipeline: +.build-and-test: + stage: build-and-test + trigger: + include: + - local: '.gitlab/custom-jobs-and-variables.yml' + - project: 'sundials/radiuss-shared-ci' # https://lc.llnl.gov/gitlab/sundials/radiuss-shared-ci + ref: 'ae1f3786591beed83abc6a0de2229f6e9532e2d4' + file: 'pipelines/${CI_MACHINE}.yml' + # Add your jobs + # you can use a local file + - local: '.gitlab/jobs/${CI_MACHINE}.yml' + # or a file generated in the previous steps + # - artifact: '${CI_MACHINE}-jobs.yml' + # job: 'generate-job-file' + # (See Umpire CI setup for an example). + strategy: depend + forward: + pipeline_variables: true -# This is where jobs are included. include: + # Sets ID tokens for every job using `default:` - project: 'lc-templates/id_tokens' file: 'id_tokens.yml' - - local: .gitlab/quartz-templates.yml - - local: .gitlab/quartz-jobs.yml - - local: .gitlab/lassen-templates.yml - - local: .gitlab/lassen-jobs.yml - - local: .gitlab/corona-templates.yml - - local: .gitlab/corona-jobs.yml + # # [Optional] checks preliminary to running the actual CI test + # - project: 'radiuss/radiuss-shared-ci' + # ref: 'v2024.04.0' + # file: 'utilities/preliminary-ignore-draft-pr.yml' + # pipelines subscribed by the project + - local: '.gitlab/subscribed-pipelines.yml' diff --git a/.gitlab/build_and_bench.sh b/.gitlab/build_and_bench.sh index 99c99be18c..7a34cc5c34 100755 --- a/.gitlab/build_and_bench.sh +++ b/.gitlab/build_and_bench.sh @@ -19,7 +19,7 @@ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" export CUDA_LAUNCH_BLOCKING=1 if [[ -d ${build_dir} ]] -then +then # configure for multinode $cmake_exe \ @@ -27,7 +27,7 @@ then -DSUNDIALS_BENCHMARK_NUM_CPUS=${nresc} \ -DSUNDIALS_BENCHMARK_NUM_GPUS=${nresg} \ "${project_dir}" - + cd ${build_dir} make benchmark @@ -37,4 +37,3 @@ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "~~~~~ CLEAN UP" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" make clean - diff --git a/.gitlab/build_and_test.sh b/.gitlab/build_and_test.sh index cf7ab193fa..6bb3a30254 100755 --- a/.gitlab/build_and_test.sh +++ b/.gitlab/build_and_test.sh @@ -20,9 +20,6 @@ job_unique_id=${CI_JOB_ID:-""} sys_type=${SYS_TYPE:-""} py_env_path=${PYTHON_ENVIRONMENT_PATH:-""} -spack_prefix=${SHARED_SPACK_PREFIX:-"v0.19.1"} -shared_spack=${SHARED_SPACK:-"UPSTREAM"} - # Dependencies date @@ -38,7 +35,6 @@ echo "spec = ${spec}" echo "job_unique_id = ${job_unique_id}" echo "sys_type = ${sys_type}" echo "py_env_path = ${py_env_path}" -echo "shared_spack = ${shared_spack}" # remove tailing number from hostname hostname=${hostname%%[0-9]*} @@ -46,19 +42,6 @@ hostname=${hostname%%[0-9]*} # number of parallel build jobs BUILD_JOBS=${BUILD_JOBS:-"1"} -# load newer python to try the clingo concretizer -# machine specific loads -if [[ "${hostname}" == "lassen" ]]; then - echo "module load python/3.8.2" - module load python/3.8.2 -elif [[ "${hostname}" == "corona" ]]; then - echo "module load python/3.9.12" - module load python/3.9.12 -else - echo "module load python" - module load python -fi - if [[ "${option}" != "--build-only" && "${option}" != "--test-only" ]] then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" @@ -97,35 +80,29 @@ then mkdir -p ${spack_user_cache} fi - if [[ -d /usr/workspace/sundials ]] - then - upstream="/usr/workspace/sundials/spack_installs/${spack_prefix}/${hostname}" - mkdir -p "${upstream}" - upstream_opt="--upstream=${upstream}" - fi + mirror_opt="" + buildcache="/usr/workspace/sundials/ci/spack_stuff/build_caches/${SPACK_REF}" - if [[ "${shared_spack}" == "UPSTREAM" ]] + if [[ ! -d "${buildcache}" ]] then - python3 .gitlab/uberenv/uberenv.py --spec="${spec}" "${prefix_opt}" "${upstream_opt}" - elif [[ "${shared_spack}" == "ON" ]] - then - python3 .gitlab/uberenv/uberenv.py --spec="${spec}" --prefix="${upstream}" - else - python3 .gitlab/uberenv/uberenv.py --spec="${spec}" "${prefix_opt}" + mkdir "${buildcache}" fi - # Ensure correct CUDA module is loaded, only works for module naming - # convention on Lassen. Only needed for CUDA 11 (unclear why). - if [[ -n "${CUDA_SPEC}" ]]; then - cuda_version="${CUDA_SPEC##*@}" - echo "module load cuda/${cuda_version}" - module load cuda/"${cuda_version}" - fi + mirror_opt=("--mirror=${buildcache}" "--mirror-autopush") - module load cmake/3.23 + key_path=/usr/workspace/sundials/ci/spack_stuff/gpg_backup + python3 .gitlab/uberenv/uberenv.py \ + --trust-key ${key_path}/pubring.gpg --trust-key ${key_path}/secring.gpg \ + --spec="${spec}" "${mirror_opt[@]}" "${prefix_opt}" \ + --spack-commit="${SPACK_REF}" fi + date +# Reload the spack environment created by uberenv +. ${prefix}/spack/share/spack/setup-env.sh +spack load + # Host config file if [[ -z ${hostconfig} ]] then @@ -173,6 +150,9 @@ then echo "~ Host-config: ${hostconfig_path}" echo "~ Build Dir: ${build_dir}" echo "~ Project Dir: ${project_dir}" + echo "~ MPIEXEC_EXECUTABLE: ${MPIEXEC_EXECUTABLE}" + echo "~ MPIEXEC_PREFLAGS: ${MPIEXEC_PREFLAGS}" + echo "~ MPIEXEC_POSTFLAGS: ${MPIEXEC_POSTFLAGS}" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" @@ -195,13 +175,20 @@ then $cmake_exe \ -C "${hostconfig_path}" \ -DCMAKE_INSTALL_PREFIX=${install_dir} \ - -DSUNDIALS_CALIPER_OUTPUT_DIR="${CALIPER_DIR}/Release/${hostname}/${sundials_version}" \ + -DMPIEXEC_EXECUTABLE=$(which $MPIEXEC_EXECUTABLE) \ + -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} \ + -DMPIEXEC_POSTFLAGS=${MPIEXEC_POSTFLAGS} \ + -DSUNDIALS_TEST_CALIPER_OUTPUT_DIR="${CALIPER_DIR}/Release/${hostname}/${sundials_version}" \ + -DSUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR="${CALIPER_DIR}/Release/${hostname}/${sundials_version}" \ "${project_dir}" else $cmake_exe \ -C "${hostconfig_path}" \ -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DMPIEXEC_EXECUTABLE=$(which $MPIEXEC_EXECUTABLE) \ + -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} \ + -DMPIEXEC_POSTFLAGS=${MPIEXEC_POSTFLAGS} \ "${project_dir}" fi diff --git a/.gitlab/corona-jobs.yml b/.gitlab/corona-jobs.yml deleted file mode 100644 index f694611c39..0000000000 --- a/.gitlab/corona-jobs.yml +++ /dev/null @@ -1,48 +0,0 @@ -# ------------------------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# HIP -# ------------------------------------------------------------------------------ - -# Builds with HIP -corona_rocmcc_550: - parallel: - matrix: - - COMPILER_SPEC: rocmcc@5.5.0 - AMDGPU_TARGET: [gfx906] - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double amdgpu_target=${AMDGPU_TARGET} scheduler=flux +rocm+mpi" - extends: .corona_build_and_test - -# ------------------------------------------------------------------------------ -# HIP + TPLs -# ------------------------------------------------------------------------------ -corona_rocmcc_550_tpls: - parallel: - matrix: - - COMPILER_SPEC: rocmcc@5.5.0 - AMDGPU_TARGET: [gfx906] - ROCM_VERSION: 5.5.0 - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double ~int64 amdgpu_target=${AMDGPU_TARGET} scheduler=flux +rocm+mpi+magma+raja+kokkos+kokkos-kernels~ginkgo ^magma+rocm amdgpu_target=${AMDGPU_TARGET} ^raja+rocm~openmp~examples~exercises amdgpu_target=${AMDGPU_TARGET} ^kokkos+rocm~profiling amdgpu_target=${AMDGPU_TARGET} ^hipblas@${ROCM_VERSION} ^hipsparse@${ROCM_VERSION} ^hip@${ROCM_VERSION} ^hsa-rocr-dev@${ROCM_VERSION} ^llvm-amdgpu@${ROCM_VERSION}" - extends: .corona_build_and_test - -corona_rocmcc_523_tpls: - parallel: - matrix: - - COMPILER_SPEC: rocmcc@5.2.3 - AMDGPU_TARGET: [gfx906] - ROCM_VERSION: 5.2.3 - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double ~int64 amdgpu_target=${AMDGPU_TARGET} scheduler=flux +rocm+mpi+magma+raja+kokkos+kokkos-kernels+ginkgo ^magma+rocm amdgpu_target=${AMDGPU_TARGET} ^raja+rocm~openmp~examples~exercises amdgpu_target=${AMDGPU_TARGET} ^kokkos+rocm~profiling amdgpu_target=${AMDGPU_TARGET} ^ginkgo+rocm amdgpu_target=${AMDGPU_TARGET} ^hipblas@${ROCM_VERSION} ^hipsparse@${ROCM_VERSION} ^rocrand@${ROCM_VERSION} ^rocthrust@${ROCM_VERSION} ^hip@${ROCM_VERSION} ^hsa-rocr-dev@${ROCM_VERSION} ^llvm-amdgpu@${ROCM_VERSION} ^rocprim@${ROCM_VERSION}" - extends: .corona_build_and_test diff --git a/.gitlab/corona-templates.yml b/.gitlab/corona-templates.yml deleted file mode 100644 index a901f4fa48..0000000000 --- a/.gitlab/corona-templates.yml +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Tags and rules to run tests on Corona -# ------------------------------------------------------------------------------ - -# Generic Corona build job, extending build script for Toss 4 x86_64 Systems -.corona_build_and_test: - tags: - - shell - - corona - extends: [.build_toss_4_x86_64_ib_corona_script] - stage: c_build_and_test - needs: [] - artifacts: - paths: - - spack-*.txt - - build_*/* - when: always - rules: - # Don't run if... - - if: '$CI_COMMIT_BRANCH =~ /_cnone/ || $ON_CORONA == "OFF" || $BENCHMARK == "ON"' - when: never - # Default is to run if previous stage succeeded - - when: on_success diff --git a/.gitlab/custom-jobs-and-variables.yml b/.gitlab/custom-jobs-and-variables.yml new file mode 100644 index 0000000000..37601ee9cc --- /dev/null +++ b/.gitlab/custom-jobs-and-variables.yml @@ -0,0 +1,84 @@ +############################################################################### +# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS +# project contributors. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# SPDX-License-Identifier: (MIT) +############################################################################### +# Modifications to this file have been made under the folllowing copyright. +# ----------------------------------------------------------------------------- +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# ----------------------------------------------------------------------------- + +# We define the following GitLab pipeline variables: +variables: +# In some pipelines we create only one allocation shared among jobs in +# order to save time and resources. This allocation has to be uniquely +# named so that we are sure to retrieve it and avoid collisions. + ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID} + +# Dane +# Arguments for top level allocation + DANE_SHARED_ALLOC: "--exclusive --reservation=ci --time=60 --nodes=1" +# Arguments for job level allocation + DANE_JOB_ALLOC: "--time=55 --nodes=1 --overlap" +# Add variables that should apply to all the jobs on a machine: +# DANE_MY_VAR: "..." + +# Tioga +# Arguments for top level allocation + TIOGA_SHARED_ALLOC: "--exclusive --queue pci --time-limit=60m --nodes=1" +# Arguments for job level allocation + TIOGA_JOB_ALLOC: "--time-limit=55m --nodes=1" +# Add variables that should apply to all the jobs on a machine: +# TIOGA_MY_VAR: "..." + +# Number of threads to use for builds. + BUILD_JOBS: 32 + +# Sets CMAKE_VERBOSE_MAKEFILE to TRUE when "ON". + VERBOSE_BUILD: "ON" + +# Passes --verbose to CTest when "ON". + VERBOSE_TEST: "ON" + +# Should the Dane pipeline run? Set to "ON" or "OFF" to enable/disable. + ON_DANE: "ON" + +# Should the Tioga pipeline run? Set to "ON" or "OFF" to enable/disable. + ON_TIOGA: "ON" + +# If "ON", then the SUNDIALS benchmark problems are run and generate profiles. + BENCHMARK: "OFF" + +# Number of nodes to use for benchmarks. Default is 4. + BENCHMARK_NNODES: 4 + +# What queue to submit the benchmarks too. Default is pbatch (for Livermore). + BENCHMARK_QUEUE: "pbatch" + +# Configuration shared by build and test jobs specific to this project. +# Not all configuration can be shared. Here projects can fine tune the +# CI behavior. +# See Umpire for an example (export junit test reports). +.custom_job: + variables: + SPACK_DISABLE_LOCAL_CONFIG: "true" + SPACK_USER_CACHE_PATH: /tmp/spack diff --git a/.gitlab/jobs/dane.yml b/.gitlab/jobs/dane.yml new file mode 100644 index 0000000000..5bff1f5cd6 --- /dev/null +++ b/.gitlab/jobs/dane.yml @@ -0,0 +1,66 @@ +############################################################################## +# Copyright (c) 2022-24, Lawrence Livermore National Security, LLC and RADIUSS +# project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## +# ------------------------------------------------------------------------------ +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# ------------------------------------------------------------------------------ + +########################################## +# Overridden shared radiuss-shared-ci jobs +########################################## + +# We duplicate the shared jobs description and add necessary changes for this +# project. We keep ${PROJECT__VARIANTS} and ${PROJECT__DEPS} +# So that the comparison with the original job is easier. + +# No overridden jobs so far. + +######################## +# Extra jobs +######################## + +.sundials_job_on_dane: + variables: + MPIEXEC_EXECUTABLE: "srun" + extends: [.custom_job, .job_on_dane] + +dane_clang_tpls: + parallel: + matrix: + - COMPILER_SPEC: clang@14.0.6 + INDEX_SPEC: [~int64] + PRECISION_SPEC: [double] + variables: + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} +f2003+mpi+openmp+hypre+superlu-dist+lapack+klu+petsc+ginkgo+kokkos+kokkos-kernels~trilinos ^openblas" + extends: .sundials_job_on_dane + +dane_gcc_tpls: + parallel: + matrix: + - COMPILER_SPEC: gcc@10.3.1 + INDEX_SPEC: [~int64] + PRECISION_SPEC: [double] + variables: + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} +f2003+mpi+openmp+hypre+superlu-dist+lapack+klu+petsc+ginkgo+kokkos+kokkos-kernels~trilinos ^netlib-lapack" + extends: .sundials_job_on_dane + +dane_intel_tpls: + parallel: + matrix: + - COMPILER_SPEC: intel@2023.2.1 + INDEX_SPEC: [~int64] + PRECISION_SPEC: [double] + variables: + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} ~f2003+mpi+openmp+hypre+superlu-dist+lapack~klu+petsc+ginkgo+kokkos+kokkos-kernels~trilinos ^intel-oneapi-mkl" + extends: .sundials_job_on_dane diff --git a/.gitlab/jobs/tioga.yml b/.gitlab/jobs/tioga.yml new file mode 100644 index 0000000000..5b8d766e73 --- /dev/null +++ b/.gitlab/jobs/tioga.yml @@ -0,0 +1,92 @@ +############################################################################## +# Copyright (c) 2022-24, Lawrence Livermore National Security, LLC and RADIUSS +# project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## +# ------------------------------------------------------------------------------ +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# ------------------------------------------------------------------------------ + +########################################## +# Overridden shared radiuss-shared-ci jobs +########################################## + +# We duplicate the shared jobs description and add necessary changes for this +# project. We keep ${PROJECT__VARIANTS} and ${PROJECT__DEPS} +# So that the comparison with the original job is easier. + +# No overridden jobs so far. + +######################## +# Extra jobs +######################## + +.sundials_job_on_tioga: + variables: + MPIEXEC_EXECUTABLE: "flux" + MPIEXEC_PREFLAGS: "run" + extends: [.custom_job, .job_on_tioga] + +# --- Builds with HIP + +# Builds fine but non-mpi tests fail to execute due to a missing so: +# error while loading shared libraries: libpgmath.so: cannot open shared object file: No such file or directory +# This seems like it might be an LC environment issue, so disabling the job for now. +tioga_rocmcc_571_tpls: + parallel: + matrix: + - COMPILER_SPEC: rocmcc@5.7.1 + AMDGPU_TARGET: [gfx90a] + variables: + ON_TIOGA: "OFF" # disable until we can figure out libpgmath.so error + # have to use ginkgo@master because our spack version does not have ginkgo@1.8.0: yet (which seems to be needed) + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double amdgpu_target=${AMDGPU_TARGET} +rocm+mpi+magma+ginkgo+kokkos ^magma+rocm amdgpu_target=${AMDGPU_TARGET} ^ginkgo@master+rocm amdgpu_target=${AMDGPU_TARGET} ^kokkos+rocm amdgpu_target=${AMDGPU_TARGET}" + before_script: + - module load rocmcc/5.7.1-magic + extends: [.sundials_job_on_tioga] + +tioga_rocmcc_620_tpls: + parallel: + matrix: + - COMPILER_SPEC: rocmcc@6.2.0 + AMDGPU_TARGET: [gfx90a] + variables: + # have to use ginkgo@master because our spack version does not have ginkgo@1.8.0: yet (which seems to be needed) + # similarly, we need a newer magma than available to compile with 'rocm@6:' so we turn it off + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double amdgpu_target=${AMDGPU_TARGET} +rocm+mpi~magma+ginkgo+kokkos ^ginkgo@master+rocm amdgpu_target=${AMDGPU_TARGET} ^kokkos+rocm amdgpu_target=${AMDGPU_TARGET}" + before_script: + - module load rocmcc/6.2.0-magic + extends: [.sundials_job_on_tioga] + +# --- Builds without HIP + +tioga_cce_1800_mpi_only: + parallel: + matrix: + - COMPILER_SPEC: cce@18.0.0 + variables: + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double +mpi" + extends: [.sundials_job_on_tioga] + + +# --- Benchmark jobs + +tioga_rocmcc_620_benchmark: + parallel: + matrix: + - COMPILER_SPEC: rocmcc@6.2.0 + AMDGPU_TARGET: [gfx90a] + CALIPER_DIR: /usr/workspace/sundials/ci/performance/califiles + variables: + ON_TIOGA: "OFF" # disable until we re-baseline on Tioga + SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 build_type=Release precision=double scheduler=flux caliper-dir=${CALIPER_DIR} ~int64 +benchmarks+profiling+caliper+adiak+mpi+openmp+rocm+raja amdgpu_target=${AMDGPU_TARGET} ^raja+rocm~openmp~examples~exercises amdgpu_target=${AMDGPU_TARGET} ^caliper+adiak+rocm amdgpu_target=${AMDGPU_TARGET}" + extends: [.sundials_job_on_tioga] diff --git a/.gitlab/lassen-jobs.yml b/.gitlab/lassen-jobs.yml deleted file mode 100644 index 1ffca71d46..0000000000 --- a/.gitlab/lassen-jobs.yml +++ /dev/null @@ -1,45 +0,0 @@ -# ------------------------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------------------------ - -# Builds with CUDA, RAJA and other TPLs -lassen_cuda_no_tpls: - parallel: - matrix: - - COMPILER_SPEC: [xl@16.1.1.14] - CUDA_SPEC: [cuda@10.1.243] - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double ~int64 +mpi+openmp+cuda~raja~magma~superlu-dist~petsc~hypre~ginkgo cuda_arch=70 ^${CUDA_SPEC}+allow-unsupported-compilers" - extends: .lassen_build_and_test - -lassen_gcc_cuda_tpls: - parallel: - matrix: - - COMPILER_SPEC: gcc@8.3.1 - CUDA_SPEC: [cuda@11.8.0] - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 precision=double ~int64 +mpi+openmp+cuda+raja+magma+superlu-dist+petsc+hypre+ginkgo cuda_arch=70 ^ginkgo+cuda cuda_arch=70 ^hypre~cuda ^petsc~cuda ^superlu-dist+cuda cuda_arch=70 ^magma+cuda cuda_arch=70 ^raja+cuda~openmp~examples~exercises cuda_arch=70 ^${CUDA_SPEC}+allow-unsupported-compilers" - extends: .lassen_build_and_test - -# ------------------------------------------------------------------------------ -# Benchmark jobs -# ------------------------------------------------------------------------------ - -lassen_gcc_cuda_bench: - parallel: - matrix: - - COMPILER_SPEC: gcc@8.3.1 - CUDA_SPEC: [cuda@11.8.0] - CALIPER_DIR: /usr/workspace/sundials/califiles - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 build_type=Release precision=double scheduler=lsf caliper-dir=${CALIPER_DIR} ~int64 +benchmarks+profiling+caliper+adiak+mpi+openmp+cuda+raja cuda_arch=70 ^raja+cuda~openmp~examples~exercises cuda_arch=70 ^caliper+adiak+cuda cuda_arch=70 ^${CUDA_SPEC}+allow-unsupported-compilers" - extends: .lassen_build_and_bench - diff --git a/.gitlab/lassen-templates.yml b/.gitlab/lassen-templates.yml deleted file mode 100644 index 450a3134c2..0000000000 --- a/.gitlab/lassen-templates.yml +++ /dev/null @@ -1,56 +0,0 @@ -# ------------------------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Tags and rules to run tests on Lassen -# ------------------------------------------------------------------------------ - -# Generic lassen build job, extending build script for IBM P9 systems -.lassen_build_and_test: - tags: - - shell - - lassen - extends: [.build_blueos_3_ppc64le_ib_script] - stage: l_build_and_test - needs: [] - artifacts: - paths: - - spack-*.txt - - build_*/* - when: always - rules: - # Don't run if... - - if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_LASSEN == "OFF" || $BENCHMARK == "ON"' - when: never - # Default is to run if previous stage succeeded - - when: on_success - -.lassen_build_and_bench: - tags: - - shell - - lassen - extends: [.build_blueos_3_ppc64le_ib_bench] - stage: l_build_and_bench - needs: [] - artifacts: - paths: - - spack-*.txt - - build_*/* - - '*.cali' - when: always - expire_in: never - rules: - # Don't run if... - - if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_LASSEN == "OFF" || $BENCHMARK == "OFF"' - when: never - # Default is to run if previous stage succeeded - - when: on_success diff --git a/.gitlab/quartz-jobs.yml b/.gitlab/quartz-jobs.yml deleted file mode 100644 index a0c96755a6..0000000000 --- a/.gitlab/quartz-jobs.yml +++ /dev/null @@ -1,85 +0,0 @@ -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- - -# ------------------------------------------------------------------------------ -# Basic builds w/o TPLs -# ------------------------------------------------------------------------------ -### Builds without TPLs -# How to easily add +f2003 when int64 and double? - -# quartz_clang: -# parallel: -# matrix: -# - COMPILER_SPEC: clang@12.0.0 -# INDEX_SPEC: [~int64, +int64] -# PRECISION_SPEC: [double] -# variables: -# SPEC: "%${COMPILER_SPEC} ${INDEX_SPEC} precision=${PRECISION_SPEC}" -# extends: .quartz_build_and_test - -# quartz_gcc: -# parallel: -# matrix: -# - COMPILER_SPEC: gcc@10.3.1 -# INDEX_SPEC: [~int64, +int64] -# PRECISION_SPEC: [double] -# variables: -# SPEC: "%${COMPILER_SPEC} ${INDEX_SPEC} precision=${PRECISION_SPEC}" -# extends: .quartz_build_and_test - -# quartz_intel: -# parallel: -# matrix: -# - COMPILER_SPEC: intel@19.1.2 -# INDEX_SPEC: [~int64, +int64] -# PRECISION_SPEC: [double] -# variables: -# SPEC: "%${COMPILER_SPEC} ${INDEX_SPEC} precision=${PRECISION_SPEC}" -# extends: .quartz_build_and_test - -# ------------------------------------------------------------------------------ -# Builds with TPLs -# ------------------------------------------------------------------------------ -# +petsc ~hypre ~superlu-dist ~int64 ~hdf5 -# +superlu-dist == segfaults - -quartz_clang_tpls: - parallel: - matrix: - - COMPILER_SPEC: clang@14.0.6 - INDEX_SPEC: [~int64] - PRECISION_SPEC: [double] - variables: - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} +mpi +openmp +hypre +superlu-dist +lapack +klu +petsc ^suite-sparse@5.13.0 ^openblas" - extends: .quartz_build_and_test - -quartz_gcc_tpls: - parallel: - matrix: - - COMPILER_SPEC: gcc@10.3.1 - INDEX_SPEC: [~int64] - PRECISION_SPEC: [double] - variables: - # For some reason nvhpc gets picked up for lapack w/o ^openblas - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} +mpi +openmp +hypre +superlu-dist +lapack +klu +petsc ^suite-sparse@5.13.0 ^openblas" - extends: .quartz_build_and_test - -quartz_intel_tpls: - parallel: - matrix: - - COMPILER_SPEC: intel@19.1.2 - INDEX_SPEC: [~int64] - PRECISION_SPEC: [double] - variables: - # perl@5.32.0 needed until spack v0.20.0: https://github.com/spack/spack/pull/35666 - SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 ${INDEX_SPEC} precision=${PRECISION_SPEC} +mpi +openmp +hypre ~superlu-dist +lapack +klu ^suite-sparse@5.13.0 ^perl@5.32.0" - extends: .quartz_build_and_test diff --git a/.gitlab/quartz-templates.yml b/.gitlab/quartz-templates.yml deleted file mode 100644 index bfc33a3fd5..0000000000 --- a/.gitlab/quartz-templates.yml +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2021, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Tags and rules to run tests on Quartz -# ------------------------------------------------------------------------------ - -# Generic quartz build job, extending build script -.quartz_build_and_test: - tags: - - shell - - quartz - extends: [.build_toss_3_x86_64_ib_script] - stage: q_build_and_test - needs: [] - artifacts: - paths: - - spack-*.txt - - build_*/* - when: always - rules: - # Don't run if... - - if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_QUARTZ == "OFF" || $BENCHMARK == "ON"' - when: never - # Default is to run if previous stage succeeded - - when: on_success diff --git a/.gitlab/radiuss-spack-configs b/.gitlab/radiuss-spack-configs index 1264a6db12..89c2074e46 160000 --- a/.gitlab/radiuss-spack-configs +++ b/.gitlab/radiuss-spack-configs @@ -1 +1 @@ -Subproject commit 1264a6db12f451153a5cb22a32a1b7ba2faa5fc2 +Subproject commit 89c2074e466d454c77ec17249cbdf8555d183388 diff --git a/.gitlab/spack_packages/netlib-lapack/ibm-xl-3.9.1.patch b/.gitlab/spack_packages/netlib-lapack/ibm-xl-3.9.1.patch deleted file mode 100644 index c9e1707857..0000000000 --- a/.gitlab/spack_packages/netlib-lapack/ibm-xl-3.9.1.patch +++ /dev/null @@ -1,108 +0,0 @@ -Fixes for IBM XL and Cray CCE builds: - -* Correct path to the fallback configuration used to handle mangling for - C++/Fortran compatibility (CCE, XL) - -* Change logic for detecting recursive fortran flags to (a) Include XL -(qrecur), and (b) Be explicit, since not every compiler will correctly reject -an incorrect option (ALL) - -NOTE: This patch has been accepted upstream -(see https://github.com/Reference-LAPACK/lapack/pull/621) - -############################################################################## - -diff -Naur a/CBLAS/CMakeLists.txt b/CBLAS/CMakeLists.txt ---- a/CBLAS/CMakeLists.txt 2021-03-25 12:25:15.000000000 -0600 -+++ b/CBLAS/CMakeLists.txt 2021-09-01 16:27:23.561355382 -0600 -@@ -11,9 +11,7 @@ - MACRO_NAMESPACE "F77_" - SYMBOL_NAMESPACE "F77_") - if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND) -- message(WARNING "Reverting to pre-defined include/lapacke_mangling.h") -- configure_file(include/lapacke_mangling_with_flags.h.in -- ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h) -+ message(WARNING "Reverting to pre-defined include/cblas_mangling.h") - configure_file(include/cblas_mangling_with_flags.h.in - ${LAPACK_BINARY_DIR}/include/cblas_mangling.h) - endif() -diff -Naur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2021-03-25 12:25:15.000000000 -0600 -+++ b/CMakeLists.txt 2021-09-02 09:49:18.070436958 -0600 -@@ -94,16 +94,22 @@ - - # Check if recursive flag exists - include(CheckFortranCompilerFlag) --check_fortran_compiler_flag("-recursive" _recursiveFlag) --check_fortran_compiler_flag("-frecursive" _frecursiveFlag) --check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag) -+if(CMAKE_Fortran_COMPILER_ID STREQUAL Flang) -+ check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag) -+elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) -+ check_fortran_compiler_flag("-frecursive" _frecursiveFlag) -+elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) -+ check_fortran_compiler_flag("-recursive" _recursiveFlag) -+elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL) -+ check_fortran_compiler_flag("-qrecur" _qrecurFlag) -+endif() - - # Add recursive flag --if(_recursiveFlag) -- string(REGEX MATCH "-recursive" output_test "${CMAKE_Fortran_FLAGS}") -+if(_MrecursiveFlag) -+ string(REGEX MATCH "-Mrecursive" output_test "${CMAKE_Fortran_FLAGS}") - if(NOT output_test) -- set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive" -- CACHE STRING "Recursive flag must be set" FORCE) -+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive" -+ CACHE STRING "Recursive flag must be set" FORCE) - endif() - elseif(_frecursiveFlag) - string(REGEX MATCH "-frecursive" output_test "${CMAKE_Fortran_FLAGS}") -@@ -111,11 +117,17 @@ - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive" - CACHE STRING "Recursive flag must be set" FORCE) - endif() --elseif(_MrecursiveFlag) -- string(REGEX MATCH "-Mrecursive" output_test "${CMAKE_Fortran_FLAGS}") -+elseif(_recursiveFlag) -+ string(REGEX MATCH "-recursive" output_test "${CMAKE_Fortran_FLAGS}") - if(NOT output_test) -- set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive" -- CACHE STRING "Recursive flag must be set" FORCE) -+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive" -+ CACHE STRING "Recursive flag must be set" FORCE) -+ endif() -+elseif(_qrecurFlag) -+ string(REGEX MATCH "-qrecur" output_test "${CMAKE_Fortran_FLAGS}") -+ if(NOT output_test) -+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur" -+ CACHE STRING "Recursive flag must be set" FORCE) - endif() - endif() - -@@ -124,7 +136,7 @@ - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict") - endif() - if(CMAKE_Fortran_COMPILER_ID STREQUAL XL) -- set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none") -+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict") - endif() - # Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler. - # This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin -diff -Naur a/INSTALL/make.inc.XLF b/INSTALL/make.inc.XLF ---- a/INSTALL/make.inc.XLF 2021-03-25 12:25:15.000000000 -0600 -+++ b/INSTALL/make.inc.XLF 2021-09-02 09:50:02.664646455 -0600 -@@ -14,10 +14,10 @@ - # the compiler options desired when NO OPTIMIZATION is selected. - # - FC = xlf --FFLAGS = -O3 -qfixed -qnosave -+FFLAGS = -O3 -qfixed -qnosave -qrecur - # For -O2, add -qstrict=none - FFLAGS_DRV = $(FFLAGS) --FFLAGS_NOOPT = -O0 -qfixed -qnosave -+FFLAGS_NOOPT = -O0 -qfixed -qnosave -qrecur - - # Define LDFLAGS to the desired linker options for your machine. - # diff --git a/.gitlab/spack_packages/netlib-lapack/ibm-xl.patch b/.gitlab/spack_packages/netlib-lapack/ibm-xl.patch deleted file mode 100644 index 52b5f19719..0000000000 --- a/.gitlab/spack_packages/netlib-lapack/ibm-xl.patch +++ /dev/null @@ -1,53 +0,0 @@ -Fixes for IBM XL and Cray CCE builds: - -* Avoid optimizations that would alter program semantics by changing the - qstrict activation threshold from O3 to O2 (XL) - -* Don't assume Fortran code is all in fixed source form; disable qfixed (XL) - -* Correct path to the fallback configuration used to handle mangling for - C++/Fortran compatibility (CCE, XL) -############################################################################## - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -62,7 +62,7 @@ - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict") - endif() - if("${CMAKE_Fortran_COMPILER}" MATCHES "xlf") -- set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none") -+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict") - endif() - # Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler. - # This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin - ---- a/CMAKE/CheckLAPACKCompilerFlags.cmake -+++ b/CMAKE/CheckLAPACKCompilerFlags.cmake -@@ -43,12 +43,6 @@ - if( "${CMAKE_Fortran_FLAGS}" MATCHES "-qflttrap=[a-zA-Z:]:enable" ) - set( FPE_EXIT TRUE ) - endif() -- -- if( NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-qfixed") ) -- message( STATUS "Enabling fixed format F90/F95 with -qfixed" ) -- set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qfixed" -- CACHE STRING "Flags for Fortran compiler." FORCE ) -- endif() - - # HP Fortran - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "HP" ) - ---- a/CBLAS/CMakeLists.txt -+++ b/CBLAS/CMakeLists.txt -@@ -12,8 +12,8 @@ - SYMBOL_NAMESPACE "F77_") - if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND) - message(WARNING "Reverting to pre-defined include/lapacke_mangling.h") -- configure_file(include/lapacke_mangling_with_flags.h.in -- ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h) -+ configure_file(include/cblas_mangling_with_flags.h.in -+ ${LAPACK_BINARY_DIR}/include/cblas_mangling.h) - endif() - - include_directories(include ${LAPACK_BINARY_DIR}/include) - diff --git a/.gitlab/spack_packages/netlib-lapack/package.py b/.gitlab/spack_packages/netlib-lapack/package.py deleted file mode 100644 index cb1832d061..0000000000 --- a/.gitlab/spack_packages/netlib-lapack/package.py +++ /dev/null @@ -1,223 +0,0 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) -import spack.build_systems.cmake -from spack.package import * - - -class NetlibLapack(CMakePackage): - """LAPACK version 3.X is a comprehensive FORTRAN library that does - linear algebra operations including matrix inversions, least squared - solutions to linear sets of equations, eigenvector analysis, singular - value decomposition, etc. It is a very comprehensive and reputable - package that has found extensive use in the scientific community. - - """ - - homepage = "https://www.netlib.org/lapack/" - url = "https://www.netlib.org/lapack/lapack-3.5.0.tgz" - tags = ["windows"] - - version( - "3.10.1", - sha256="cd005cd021f144d7d5f7f33c943942db9f03a28d110d6a3b80d718a295f7f714", - url="https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz", - ) - version( - "3.10.0", - sha256="328c1bea493a32cac5257d84157dc686cc3ab0b004e2bea22044e0a59f6f8a19", - url="https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz", - ) - version( - "3.9.1", - sha256="d0085d2caf997ff39299c05d4bacb6f3d27001d25a4cc613d48c1f352b73e7e0", - url="https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.9.1.tar.gz", - ) - version( - "3.9.0", - sha256="106087f1bb5f46afdfba7f569d0cbe23dacb9a07cd24733765a0e89dbe1ad573", - url="https://github.com/Reference-LAPACK/lapack/archive/v3.9.0.tar.gz", - ) - version( - "3.8.0", - sha256="deb22cc4a6120bff72621155a9917f485f96ef8319ac074a7afbc68aab88bcf6", - url="https://www.netlib.org/lapack/lapack-3.8.0.tar.gz", - ) - version("3.7.1", sha256="f6c53fd9f56932f3ddb3d5e24c1c07e4cd9b3b08e7f89de9c867125eecc9a1c8") - version("3.7.0", sha256="ed967e4307e986474ab02eb810eed1d1adc73f5e1e3bc78fb009f6fe766db3be") - version("3.6.1", sha256="888a50d787a9d828074db581c80b2d22bdb91435a673b1bf6cd6eb51aa50d1de") - version("3.6.0", sha256="a9a0082c918fe14e377bbd570057616768dca76cbdc713457d8199aaa233ffc3") - version("3.5.0", sha256="9ad8f0d3f3fb5521db49f2dd716463b8fb2b6bc9dc386a9956b8c6144f726352") - version("3.4.2", sha256="60a65daaf16ec315034675942618a2230521ea7adf85eea788ee54841072faf0") - version("3.4.1", sha256="93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f") - version("3.4.0", sha256="a7139ef97004d0e3c4c30f1c52d508fd7ae84b5fbaf0dd8e792c167dc306c3e9") - version("3.3.1", sha256="56821ab51c29369a34e5085728f92c549a9aa926f26acf7eeac87b61eed329e4") - - # netlib-lapack is the reference implementation of LAPACK - for ver in [ - "3.10.1", - "3.10.0", - "3.9.1", - "3.9.0", - "3.8.0", - "3.7.1", - "3.7.0", - "3.6.1", - "3.6.0", - "3.5.0", - "3.4.2", - "3.4.1", - "3.4.0", - "3.3.1", - ]: - provides("lapack@" + ver, when="@" + ver) - - variant("shared", default=True, description="Build shared library version") - variant("external-blas", default=False, description="Build lapack with an external blas") - - variant("lapacke", default=True, description="Activates the build of the LAPACKE C interface") - variant("xblas", default=False, description="Builds extended precision routines using XBLAS") - - # Fixes for IBM XL and Cray CCE builds: - # Avoid optimizations that alter program semantics - # Don't assume fixed source form for Fortran - # Correct path to mangling config - patch("ibm-xl.patch", when="@3.7:3.8 %xl") - patch("ibm-xl.patch", when="@3.7:3.8 %xl_r") - patch("ibm-xl.patch", when="@3.7:3.8 %cce@9:") - - # https://github.com/Reference-LAPACK/lapack/pull/621 - # Fixes for IBM XL and Cray CCE builds: - # Correct path to mangling config - # Fix logic for detecting recursive Fortran flags - patch("ibm-xl-3.9.1.patch", when="@3.9.1 %xl") - patch("ibm-xl-3.9.1.patch", when="@3.9.1 %xl_r") - patch("ibm-xl-3.9.1.patch", when="@3.9.1 %cce@13:") - - # https://github.com/Reference-LAPACK/lapack/issues/228 - patch("undefined_declarations.patch", when="@3.8.0:3.8") - - # https://github.com/Reference-LAPACK/lapack/pull/268 - patch("testing.patch", when="@3.7.0:3.8") - - # virtual dependency - provides("blas", when="~external-blas") - provides("lapack") - - depends_on("blas", when="+external-blas") - depends_on("netlib-xblas+fortran+plain_blas", when="+xblas") - depends_on("python@2.7:", type="test") - - # We need to run every phase twice in order to get static and shared - # versions of the libraries. When ~shared, we run the default - # implementations of the CMakePackage's phases and get only one building - # directory 'spack-build-static' with -DBUILD_SHARED_LIBS:BOOL=OFF (see - # implementations of self.build_directory and self.cmake_args() below). - # When +shared, we run the overridden methods for the phases, each - # running the default implementation twice with different values for - # self._building_shared. As a result, we get two building directories: - # 'spack-build-static' with -DBUILD_SHARED_LIBS:BOOL=OFF and - # 'spack-build-shared' with -DBUILD_SHARED_LIBS:BOOL=ON. - _building_shared = False - - def patch(self): - # Fix cblas CMakeLists.txt -- has wrong case for subdirectory name. - if self.spec.satisfies("@3.6.0:"): - filter_file( - "${CMAKE_CURRENT_SOURCE_DIR}/CMAKE/", - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/", - "CBLAS/CMakeLists.txt", - string=True, - ) - - # Remove duplicate header file that gets generated during CMake shared - # builds: https://github.com/Reference-LAPACK/lapack/issues/583 - if self.spec.satisfies("platform=windows @0:3.9.1"): - force_remove("LAPACKE/include/lapacke_mangling.h") - - @property - def blas_libs(self): - shared = True if "+shared" in self.spec else False - query_parameters = self.spec.last_query.extra_parameters - query2libraries = { - tuple(): ["libblas"], - ("c", "fortran"): ["libcblas", "libblas"], - ("c",): ["libcblas"], - ("fortran",): ["libblas"], - } - key = tuple(sorted(query_parameters)) - libraries = query2libraries[key] - return find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) - - @property - def lapack_libs(self): - shared = True if "+shared" in self.spec else False - query_parameters = self.spec.last_query.extra_parameters - query2libraries = { - tuple(): ["liblapack"], - ("c", "fortran"): ["liblapacke", "liblapack"], - ("c",): ["liblapacke"], - ("fortran",): ["liblapack"], - } - key = tuple(sorted(query_parameters)) - libraries = query2libraries[key] - return find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) - - @property - def headers(self): - include_dir = self.spec.prefix.include - cblas_h = join_path(include_dir, "cblas.h") - lapacke_h = join_path(include_dir, "lapacke.h") - return HeaderList([cblas_h, lapacke_h]) - - -class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): - def cmake_args(self): - args = [ - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), - self.define_from_variant("LAPACKE", "lapacke"), - self.define_from_variant("LAPACKE_WITH_TMG", "lapacke"), - self.define("CBLAS", self.spec.satisfies("@3.6.0:")), - ] - - if self.spec.satisfies("%intel"): - # Intel compiler finds serious syntax issues when trying to - # build CBLAS and LapackE - args.extend([self.define("CBLAS", False), self.define("LAPACKE", False)]) - - if self.spec.satisfies("%xl") or self.spec.satisfies("%xl_r"): - # use F77 compiler if IBM XL - args.extend( - [ - self.define("CMAKE_Fortran_COMPILER", self.pkg.compiler.f77), - self.define( - "CMAKE_Fortran_FLAGS", - " ".join(self.spec.compiler_flags["fflags"]) + " -O3 -qnohot", - ), - ] - ) - - # deprecated routines are commonly needed by, for example, suitesparse - # Note that OpenBLAS spack is built with deprecated routines - args.append(self.define("BUILD_DEPRECATED", True)) - - if self.spec.satisfies("+external-blas"): - args.extend( - [ - self.define("USE_OPTIMIZED_BLAS", True), - self.define("BLAS_LIBRARIES:PATH", self.spec["blas"].libs.joined(";")), - ] - ) - - if self.spec.satisfies("+xblas"): - args.extend( - [ - self.define("XBLAS_INCLUDE_DIR", self.spec["netlib-xblas"].prefix.include), - self.define("XBLAS_LIBRARY", self.spec["netlib-xblas"].libs.joined(";")), - ] - ) - - args.append(self.define("BUILD_TESTING", self.pkg.run_tests)) - - return args diff --git a/.gitlab/spack_packages/netlib-lapack/testing.patch b/.gitlab/spack_packages/netlib-lapack/testing.patch deleted file mode 100644 index fce18548c4..0000000000 --- a/.gitlab/spack_packages/netlib-lapack/testing.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/TESTING/LIN/alahd.f b/TESTING/LIN/alahd.f -index 8f4cd58d..6a4946e0 100644 ---- a/TESTING/LIN/alahd.f -+++ b/TESTING/LIN/alahd.f -@@ -1036,7 +1036,7 @@ - 9929 FORMAT( ' Test ratios (1-3: ', A1, 'TZRZF):' ) - 9920 FORMAT( 3X, ' 7-10: same as 3-6', 3X, ' 11-14: same as 3-6' ) - 9921 FORMAT( ' Test ratios:', / ' (1-2: ', A1, 'GELS, 3-6: ', A1, -- $ 'GELSY, 7-10: ', A1, 'GELSS, 11-14: ', A1, 'GELSD, 15-16: ' -+ $ 'GELSY, 7-10: ', A1, 'GELSS, 11-14: ', A1, 'GELSD, 15-16: ', - $ A1, 'GETSLS)') - 9928 FORMAT( 7X, 'where ALPHA = ( 1 + SQRT( 17 ) ) / 8' ) - 9927 FORMAT( 3X, I2, ': ABS( Largest element in L )', / 12X, diff --git a/.gitlab/spack_packages/netlib-lapack/undefined_declarations.patch b/.gitlab/spack_packages/netlib-lapack/undefined_declarations.patch deleted file mode 100644 index 9dac2562f7..0000000000 --- a/.gitlab/spack_packages/netlib-lapack/undefined_declarations.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/SRC/dsytrf_aa_2stage.f b/SRC/dsytrf_aa_2stage.f -index 2991305..f5f06cc 100644 ---- a/SRC/dsytrf_aa_2stage.f -+++ b/SRC/dsytrf_aa_2stage.f -@@ -191,7 +191,7 @@ - EXTERNAL LSAME, ILAENV - * .. - * .. External Subroutines .. -- EXTERNAL XERBLA, DCOPY, DLACGV, DLACPY, -+ EXTERNAL XERBLA, DCOPY, DLACPY, - $ DLASET, DGBTRF, DGEMM, DGETRF, - $ DSYGST, DSWAP, DTRSM - * .. -diff --git a/SRC/ssytrf_aa_2stage.f b/SRC/ssytrf_aa_2stage.f -index be6809d..a929749 100644 ---- a/SRC/ssytrf_aa_2stage.f -+++ b/SRC/ssytrf_aa_2stage.f -@@ -191,7 +191,7 @@ - EXTERNAL LSAME, ILAENV - * .. - * .. External Subroutines .. -- EXTERNAL XERBLA, SCOPY, SLACGV, SLACPY, -+ EXTERNAL XERBLA, SCOPY, SLACPY, - $ SLASET, SGBTRF, SGEMM, SGETRF, - $ SSYGST, SSWAP, STRSM - * .. diff --git a/.gitlab/subscribed-pipelines.yml b/.gitlab/subscribed-pipelines.yml new file mode 100644 index 0000000000..06ce192a02 --- /dev/null +++ b/.gitlab/subscribed-pipelines.yml @@ -0,0 +1,77 @@ +############################################################################### +# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS +# project contributors. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# SPDX-License-Identifier: (MIT) +############################################################################### +# Modifications to this file have been made under the folllowing copyright. +# ----------------------------------------------------------------------------- +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# ----------------------------------------------------------------------------- + +# The template job to test whether a machine is up. +# Expects CI_MACHINE defined to machine name. +.machine-check: + stage: prerequisites + tags: [shell, oslic] + variables: + GIT_STRATEGY: none + script: + - | + if [[ $(jq '.[env.CI_MACHINE].total_nodes_up' /usr/global/tools/lorenz/data/loginnodeStatus) == 0 ]] + then + echo -e "\e[31mNo node available on ${CI_MACHINE}\e[0m" + curl --url "https://api.github.com/repos/${GITHUB_PROJECT_ORG}/${GITHUB_PROJECT_NAME}/statuses/${CI_COMMIT_SHA}" \ + --header 'Content-Type: application/json' \ + --header "authorization: Bearer ${GITHUB_TOKEN}" \ + --data "{ \"state\": \"failure\", \"target_url\": \"${CI_PIPELINE_URL}\", \"description\": \"GitLab ${CI_MACHINE} down\", \"context\": \"ci/gitlab/${CI_MACHINE}\" }" + exit 1 + fi + +### +# Trigger a build-and-test pipeline for a machine. +# Comment the jobs for machines you don’t need. +### + +# DANE +dane-up-check: + variables: + CI_MACHINE: "dane" + extends: [.machine-check] + +dane-build-and-test: + variables: + CI_MACHINE: "dane" + needs: [dane-up-check] + extends: [.build-and-test] + +# TIOGA +tioga-up-check: + variables: + CI_MACHINE: "tioga" + extends: [.machine-check] + +tioga-build-and-test: + variables: + CI_MACHINE: "tioga" + needs: [tioga-up-check] + extends: [.build-and-test] + diff --git a/.gitlab/uberenv b/.gitlab/uberenv index 0d00dc8e19..ec6fd144c8 160000 --- a/.gitlab/uberenv +++ b/.gitlab/uberenv @@ -1 +1 @@ -Subproject commit 0d00dc8e19a889ba07ae433590b87533c4b5b3da +Subproject commit ec6fd144c814ce30a6487db9fb8294def606afda diff --git a/.gitmodules b/.gitmodules index 659855b75f..e915f32aa6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/sundials-codes/radiuss-spack-configs.git [submodule "uberenv"] path = .gitlab/uberenv - url = https://github.com/LLNL/uberenv.git + url = https://github.com/sundials-codes/uberenv.git [submodule "test/answers"] path = test/answers url = https://github.com/sundials-codes/answers.git diff --git a/.uberenv_config.json b/.uberenv_config.json index 67618cca2f..3264fe5b05 100644 --- a/.uberenv_config.json +++ b/.uberenv_config.json @@ -4,8 +4,7 @@ "package_final_phase": "initconfig", "package_source_dir": "../..", "spack_url": "https://github.com/spack/spack", - "spack_commit": "5e0d2107348eed6cbe6deca43a30f5b06c5e40af", "spack_activate": {}, "spack_configs_path": ".gitlab/radiuss-spack-configs", - "spack_packages_path": ".gitlab/spack_packages" -} + "spack_packages_path": "scripts/spack/packages" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 82e24b6382..14724cbf51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,44 +6,235 @@ ### New Features and Enhancements +Improved the precision of the coefficients for `ARKODE_ARK324L2SA_ERK_4_2_3`, +`ARKODE_VERNER_9_5_6`, `ARKODE_VERNER_10_6_7`, `ARKODE_VERNER_13_7_8`, +`ARKODE_ARK324L2SA_DIRK_4_2_3`, and `ARKODE_ESDIRK324L2SA_4_2_3`. + +The Soderlind time step adaptivity controller now starts with an I controller +until there is sufficient history of past time steps and errors. + +Added the `ARKODE_RALSTON_3_1_2` and `ARKODE_TSITOURAS_7_4_5` explicit +Runge-Kutta Butcher tables. + +Improved the efficiency of default ARKODE methods with the following changes: + +| Type | Old Default | New Default | +| ------------------ | ---------------------------------------------------------------- | ------------------------------------------------------------------ | +| 2nd Order Explicit | `ARKODE_HEUN_EULER_2_1_2` | `ARKODE_RALSTON_3_1_2` | +| 4th Order Explicit | `ARKODE_ZONNEVELD_5_3_4` | `ARKODE_SOFRONIOU_SPALETTA_5_3_4` | +| 5th Order Explicit | `ARKODE_CASH_KARP_6_4_5` | `ARKODE_TSITOURAS_7_4_5` | +| 6th Order Explicit | `ARKODE_VERNER_8_5_6` | `ARKODE_VERNER_9_5_6` | +| 8th Order Explicit | `ARKODE_FEHLBERG_13_7_8` | `ARKODE_VERNER_13_7_8` | +| 2nd Order Implicit | `ARKODE_SDIRK_2_1_2` | `ARKODE_ARK2_DIRK_3_1_2` | +| 3rd Order Implicit | `ARKODE_ARK324L2SA_DIRK_4_2_3` | `ARKODE_ESDIRK325L2SA_5_2_3` | +| 4th Order Implicit | `ARKODE_SDIRK_5_3_4` | `ARKODE_ESDIRK436L2SA_6_3_4` | +| 5th Order Implicit | `ARKODE_ARK548L2SA_DIRK_8_4_5` | `ARKODE_ESDIRK547L2SA2_7_4_5` | +| 4th Order ARK | `ARKODE_ARK436L2SA_ERK_6_3_4` and `ARKODE_ARK436L2SA_DIRK_6_3_4` | `ARKODE_ARK437L2SA_ERK_7_3_4` and `ARKODE_ARK437L2SA_DIRK_7_3_4` | +| 5th Order ARK | `ARKODE_ARK548L2SA_ERK_8_4_5` and `ARKODE_ARK548L2SA_DIRK_8_4_5` | `ARKODE_ARK548L2SAb_ERK_8_4_5` and `ARKODE_ARK548L2SAb_DIRK_8_4_5` | + +### Bug Fixes + +Removed error floors from the `SUNAdaptController` implementations which could +unnecessarily limit the time size growth, particularly after the first step. + +Fixed bug in `ARKodeSetFixedStep` where it could return `ARK_SUCCESS` despite +an error occurring. + +Fixed the behavior of `SUNDIALS_ENABLE_ERROR_CHECKS` so additional runtime error +checks are disabled by default with all release build types. Previously, +`MinSizeRel` builds enabled additional error checking by default. + +Fixed bug in the ARKODE SPRKStep `SPRKStepReInit` function and `ARKodeReset` function +with SPRKStep that could cause a segmentation fault when compensated summation is not +used. + +### Deprecation Notices + +All work space functions, e.g., `CVodeGetWorkSpace` and `ARKodeGetLinWorkSpace`, +have been deprecated and will be removed in version 8.0.0. + +## Changes to SUNDIALS in release 7.2.1 + +### New Features and Enhancements + +Unit tests were separated from examples. To that end, the following directories +were moved out of the `examples/` directory to the `test/unit_tests` directory: +`nvector`, `sunmatrix`, `sunlinsol`, and `sunnonlinsol`. + +### Bug Fixes + +Fixed a bug in ARKStep where an extra right-hand side evaluation would occur +each time step when enabling the ``ARKodeSetAutonomous`` option and using an +IMEX method where the DIRK table has an implicit first stage and is not stiffly +accurate. + +## Changes to SUNDIALS in release 7.2.0 + +### Major Features + +Added a time-stepping module to ARKODE for low storage Runge--Kutta methods, +LSRKStep. This currently supports five explicit low-storage methods: the +second-order Runge--Kutta--Chebyshev and Runge--Kutta--Legendre methods, and the +second- through fourth-order optimal strong stability preserving Runge--Kutta +methods. All methods include embeddings for temporal adaptivity. + +Added an operator splitting module, SplittingStep, and forcing method module, +ForcingStep, to ARKODE. These modules support a broad range of operator-split +time integration methods for multiphysics applications. + +Added support for multirate time step adaptivity controllers, based on the +recently introduced `SUNAdaptController` base class, to ARKODE's MRIStep module. +As a part of this, we added embeddings for existing MRI-GARK methods, as well as +support for embedded MERK and IMEX-MRI-SR methods. Added new default MRI methods +for temporally adaptive versus fixed-step runs. + +### New Features and Enhancements + +#### Logging + +The information level logging output in ARKODE, CVODE(S), and IDA(S) has been +updated to be more uniform across the packages and a new `tools` directory has +been added with a Python module, `suntools`, containing utilities for parsing +logging output. The Python utilities for parsing CSV output have been relocated +from the `scripts` directory to the Python module. + +#### SUNStepper + +Added the `SUNStepper` base class to represent a generic solution procedure for +IVPs. This is used by the SplittingStep and ForcingStep modules of ARKODE. A +SUNStepper can be created from an ARKODE memory block with the new function +`ARKodeCreateSUNStepper`. To enable interoperability with `MRIStepInnerStepper`, +the function `MRIStepInnerStepper_CreateFromSUNStepper` was added. + +#### ARKODE + +Added functionality to ARKODE to accumulate a temporal error estimate over +multiple time steps. See the routines `ARKodeSetAccumulatedErrorType`, +`ARKodeResetAccumulatedError`, and `ARKodeGetAccumulatedError` for details. + +Added the `ARKodeSetStepDirection` and `ARKodeGetStepDirection` functions to +change and query the direction of integration. + +Added the function `MRIStepGetNumInnerStepperFails` to retrieve the number of +recoverable failures reported by the MRIStepInnerStepper. + +Added a utility routine to wrap any valid ARKODE integrator for use as an +MRIStep inner stepper object, `ARKodeCreateMRIStepInnerStepper`. + +The following DIRK schemes now have coefficients accurate to quad precision: +* `ARKODE_BILLINGTON_3_3_2` +* `ARKODE_KVAERNO_4_2_3` +* `ARKODE_CASH_5_2_4` +* `ARKODE_CASH_5_3_4` +* `ARKODE_KVAERNO_5_3_4` +* `ARKODE_KVAERNO_7_4_5` + +#### CMake + 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. -The Trilinos Teptra NVector interface has been updated to utilize CMake -imported targets added in Trilinos 14 to improve support for different Kokkos -backends with Trilinos. As such, Trilinos 14 or newer is required and the -`Trilinos_INTERFACE_*` CMake options have been removed. - -Example programs using *hypre* have been updated to support v2.20 and newer. - The build system has been updated to utilize the CMake LAPACK imported target which should ease building SUNDIALS with LAPACK libraries that require setting specific linker flags e.g., MKL. +#### Third Party Libraries + +The Trilinos Teptra NVector interface has been updated to utilize CMake imported +targets added in Trilinos 14 to improve support for different Kokkos backends +with Trilinos. As such, Trilinos 14 or newer is required and the +`Trilinos_INTERFACE_*` CMake options have been removed. + +Example programs using *hypre* have been updated to support v2.20 and newer. + ### Bug Fixes +#### CMake + +Fixed a CMake bug regarding usage of missing "print_warning" macro that was only +triggered when the deprecated `CUDA_ARCH` option was used. + +Fixed a CMake configuration issue related to aliasing an `ALIAS` target when +using `ENABLE_KLU=ON` in combination with a static-only build of SuiteSparse. + +Fixed a CMake issue which caused third-party CMake variables to be unset. Users +may see more options in the CMake GUI now as a result of the fix. See details +in GitHub Issue [#538](https://github.com/LLNL/sundials/issues/538). + +#### NVector + +Fixed a build failure with the SYCL NVector when using Intel oneAPI 2025.0 +compilers. See GitHub Issue [#596](https://github.com/LLNL/sundials/issues/596). + +Fixed compilation errors when building the Trilinos Teptra NVector with CUDA +support. + +#### SUNMatrix + +Fixed a [bug](https://github.com/LLNL/sundials/issues/581) in the sparse matrix +implementation of `SUNMatScaleAddI` which caused out of bounds writes unless +`indexvals` were in ascending order for each row/column. + +#### SUNLinearSolver + +Fixed a bug in the SPTFQMR linear solver where recoverable preconditioner errors +were reported as unrecoverable. + +#### ARKODE + Fixed `ARKodeResize` not using the default `hscale` when an argument of `0` was provided. +Fixed a memory leak that could occur if ``ARKodeSetDefaults`` is called +repeatedly. + 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. +Fixed loading the default IMEX-MRI method if `ARKodeSetOrder` is used to specify +a third or fourth order method. Previously, the default second order method was +loaded in both cases. -Fixed a memory leak that could occur if ``ARKodeSetDefaults`` is called -repeatedly. +Fixed potential memory leaks and out of bounds array accesses that could occur +in the ARKODE Lagrange interpolation module when changing the method order or +polynomial degree after re-initializing an integrator. -Fixed compilation errors when building the Trilinos Teptra NVector with CUDA -support. +Fixed a bug in ARKODE when enabling rootfinding with fixed step sizes and the +initial value of the rootfinding function is zero. In this case, uninitialized +right-hand side data was used to compute a state value near the initial +condition to determine if any rootfinding functions are initially active. -Fixed a CMake configuration issue related to aliasing an `ALIAS` target when -using `ENABLE_KLU=ON` in combination with a static-only build of SuiteSparse. +Fixed a bug in MRIStep where the data supplied to the Hermite interpolation +module did not include contributions from the fast right-hand side +function. With this fix, users will see one additional fast right-hand side +function evaluation per slow step with the Hermite interpolation option. + +Fixed a bug in SPRKStep when using compensated summations where the error vector +was not initialized to zero. + +#### CVODE(S) + +Fixed a bug where `CVodeSetProjFailEta` would ignore the `eta` parameter. + +#### Fortran Interfaces + +Fixed a bug in the 32-bit ``sunindextype`` Fortran interfaces to +``N_VGetSubvectorArrayPointer_ManyVector``, +``N_VGetSubvectorArrayPointer_MPIManyVector``, ``SUNBandMatrix_Column`` and +``SUNDenseMatrix_Column`` where 64-bit ``sunindextype`` interface functions were +used. ### Deprecation Notices +Deprecated the ARKStep-specific utility routine for wrapping an ARKStep instance +as an MRIStep inner stepper object, `ARKStepCreateMRIStepInnerStepper`. Use +`ARKodeCreateMRIStepInnerStepper` instead. + +The ARKODE stepper specific functions to retrieve the number of right-hand side +function evaluations have been deprecated. Use `ARKodeGetNumRhsEvals` instead. + ## Changes to SUNDIALS in release 7.1.1 ### Bug Fixes @@ -180,7 +371,7 @@ ARKODE-wide equivalent, instructions have been added to the user guide for how to retain the current functionality using other user-callable functions. The unsupported implementations of `N_VGetArrayPointer` and `N_VSetArrayPointer` -for the *hypre* and PETSc vectors are now deprecated. Users should access the +for the *hypre* and PETSc vectors are now deprecated. Users should access the underlying wrapped external library vector objects instead with `N_VGetVector_ParHyp` and `N_VGetVector_Petsc`, respectively. @@ -487,9 +678,9 @@ ARKODE. ### New Features Updated CVODE, CVODES and ARKODE default behavior when returning the solution when -the internal time has reached a user-specified stop time. Previously, the output +the internal time has reached a user-specified stop time. Previously, the output solution was interpolated to the value of `tstop`; the default is now to copy the -internal solution vector. Users who wish to revert to interpolation may call a new +internal solution vector. Users who wish to revert to interpolation may call a new routine `CVodeSetInterpolateStopTime`, `ARKStepSetInterpolateStopTime`, `ERKStepSetInterpolateStopTime`, or `MRIStepSetInterpolateStopTime`. @@ -809,7 +1000,7 @@ instead. * `SUNLinSolSetInfoFile_SPBCGS` * `SUNLinSolSetPrintLevel_SPBCGS` -The `SUNLinSolSetInfoFile_*` and `SUNNonlinSolSetInfoFile_*` family of +The `SUNLinSolSetInfoFile_*` and `SUNNonlinSolSetInfoFile_*` family of functions are now enabled by setting the CMake option `SUNDIALS_LOGGING_LEVEL` to a value `>= 3`. @@ -970,7 +1161,7 @@ can be enabled with the CMake option `SUNDIALS_BUILD_WITH_PROFILING`. A built-in profiler will be used by default, but the [Caliper](https://github.com/LLNL/Caliper) library can also be used instead with the CMake option `ENABLE_CALIPER`. See the documentation section on profiling -for more details. **WARNING**: Profiling will impact performance, and should be +for more details. **WARNING**: Profiling will impact performance, and should be enabled judiciously. #### IMEX MRI Methods and MRIStepInnerStepper Object @@ -1305,9 +1496,9 @@ use the `SUNLinSolNewEmpty` constructor will, at a minimum, need set the to leverage this new set function to remove one dot product per solve. The time integrator packages (ARKODE, CVODE(S), and IDA(S)) all now support a -new "matrix-embedded" SUNLinearSolver type. This type supports user-supplied +new "matrix-embedded" SUNLinearSolver type. This type supports user-supplied SUNLinearSolver implementations that set up and solve the specified linear -system at each linear solve call. Any matrix-related data structures are held +system at each linear solve call. Any matrix-related data structures are held internally to the linear solver itself, and are not provided by the SUNDIALS package. @@ -1682,7 +1873,7 @@ should be used instead. Added support for a user-supplied function to update the prediction for each implicit stage solution in ARKStep. If supplied, this routine will be called *after* any existing ARKStep predictor algorithm completes, so that the -predictor may be modified by the user as desired. The new user-supplied routine +predictor may be modified by the user as desired. The new user-supplied routine has type `ARKStepStagePredictFn`, and may be set by calling `ARKStepSetStagePredictFn`. @@ -1880,7 +2071,7 @@ The inputs values passed to the first two inputs of the `SUNNonlinSolSolve` function in the `SUNNonlinearSolver` have been changed to be the predicted state and the initial guess for the correction to that state. Additionally, the definitions of `SUNNonlinSolLSetupFn` and `SUNNonlinSolLSolveFn` in the -SUNNonlinearSolver API have been updated to remove unused input parameters. For +SUNNonlinearSolver API have been updated to remove unused input parameters. For more information on the nonlinear system formulation and the API functions see the `SUNNonlinearSolver` chapter in the user guides. diff --git a/CITATIONS.md b/CITATIONS.md index 9e93aa7ced..5ca79337f7 100644 --- a/CITATIONS.md +++ b/CITATIONS.md @@ -69,7 +69,7 @@ they are using rather than the combined SUNDIALS online guide: author = {Daniel R. Reynolds and David J. Gardner and Carol S. Woodward and Cody J. Balos}, title = {User Documentation for ARKODE}, year = {2024}, - note = {v6.1.1} + note = {v6.2.1} } ``` @@ -78,7 +78,7 @@ they are using rather than the combined SUNDIALS online guide: author = {Alan C. Hindmarsh and Radu Serban and Cody J. Balos and David J. Gardner and Daniel R. Reynolds and Carol S. Woodward}, title = {User Documentation for CVODE}, year = {2024}, - note = {v7.1.1} + note = {v7.2.1} } ``` @@ -87,7 +87,7 @@ they are using rather than the combined SUNDIALS online guide: author = {Alan C. Hindmarsh and Radu Serban and Cody J. Balos and David J. Gardner and Daniel R. Reynolds and Carol S. Woodward}, title = {User Documentation for CVODES}, year = {2024}, - note = {v7.1.1} + note = {v7.2.1} } ``` @@ -96,7 +96,7 @@ they are using rather than the combined SUNDIALS online guide: author = {Alan C. Hindmarsh and Radu Serban and Cody J. Balos and David J. Gardner and Daniel R. Reynolds and Carol S. Woodward}, title = {User Documentation for IDA}, year = {2024}, - note = {v7.1.1} + note = {v7.2.1} } ``` @@ -105,7 +105,7 @@ they are using rather than the combined SUNDIALS online guide: author = {Radu Serban and Cosmin Petra and Alan C. Hindmarsh and Cody J. Balos and David J. Gardner and Daniel R. Reynolds and Carol S. Woodward}, title = {User Documentation for IDAS}, year = {2024}, - note = {v6.1.1} + note = {v6.2.1} } ``` @@ -114,6 +114,6 @@ they are using rather than the combined SUNDIALS online guide: author = {Alan C. Hindmarsh and Radu Serban and Cody J. Balos and David J. Gardner and Daniel R. Reynolds and Carol S. Woodward}, title = {User Documentation for KINSOL}, year = {2024}, - note = {v7.1.1} + note = {v7.2.1} } ``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 61b164f678..69e1f25647 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # and Slaven Peles @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -44,7 +44,7 @@ include(FindPackageHandleStandardArgs) # Set some variables with info on the SUNDIALS project set(PACKAGE_BUGREPORT "sundials-users@llnl.gov") set(PACKAGE_NAME "SUNDIALS") -set(PACKAGE_STRING "SUNDIALS 7.1.1") +set(PACKAGE_STRING "SUNDIALS 7.2.1") set(PACKAGE_TARNAME "sundials") # Set SUNDIALS version numbers @@ -53,7 +53,7 @@ message(STATUS "SUNDIALS_GIT_VERSION: ${SUNDIALS_GIT_VERSION}") # (use "" for the version label if none is needed) set(PACKAGE_VERSION_MAJOR "7") -set(PACKAGE_VERSION_MINOR "1") +set(PACKAGE_VERSION_MINOR "2") set(PACKAGE_VERSION_PATCH "1") set(PACKAGE_VERSION_LABEL "") @@ -69,37 +69,37 @@ endif() # Specify the VERSION and SOVERSION for shared libraries -set(arkodelib_VERSION "6.1.1") +set(arkodelib_VERSION "6.2.1") set(arkodelib_SOVERSION "6") -set(cvodelib_VERSION "7.1.1") +set(cvodelib_VERSION "7.2.1") set(cvodelib_SOVERSION "7") -set(cvodeslib_VERSION "7.1.1") +set(cvodeslib_VERSION "7.2.1") set(cvodeslib_SOVERSION "7") -set(idalib_VERSION "7.1.1") +set(idalib_VERSION "7.2.1") set(idalib_SOVERSION "7") -set(idaslib_VERSION "6.1.1") +set(idaslib_VERSION "6.2.1") set(idaslib_SOVERSION "6") -set(kinsollib_VERSION "7.1.1") +set(kinsollib_VERSION "7.2.1") set(kinsollib_SOVERSION "7") set(cpodeslib_VERSION "0.0.0") set(cpodeslib_SOVERSION "0") -set(nveclib_VERSION "7.1.1") +set(nveclib_VERSION "7.2.1") set(nveclib_SOVERSION "7") -set(sunmatrixlib_VERSION "5.1.1") +set(sunmatrixlib_VERSION "5.2.1") set(sunmatrixlib_SOVERSION "5") -set(sunlinsollib_VERSION "5.1.1") +set(sunlinsollib_VERSION "5.2.1") set(sunlinsollib_SOVERSION "5") -set(sunnonlinsollib_VERSION "4.1.1") +set(sunnonlinsollib_VERSION "4.2.1") set(sunnonlinsollib_SOVERSION "4") set(sundialslib_VERSION @@ -199,6 +199,12 @@ include(SundialsBuildOptionsPost) include(SundialsSetupConfig) +# =============================================================== +# Setup testing +# =============================================================== + +include(SundialsSetupTesting) + # =============================================================== # Add src and tests; optionally add examples and unit tests. # =============================================================== @@ -208,17 +214,17 @@ add_subdirectory(src) # Add selected examples to the build if(_BUILD_EXAMPLES) - include(SundialsSetupTesting) add_subdirectory(examples) endif() # Add benchmarks to the build if(BUILD_BENCHMARKS) + include(SundialsSetupBenchmarks) add_subdirectory(benchmarks) endif() -# Add unit tests to the build if they are enabled -if(SUNDIALS_TEST_UNITTESTS) +# Add unit tests to the build +if(SUNDIALS_TEST_ENABLE_UNIT_TESTS) add_subdirectory(test/unit_tests) endif() diff --git a/LICENSE b/LICENSE index 2b12386cc0..83e943ccc7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2002-2024, Lawrence Livermore National Security and Southern Methodist University. +Copyright (c) 2002-2025, Lawrence Livermore National Security and Southern Methodist University. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 1d84b9b6e2..cfb094f99e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # SUNDIALS: SUite of Nonlinear and DIfferential/ALgebraic equation Solvers # -### Version 7.1.1 (Jun 2024) ### + +[![track SUNDIALS downloads](https://github.com/sundials-codes/sundials-download-tracker/actions/workflows/nightly.yml/badge.svg)](https://github.com/sundials-codes/sundials-download-tracker/actions/workflows/nightly.yml) + +### Version 7.2.1 (Dec 2024) ### **Center for Applied Scientific Computing, Lawrence Livermore National Laboratory** @@ -16,7 +19,7 @@ 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$$ + $$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 @@ -92,13 +95,29 @@ 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, +Other contributors to SUNDIALS include: Mustafa Aggul, 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, 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. +## Acknowledgements ## + +This material is based on work supported by the U.S. Department of Energy, +Office of Science, Office of Advanced Scientific Computing Research, Scientific +Discovery through Advanced Computing (SciDAC) program via the Frameworks, +Algorithms, and Scalable Technologies for Mathematics (FASTMath) Institute under +DOE awards DE-AC52-07NA27344 and DE-SC-0021354. + +This material is also based on work supported by the U.S. Department of Energy, +Office of Science, Office of Advanced Scientific Computing Research, +Next-Generation Scientific Software Technologies program under contract +DE-AC52-07NA27344. Additional support is also provided by SciDAC +partnerships with the U.S. Department of Energy’s FES, NP, BES, OE, and BER +offices as well as the LLNL Institutional Scientific Capability Portfolio. + + ## License ## SUNDIALS is released under the BSD 3-clause license. See the [LICENSE](./LICENSE) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 2c139fc356..e4b21669f2 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/advection_reaction_3D/CMakeLists.txt b/benchmarks/advection_reaction_3D/CMakeLists.txt index b4b953a437..ab510c3709 100644 --- a/benchmarks/advection_reaction_3D/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Daniel R. Reynolds @ SMU # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt b/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt index 1bb7ac2c5e..d0fd33c818 100644 --- a/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/kokkos/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Daniel R. Reynolds @ SMU # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -22,7 +22,7 @@ if(BUILD_ARKODE set(benchmark_target "advection_reaction_3D_kokkos.${backend}") # benchmark source files - add_executable( + sundials_add_executable( ${benchmark_target} advection_reaction_3D.cpp arkode_driver.cpp diff --git a/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp b/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp index 78fafd71ad..bc0604d525 100644 --- a/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/ParallelGrid.hpp @@ -3,7 +3,7 @@ * Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp index 1bca75cbcc..87ce6204be 100644 --- a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.cpp @@ -3,7 +3,7 @@ * David J. Gardner, Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.hpp b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.hpp index ed594b0828..b73864426c 100644 --- a/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/advection_reaction_3D.hpp @@ -3,7 +3,7 @@ * David J. Gardner, Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp index 4f606bd7bf..d852ae1fe8 100644 --- a/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/arkode_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner, Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -189,8 +189,10 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); - check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 1, &nfi); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); @@ -392,8 +394,10 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); - check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 1, &nfi); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); @@ -516,8 +520,8 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); - check_retval(&retval, "ERKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); diff --git a/benchmarks/advection_reaction_3D/kokkos/check_retval.h b/benchmarks/advection_reaction_3D/kokkos/check_retval.h index a64f816976..929ab7cd10 100644 --- a/benchmarks/advection_reaction_3D/kokkos/check_retval.h +++ b/benchmarks/advection_reaction_3D/kokkos/check_retval.h @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/cvode_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/cvode_driver.cpp index 76f3c9f5f3..9b97e993ac 100644 --- a/benchmarks/advection_reaction_3D/kokkos/cvode_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/cvode_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/ida_driver.cpp b/benchmarks/advection_reaction_3D/kokkos/ida_driver.cpp index d029f8c34e..73d40b7fae 100644 --- a/benchmarks/advection_reaction_3D/kokkos/ida_driver.cpp +++ b/benchmarks/advection_reaction_3D/kokkos/ida_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp index ea714ecaeb..b6cd22fa3d 100644 --- a/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp +++ b/benchmarks/advection_reaction_3D/kokkos/rhs3D.hpp @@ -3,7 +3,7 @@ * David J. Gardner, Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/CMakeLists.txt b/benchmarks/advection_reaction_3D/raja/CMakeLists.txt index 264e023b5a..7095621dde 100644 --- a/benchmarks/advection_reaction_3D/raja/CMakeLists.txt +++ b/benchmarks/advection_reaction_3D/raja/CMakeLists.txt @@ -3,7 +3,7 @@ # Daniel R. Reynolds @ SMU # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -33,7 +33,7 @@ if(BUILD_ARKODE # MPI only # ---------------------------------------------------------------------------- - add_executable( + sundials_add_executable( advection_reaction_3D_raja advection_reaction_3D.cpp arkode_driver.cpp @@ -94,7 +94,7 @@ if(BUILD_ARKODE set_source_files_properties(cvode_driver.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(ida_driver.cpp PROPERTIES LANGUAGE CUDA) - add_executable( + sundials_add_executable( advection_reaction_3D_raja_mpicuda advection_reaction_3D.cpp arkode_driver.cpp @@ -149,7 +149,7 @@ if(BUILD_ARKODE if(BUILD_NVECTOR_HIP) - add_executable( + sundials_add_executable( advection_reaction_3D_raja_mpihip advection_reaction_3D.cpp advection_reaction_3D.hpp diff --git a/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp b/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp index f234aa089a..c5c06d214c 100644 --- a/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp +++ b/benchmarks/advection_reaction_3D/raja/ParallelGrid.hpp @@ -3,7 +3,7 @@ * Daniel R. Reynolds @ SMU * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp index 7ee19de56d..851d6bf587 100644 --- a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp +++ b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.cpp @@ -3,7 +3,7 @@ * Daniel R. Reynolds @ SMU * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -483,7 +483,7 @@ int SetupProblem(int argc, char* argv[], UserData* udata, UserOptions* uopt, uopt->fused = 0; /* use fused vector ops */ uopt->save = 1; /* save solution to disk */ uopt->nout = 10; /* number of output times */ - uopt->outputdir = (char*)"."; /* output directory */ + uopt->outputdir = "."; /* output directory */ /* Parse CLI args and set udata/uopt appropriately */ int retval = ParseArgs(argc, argv, udata, uopt); diff --git a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp index 2caa282af9..a417aa12be 100644 --- a/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp +++ b/benchmarks/advection_reaction_3D/raja/advection_reaction_3D.hpp @@ -3,7 +3,7 @@ * Daniel R. Reynolds @ SMU * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -57,7 +57,7 @@ struct UserOptions int fused; /* use fused vector ops */ int nout; /* number of outputs */ int save; /* save solution to disk */ - char* outputdir; + const char* outputdir; }; /* diff --git a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp index 420c9d63c9..b5de17a200 100644 --- a/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/arkode_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner, Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -58,7 +58,6 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) long int nfe, nfi; /* RHS stats */ long int nni, ncnf; /* nonlinear solver stats */ long int nli, npsol; /* linear solver stats */ - char fname[MXSTR]; /* Additively split methods should not add the advection and reaction terms */ udata->add_reactions = true; @@ -190,8 +189,10 @@ int EvolveProblemDIRK(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); - check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 1, &nfi); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); @@ -246,7 +247,6 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) long int nfe, nfi; /* RHS stats */ long int nni, ncnf; /* nonlinear solver stats */ long int nli, npsol; /* linear solver stats */ - char fname[MXSTR]; /* Additively split methods should not add the advection and reaction terms */ udata->add_reactions = false; @@ -394,8 +394,10 @@ int EvolveProblemIMEX(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ARKStepGetNumRhsEvals(arkode_mem, &nfe, &nfi); - check_retval(&retval, "ARKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 1, &nfi); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); retval = ARKodeGetNumNonlinSolvIters(arkode_mem, &nni); @@ -445,7 +447,6 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) int iout; /* output counter */ long int nst, nst_a, netf; /* step stats */ long int nfe; /* RHS stats */ - char fname[MXSTR]; /* Additively split methods should not add the advection and reaction terms */ udata->add_reactions = true; @@ -519,8 +520,8 @@ int EvolveProblemExplicit(N_Vector y, UserData* udata, UserOptions* uopt) check_retval(&retval, "ARKodeGetNumSteps", 1, udata->myid); retval = ARKodeGetNumStepAttempts(arkode_mem, &nst_a); check_retval(&retval, "ARKodeGetNumStepAttempts", 1, udata->myid); - retval = ERKStepGetNumRhsEvals(arkode_mem, &nfe); - check_retval(&retval, "ERKStepGetNumRhsEvals", 1, udata->myid); + retval = ARKodeGetNumRhsEvals(arkode_mem, 0, &nfe); + check_retval(&retval, "ARKodeGetNumRhsEvals", 1, udata->myid); retval = ARKodeGetNumErrTestFails(arkode_mem, &netf); check_retval(&retval, "ARKodeGetNumErrTestFails", 1, udata->myid); diff --git a/benchmarks/advection_reaction_3D/raja/backends.hpp b/benchmarks/advection_reaction_3D/raja/backends.hpp index c258c68598..213a420c8d 100644 --- a/benchmarks/advection_reaction_3D/raja/backends.hpp +++ b/benchmarks/advection_reaction_3D/raja/backends.hpp @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/check_retval.h b/benchmarks/advection_reaction_3D/raja/check_retval.h index a64f816976..929ab7cd10 100644 --- a/benchmarks/advection_reaction_3D/raja/check_retval.h +++ b/benchmarks/advection_reaction_3D/raja/check_retval.h @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/cvode_driver.cpp b/benchmarks/advection_reaction_3D/raja/cvode_driver.cpp index 76f3c9f5f3..9b97e993ac 100644 --- a/benchmarks/advection_reaction_3D/raja/cvode_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/cvode_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/ida_driver.cpp b/benchmarks/advection_reaction_3D/raja/ida_driver.cpp index b85c7a3fb6..8429a863c6 100644 --- a/benchmarks/advection_reaction_3D/raja/ida_driver.cpp +++ b/benchmarks/advection_reaction_3D/raja/ida_driver.cpp @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/raja/rhs3D.hpp b/benchmarks/advection_reaction_3D/raja/rhs3D.hpp index 05e9f20448..9821ed4087 100644 --- a/benchmarks/advection_reaction_3D/raja/rhs3D.hpp +++ b/benchmarks/advection_reaction_3D/raja/rhs3D.hpp @@ -3,7 +3,7 @@ * Daniel R. Reynolds @ SMU * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/advection_reaction_3D/scripts/compare_error.py b/benchmarks/advection_reaction_3D/scripts/compare_error.py index 4dd1ff7ee1..53ad8d125e 100755 --- a/benchmarks/advection_reaction_3D/scripts/compare_error.py +++ b/benchmarks/advection_reaction_3D/scripts/compare_error.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/advection_reaction_3D/scripts/compute_error.py b/benchmarks/advection_reaction_3D/scripts/compute_error.py index 85f151ed59..51eff39309 100755 --- a/benchmarks/advection_reaction_3D/scripts/compute_error.py +++ b/benchmarks/advection_reaction_3D/scripts/compute_error.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/advection_reaction_3D/scripts/make_plots.py b/benchmarks/advection_reaction_3D/scripts/make_plots.py index a4dfa87840..e823ce4e0d 100755 --- a/benchmarks/advection_reaction_3D/scripts/make_plots.py +++ b/benchmarks/advection_reaction_3D/scripts/make_plots.py @@ -3,7 +3,7 @@ # Programmer(s): Daniel R. Reynolds @ SMU # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py b/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py index a51fade40f..7ca6ba2ce7 100755 --- a/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py +++ b/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/diffusion_2D/CMakeLists.txt b/benchmarks/diffusion_2D/CMakeLists.txt index f26f7397c2..0384fb2d63 100644 --- a/benchmarks/diffusion_2D/CMakeLists.txt +++ b/benchmarks/diffusion_2D/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/diffusion_2D/diffusion_2D.cpp b/benchmarks/diffusion_2D/diffusion_2D.cpp index 2a64400938..ee2186f76f 100644 --- a/benchmarks/diffusion_2D/diffusion_2D.cpp +++ b/benchmarks/diffusion_2D/diffusion_2D.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/diffusion_2D.hpp b/benchmarks/diffusion_2D/diffusion_2D.hpp index a27c004e63..a4d2d396ab 100644 --- a/benchmarks/diffusion_2D/diffusion_2D.hpp +++ b/benchmarks/diffusion_2D/diffusion_2D.hpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -48,11 +48,10 @@ #endif // Macros for problem constants -#define PI SUN_RCONST(3.141592653589793238462643383279502884197169) -#define ZERO SUN_RCONST(0.0) -#define ONE SUN_RCONST(1.0) -#define TWO SUN_RCONST(2.0) -#define EIGHT SUN_RCONST(8.0) +#define PI SUN_RCONST(3.141592653589793238462643383279502884197169) +#define ZERO SUN_RCONST(0.0) +#define ONE SUN_RCONST(1.0) +#define TWO SUN_RCONST(2.0) // Macro to access (x,y) location in 1D NVector array #define IDX(x, y, n) ((n) * (y) + (x)) diff --git a/benchmarks/diffusion_2D/main_arkode.cpp b/benchmarks/diffusion_2D/main_arkode.cpp index 39c6274a6e..04e00801dc 100644 --- a/benchmarks/diffusion_2D/main_arkode.cpp +++ b/benchmarks/diffusion_2D/main_arkode.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -15,7 +15,10 @@ * ---------------------------------------------------------------------------*/ #include "arkode/arkode_arkstep.h" +#include "arkode/arkode_lsrkstep.h" #include "diffusion_2D.hpp" +#include "sunadaptcontroller/sunadaptcontroller_imexgus.h" +#include "sunadaptcontroller/sunadaptcontroller_soderlind.h" struct UserOptions { @@ -28,6 +31,8 @@ struct UserOptions int maxsteps = 0; // max steps between outputs int onestep = 0; // one step mode, number of steps bool linear = true; // linearly implicit RHS + bool implicit = true; // implicit (ARKStep) vs explicit STS (LSRKStep) + ARKODE_LSRKMethodType lsrkmethod = ARKODE_LSRK_RKC_2; // LSRK method type // Linear solver and preconditioner settings std::string ls = "cg"; // linear solver to use @@ -43,6 +48,14 @@ struct UserOptions void print(); }; +// ----------------------------------------------------------------------------- +// LSRKStep-specific dominant eigenvalue function prototype +// ----------------------------------------------------------------------------- + +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3); + // ----------------------------------------------------------------------------- // Main Program // ----------------------------------------------------------------------------- @@ -58,8 +71,8 @@ int main(int argc, char* argv[]) // Create SUNDIALS context MPI_Comm comm = MPI_COMM_WORLD; - SUNContext ctx = NULL; - SUNProfiler prof = NULL; + SUNContext ctx = nullptr; + SUNProfiler prof = nullptr; flag = SUNContext_Create(comm, &ctx); if (check_flag(&flag, "SUNContextCreate", 1)) { return 1; } @@ -109,6 +122,17 @@ int main(int argc, char* argv[]) return 1; } + // Return with error on unsupported LSRK method type + if (!uopts.implicit) + { + if ((uopts.lsrkmethod != ARKODE_LSRK_RKC_2) && + (uopts.lsrkmethod != ARKODE_LSRK_RKL_2)) + { + cerr << "ERROR: illegal lsrkmethod" << endl; + return 1; + } + } + // ----------------------------- // Setup parallel decomposition // ----------------------------- @@ -152,12 +176,8 @@ int main(int argc, char* argv[]) if (check_flag((void*)(uout.error), "N_VClone", 0)) { return 1; } } - // --------------------- - // Create linear solver - // --------------------- - - // Create linear solver - SUNLinearSolver LS = NULL; + // Set up implicit solver, if applicable + SUNLinearSolver LS = nullptr; SUNMatrix A = nullptr; #if defined(USE_SUPERLU_DIST) // SuperLU-DIST objects @@ -172,77 +192,96 @@ int main(int argc, char* argv[]) sunindextype* A_col_idxs = nullptr; sunindextype* A_row_ptrs = nullptr; #endif - - int prectype = (uopts.preconditioning) ? SUN_PREC_RIGHT : SUN_PREC_NONE; - - if (uopts.ls == "cg") - { - LS = SUNLinSol_PCG(u, prectype, uopts.liniters, ctx); - if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } - } - else if (uopts.ls == "gmres") + if (uopts.implicit) { - LS = SUNLinSol_SPGMR(u, prectype, uopts.liniters, ctx); - if (check_flag((void*)LS, "SUNLinSol_SPGMR", 0)) { return 1; } - } - else - { -#if defined(USE_SUPERLU_DIST) - // Initialize SuperLU-DIST grid - superlu_gridinit(udata.comm_c, udata.npx, udata.npy, &grid); - - // Create arrays for CSR matrix: data, column indices, and row pointers - sunindextype nnz_loc = 5 * udata.nodes_loc; - - A_data = (sunrealtype*)malloc(nnz_loc * sizeof(sunrealtype)); - if (check_flag((void*)A_data, "malloc Adata", 0)) return 1; - - A_col_idxs = (sunindextype*)malloc(nnz_loc * sizeof(sunindextype)); - if (check_flag((void*)A_col_idxs, "malloc Acolind", 0)) return 1; + // --------------------- + // Create linear solver + // --------------------- - A_row_ptrs = - (sunindextype*)malloc((udata.nodes_loc + 1) * sizeof(sunindextype)); - if (check_flag((void*)A_row_ptrs, "malloc Arowptr", 0)) return 1; + // Create linear solver - // Create and initialize SuperLU_DIST structures - dCreate_CompRowLoc_Matrix_dist(&A_super, udata.nodes, udata.nodes, nnz_loc, - udata.nodes_loc, 0, A_data, A_col_idxs, - A_row_ptrs, SLU_NR_loc, SLU_D, SLU_GE); - dScalePermstructInit(udata.nodes, udata.nodes, &A_scaleperm); - dLUstructInit(udata.nodes, &A_lu); - PStatInit(&A_stat); - set_default_options_dist(&A_opts); - A_opts.PrintStat = NO; + int prectype = (uopts.preconditioning) ? SUN_PREC_RIGHT : SUN_PREC_NONE; - // SUNDIALS structures - A = SUNMatrix_SLUNRloc(&A_super, &grid, ctx); - if (check_flag((void*)A, "SUNMatrix_SLUNRloc", 0)) return 1; - - LS = SUNLinSol_SuperLUDIST(u, A, &grid, &A_lu, &A_scaleperm, &A_solve, - &A_stat, &A_opts, ctx); - if (check_flag((void*)LS, "SUNLinSol_SuperLUDIST", 0)) return 1; - - uopts.preconditioning = false; + if (uopts.ls == "cg") + { + LS = SUNLinSol_PCG(u, prectype, uopts.liniters, ctx); + if (check_flag((void*)LS, "SUNLinSol_PCG", 0)) { return 1; } + } + else if (uopts.ls == "gmres") + { + LS = SUNLinSol_SPGMR(u, prectype, uopts.liniters, ctx); + if (check_flag((void*)LS, "SUNLinSol_SPGMR", 0)) { return 1; } + } + else + { +#if defined(USE_SUPERLU_DIST) + // Initialize SuperLU-DIST grid + superlu_gridinit(udata.comm_c, udata.npx, udata.npy, &grid); + + // Create arrays for CSR matrix: data, column indices, and row pointers + sunindextype nnz_loc = 5 * udata.nodes_loc; + + A_data = (sunrealtype*)malloc(nnz_loc * sizeof(sunrealtype)); + if (check_flag((void*)A_data, "malloc Adata", 0)) return 1; + + A_col_idxs = (sunindextype*)malloc(nnz_loc * sizeof(sunindextype)); + if (check_flag((void*)A_col_idxs, "malloc Acolind", 0)) return 1; + + A_row_ptrs = + (sunindextype*)malloc((udata.nodes_loc + 1) * sizeof(sunindextype)); + if (check_flag((void*)A_row_ptrs, "malloc Arowptr", 0)) return 1; + + // Create and initialize SuperLU_DIST structures + dCreate_CompRowLoc_Matrix_dist(&A_super, udata.nodes, udata.nodes, + nnz_loc, udata.nodes_loc, 0, A_data, + A_col_idxs, A_row_ptrs, SLU_NR_loc, + SLU_D, SLU_GE); + dScalePermstructInit(udata.nodes, udata.nodes, &A_scaleperm); + dLUstructInit(udata.nodes, &A_lu); + PStatInit(&A_stat); + set_default_options_dist(&A_opts); + A_opts.PrintStat = NO; + + // SUNDIALS structures + A = SUNMatrix_SLUNRloc(&A_super, &grid, ctx); + if (check_flag((void*)A, "SUNMatrix_SLUNRloc", 0)) return 1; + + LS = SUNLinSol_SuperLUDIST(u, A, &grid, &A_lu, &A_scaleperm, &A_solve, + &A_stat, &A_opts, ctx); + if (check_flag((void*)LS, "SUNLinSol_SuperLUDIST", 0)) return 1; + + uopts.preconditioning = false; #else - std::cerr << "ERROR: Benchmark was not built with SuperLU_DIST enabled\n"; - return 1; + std::cerr + << "ERROR: Benchmark was not built with SuperLU_DIST enabled\n"; + return 1; #endif - } + } - // Allocate preconditioner workspace - if (uopts.preconditioning) - { - udata.diag = N_VClone(u); - if (check_flag((void*)(udata.diag), "N_VClone", 0)) { return 1; } + // Allocate preconditioner workspace + if (uopts.preconditioning) + { + udata.diag = N_VClone(u); + if (check_flag((void*)(udata.diag), "N_VClone", 0)) { return 1; } + } } - // -------------- - // Setup ARKStep - // -------------- + // ---------------------- + // Setup ARKStep/LSRKStep + // ---------------------- // Create integrator - void* arkode_mem = ARKStepCreate(NULL, diffusion, ZERO, u, ctx); - if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } + void* arkode_mem = nullptr; + if (uopts.implicit) + { + arkode_mem = ARKStepCreate(nullptr, diffusion, ZERO, u, ctx); + if (check_flag((void*)arkode_mem, "ARKStepCreate", 0)) { return 1; } + } + else + { + arkode_mem = LSRKStepCreateSTS(diffusion, ZERO, u, ctx); + if (check_flag((void*)arkode_mem, "LSRKStepCreateSTS", 0)) { return 1; } + } // Specify tolerances flag = ARKodeSStolerances(arkode_mem, uopts.rtol, uopts.atol); @@ -252,38 +291,60 @@ int main(int argc, char* argv[]) flag = ARKodeSetUserData(arkode_mem, (void*)&udata); if (check_flag(&flag, "ARKodeSetUserData", 1)) { return 1; } - // Attach linear solver - flag = ARKodeSetLinearSolver(arkode_mem, LS, A); - if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } + // Configure implicit solver + if (uopts.implicit) + { + // Attach linear solver + flag = ARKodeSetLinearSolver(arkode_mem, LS, A); + if (check_flag(&flag, "ARKodeSetLinearSolver", 1)) { return 1; } #if defined(USE_SUPERLU_DIST) - if (uopts.ls == "sludist") - { - ARKodeSetJacFn(arkode_mem, diffusion_jac); - if (check_flag(&flag, "ARKodeSetJacFn", 1)) return 1; - } + if (uopts.ls == "sludist") + { + ARKodeSetJacFn(arkode_mem, diffusion_jac); + if (check_flag(&flag, "ARKodeSetJacFn", 1)) return 1; + } #endif - if (uopts.preconditioning) - { - // Attach preconditioner - flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); - if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } + if (uopts.preconditioning) + { + // Attach preconditioner + flag = ARKodeSetPreconditioner(arkode_mem, PSetup, PSolve); + if (check_flag(&flag, "ARKodeSetPreconditioner", 1)) { return 1; } - // Set linear solver setup frequency (update preconditioner) - flag = ARKodeSetLSetupFrequency(arkode_mem, uopts.msbp); - if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } - } + // Set linear solver setup frequency (update preconditioner) + flag = ARKodeSetLSetupFrequency(arkode_mem, uopts.msbp); + if (check_flag(&flag, "ARKodeSetLSetupFrequency", 1)) { return 1; } + } + + // Set linear solver tolerance factor + flag = ARKodeSetEpsLin(arkode_mem, uopts.epslin); + if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } + + // Select method order + flag = ARKodeSetOrder(arkode_mem, uopts.order); + if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } - // Set linear solver tolerance factor - flag = ARKodeSetEpsLin(arkode_mem, uopts.epslin); - if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; } + // Specify linearly implicit non-time-dependent RHS + if (uopts.linear) + { + flag = ARKodeSetLinear(arkode_mem, 0); + if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } + } + } + else // Configure explicit STS solver + { + // Select LSRK method + flag = LSRKStepSetSTSMethod(arkode_mem, uopts.lsrkmethod); + if (check_flag(&flag, "LSRKStepSetSTSMethod", 1)) { return 1; } - // Select method order - flag = ARKodeSetOrder(arkode_mem, uopts.order); - if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; } + // Provide dominant eigenvalue function + flag = LSRKStepSetDomEigFn(arkode_mem, dom_eig); + if (check_flag(&flag, "LSRKStepSetDomEigFn", 1)) { return 1; } + } // Set fixed step size or adaptivity method + SUNAdaptController C = nullptr; if (uopts.hfixed > ZERO) { flag = ARKodeSetFixedStep(arkode_mem, uopts.hfixed); @@ -291,16 +352,17 @@ int main(int argc, char* argv[]) } else { - flag = ARKStepSetAdaptivityMethod(arkode_mem, uopts.controller, SUNTRUE, - SUNFALSE, NULL); - if (check_flag(&flag, "ARKStepSetAdaptivityMethod", 1)) { return 1; } - } - - // Specify linearly implicit non-time-dependent RHS - if (uopts.linear) - { - flag = ARKodeSetLinear(arkode_mem, 0); - if (check_flag(&flag, "ARKodeSetLinear", 1)) { return 1; } + switch (uopts.controller) + { + case (ARK_ADAPT_PID): C = SUNAdaptController_PID(ctx); break; + case (ARK_ADAPT_PI): C = SUNAdaptController_PI(ctx); break; + case (ARK_ADAPT_I): C = SUNAdaptController_I(ctx); break; + case (ARK_ADAPT_EXP_GUS): C = SUNAdaptController_ExpGus(ctx); break; + case (ARK_ADAPT_IMP_GUS): C = SUNAdaptController_ImpGus(ctx); break; + case (ARK_ADAPT_IMEX_GUS): C = SUNAdaptController_ImExGus(ctx); break; + } + flag = ARKodeSetAdaptController(arkode_mem, C); + if (check_flag(&flag, "ARKodeSetAdaptController", 1)) { return 1; } } // Set max steps between outputs @@ -377,22 +439,26 @@ int main(int argc, char* argv[]) // Free MPI Cartesian communicator MPI_Comm_free(&(udata.comm_c)); + (void)SUNAdaptController_Destroy(C); // Free timestep adaptivity controller ARKodeFree(&arkode_mem); - SUNLinSolFree(LS); + if (uopts.implicit) + { + SUNLinSolFree(LS); - // Free the SuperLU_DIST structures (also frees user allocated arrays - // A_data, A_col_idxs, and A_row_ptrs) + // Free the SuperLU_DIST structures (also frees user allocated arrays + // A_data, A_col_idxs, and A_row_ptrs) #if defined(USE_SUPERLU_DIST) - if (uopts.ls == "sludist") - { - PStatFree(&A_stat); - dScalePermstructFree(&A_scaleperm); - dLUstructFree(&A_lu); - Destroy_CompRowLoc_Matrix_dist(&A_super); - superlu_gridexit(&grid); - } + if (uopts.ls == "sludist") + { + PStatFree(&A_stat); + dScalePermstructFree(&A_scaleperm); + dLUstructFree(&A_lu); + Destroy_CompRowLoc_Matrix_dist(&A_super); + superlu_gridexit(&grid); + } #endif + } // Free vectors #if defined(USE_HIP) || defined(USE_CUDA) @@ -409,6 +475,26 @@ int main(int argc, char* argv[]) return 0; } +// ----------------------------------------------------------------------------- +// Dominant eigenvalue estimation function +// ----------------------------------------------------------------------------- + +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3) +{ + // Access problem data + UserData* udata = (UserData*)user_data; + + // Fill in spectral radius value + *lambdaR = -SUN_RCONST(8.0) * std::max(udata->kx / udata->dx / udata->dx, + udata->ky / udata->dy / udata->dy); + *lambdaI = SUN_RCONST(0.0); + + // return with success + return 0; +} + // ----------------------------------------------------------------------------- // UserOptions Helper functions // ----------------------------------------------------------------------------- @@ -445,6 +531,13 @@ int UserOptions::parse_args(vector& args, bool outproc) args.erase(it, it + 2); } + it = find(args.begin(), args.end(), "--explicitSTS"); + if (it != args.end()) + { + implicit = false; + args.erase(it); + } + it = find(args.begin(), args.end(), "--order"); if (it != args.end()) { @@ -452,6 +545,13 @@ int UserOptions::parse_args(vector& args, bool outproc) args.erase(it, it + 2); } + it = find(args.begin(), args.end(), "--lsrkmethod"); + if (it != args.end()) + { + lsrkmethod = (ARKODE_LSRKMethodType)stoi(*(it + 1)); + args.erase(it, it + 2); + } + it = find(args.begin(), args.end(), "--controller"); if (it != args.end()) { @@ -525,16 +625,22 @@ void UserOptions::help() cout << "Integrator command line options:" << endl; cout << " --rtol : relative tolerance" << endl; cout << " --atol : absolute tolerance" << endl; + cout << " --controller : time step adaptivity controller" << endl; + cout << " --fixedstep : used fixed step size" << endl; + cout << " --explicitSTS : use LSRKStep (instead of ARKStep)" << endl; + cout << endl; + cout << "Implicit (ARKStep) solver command line options:" << endl; cout << " --nonlinear : disable linearly implicit flag" << endl; cout << " --order : method order" << endl; - cout << " --fixedstep : used fixed step size" << endl; - cout << " --controller : time step adaptivity controller" << endl; cout << " --ls : linear solver" << endl; cout << " --lsinfo : output residual history" << endl; cout << " --liniters : max number of iterations" << endl; cout << " --epslin : linear tolerance factor" << endl; cout << " --noprec : disable preconditioner" << endl; cout << " --msbp : max steps between prec setups" << endl; + cout << endl; + cout << "Explicit STS (LSRKStep) solver command line options:" << endl; + cout << " --lsrkmethod : LSRK method choice" << endl; } // Print user options @@ -545,39 +651,57 @@ void UserOptions::print() cout << " --------------------------------- " << endl; cout << " rtol = " << rtol << endl; cout << " atol = " << atol << endl; - cout << " hfixed = " << hfixed << endl; - cout << " order = " << order << endl; cout << " controller = " << controller << endl; - cout << " max steps = " << maxsteps << endl; - cout << " linear RHS = " << linear << endl; + cout << " hfixed = " << hfixed << endl; cout << " --------------------------------- " << endl; - cout << endl; - if (ls == "sludist") + if (implicit) { - cout << " Linear solver options:" << endl; + cout << " ARKStep options:" << endl; cout << " --------------------------------- " << endl; + cout << " order = " << order << endl; + cout << " max steps = " << maxsteps << endl; + cout << " linear RHS = " << linear << endl; + cout << " --------------------------------- " << endl; + cout << endl; + if (ls == "sludist") + { + cout << " Linear solver options:" << endl; + cout << " --------------------------------- " << endl; #if defined(HAVE_HIP) - cout << " LS = SuperLU_DIST (HIP enabled)" << endl; + cout << " LS = SuperLU_DIST (HIP enabled)" << endl; #elif defined(HAVE_CUDA) - cout << " LS = SuperLU_DIST (CUDA enabled)" << endl; + cout << " LS = SuperLU_DIST (CUDA enabled)" << endl; #else - cout << " LS = SuperLU_DIST" << endl; + cout << " LS = SuperLU_DIST" << endl; #endif - cout << " LS info = " << lsinfo << endl; - cout << " msbp = " << msbp << endl; - cout << " --------------------------------- " << endl; + cout << " LS info = " << lsinfo << endl; + cout << " msbp = " << msbp << endl; + cout << " --------------------------------- " << endl; + } + else + { + cout << " Linear solver options:" << endl; + cout << " --------------------------------- " << endl; + cout << " LS = " << ls << endl; + cout << " precond = " << preconditioning << endl; + cout << " LS info = " << lsinfo << endl; + cout << " LS iters = " << liniters << endl; + cout << " msbp = " << msbp << endl; + cout << " epslin = " << epslin << endl; + cout << " --------------------------------- " << endl; + } } else { - cout << " Linear solver options:" << endl; + cout << " LSRKStep options:" << endl; cout << " --------------------------------- " << endl; - cout << " LS = " << ls << endl; - cout << " precond = " << preconditioning << endl; - cout << " LS info = " << lsinfo << endl; - cout << " LS iters = " << liniters << endl; - cout << " msbp = " << msbp << endl; - cout << " epslin = " << epslin << endl; + switch (lsrkmethod) + { + case (ARKODE_LSRK_RKC_2): cout << " method = RKC_2 " << endl; break; + case (ARKODE_LSRK_RKL_2): cout << " method = RKL_2 " << endl; break; + default: cout << " ERROR: illegal lsrkmethod " << endl; + } cout << " --------------------------------- " << endl; } } diff --git a/benchmarks/diffusion_2D/main_cvode.cpp b/benchmarks/diffusion_2D/main_cvode.cpp index 47420cdc98..2cb2e4579f 100644 --- a/benchmarks/diffusion_2D/main_cvode.cpp +++ b/benchmarks/diffusion_2D/main_cvode.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/main_ida.cpp b/benchmarks/diffusion_2D/main_ida.cpp index ccd86c7ad5..b02c62af8c 100644 --- a/benchmarks/diffusion_2D/main_ida.cpp +++ b/benchmarks/diffusion_2D/main_ida.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt b/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt index bedab66e97..4a73303be0 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt +++ b/benchmarks/diffusion_2D/mpi_gpu/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -67,7 +67,7 @@ foreach(test_tuple ${tests}) endif() - add_executable(${target} ${sources}) + sundials_add_executable(${target} ${sources}) # if("${backend}" STREQUAL "USE_CUDA") sundials_add_benchmark(${target} # ${target} diffusion_2D ENABLE_GPU NUM_CORES ${SUNDIALS_BENCHMARK_NUM_GPUS} ) diff --git a/benchmarks/diffusion_2D/mpi_gpu/buffers.cpp b/benchmarks/diffusion_2D/mpi_gpu/buffers.cpp index 06f3ea7943..456bd3cb6d 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/buffers.cpp +++ b/benchmarks/diffusion_2D/mpi_gpu/buffers.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_gpu/diffusion.cpp b/benchmarks/diffusion_2D/mpi_gpu/diffusion.cpp index bd3cbc2691..194279a59c 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/diffusion.cpp +++ b/benchmarks/diffusion_2D/mpi_gpu/diffusion.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_gpu/solution.cpp b/benchmarks/diffusion_2D/mpi_gpu/solution.cpp index 9dfcd3aa6e..17b4cbdd3d 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/solution.cpp +++ b/benchmarks/diffusion_2D/mpi_gpu/solution.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_gpu/utils.cpp b/benchmarks/diffusion_2D/mpi_gpu/utils.cpp index 7e6fc94444..66b4b5937b 100644 --- a/benchmarks/diffusion_2D/mpi_gpu/utils.cpp +++ b/benchmarks/diffusion_2D/mpi_gpu/utils.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt b/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt index a5cccdf1ed..c748d0224b 100644 --- a/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt +++ b/benchmarks/diffusion_2D/mpi_serial/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -41,7 +41,7 @@ foreach(test_tuple ${tests}) set(target ${package}_diffusion_2D_mpi) # create executable - add_executable(${target} ${sources}) + sundials_add_executable(${target} ${sources}) add_dependencies(benchmark ${target}) diff --git a/benchmarks/diffusion_2D/mpi_serial/buffers.cpp b/benchmarks/diffusion_2D/mpi_serial/buffers.cpp index a5448b8939..b3630fa991 100644 --- a/benchmarks/diffusion_2D/mpi_serial/buffers.cpp +++ b/benchmarks/diffusion_2D/mpi_serial/buffers.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_serial/diffusion.cpp b/benchmarks/diffusion_2D/mpi_serial/diffusion.cpp index 277267993b..1deb6be756 100644 --- a/benchmarks/diffusion_2D/mpi_serial/diffusion.cpp +++ b/benchmarks/diffusion_2D/mpi_serial/diffusion.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_serial/solution.cpp b/benchmarks/diffusion_2D/mpi_serial/solution.cpp index cd5dcbd1f9..cbdf0583ac 100644 --- a/benchmarks/diffusion_2D/mpi_serial/solution.cpp +++ b/benchmarks/diffusion_2D/mpi_serial/solution.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/mpi_serial/utils.cpp b/benchmarks/diffusion_2D/mpi_serial/utils.cpp index c6a3f40fc3..5b70223bbf 100644 --- a/benchmarks/diffusion_2D/mpi_serial/utils.cpp +++ b/benchmarks/diffusion_2D/mpi_serial/utils.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/diffusion_2D/preconditioner_jacobi.cpp b/benchmarks/diffusion_2D/preconditioner_jacobi.cpp index 8f41d7b947..153d7a9c0e 100644 --- a/benchmarks/diffusion_2D/preconditioner_jacobi.cpp +++ b/benchmarks/diffusion_2D/preconditioner_jacobi.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/CMakeLists.txt b/benchmarks/nvector/CMakeLists.txt index c728c59b96..88b938ac95 100644 --- a/benchmarks/nvector/CMakeLists.txt +++ b/benchmarks/nvector/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/cuda/CMakeLists.txt b/benchmarks/nvector/cuda/CMakeLists.txt index 2a6741fc40..1c4d168619 100644 --- a/benchmarks/nvector/cuda/CMakeLists.txt +++ b/benchmarks/nvector/cuda/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu index 8884555af2..4a444a7605 100644 --- a/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu +++ b/benchmarks/nvector/cuda/test_nvector_performance_cuda.cu @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/hip/CMakeLists.txt b/benchmarks/nvector/hip/CMakeLists.txt index f19d4df759..564a221e28 100644 --- a/benchmarks/nvector/hip/CMakeLists.txt +++ b/benchmarks/nvector/hip/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp index d3974bc749..83331a00b3 100644 --- a/benchmarks/nvector/hip/test_nvector_performance_hip.cpp +++ b/benchmarks/nvector/hip/test_nvector_performance_hip.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/kokkos/CMakeLists.txt b/benchmarks/nvector/kokkos/CMakeLists.txt index 2ca1539df0..dd50eb52ab 100644 --- a/benchmarks/nvector/kokkos/CMakeLists.txt +++ b/benchmarks/nvector/kokkos/CMakeLists.txt @@ -1,6 +1,6 @@ # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/kokkos/test_nvector_performance_kokkos.cpp b/benchmarks/nvector/kokkos/test_nvector_performance_kokkos.cpp index ac2d9910a2..2ecc7706d3 100644 --- a/benchmarks/nvector/kokkos/test_nvector_performance_kokkos.cpp +++ b/benchmarks/nvector/kokkos/test_nvector_performance_kokkos.cpp @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/mpiplusx/CMakeLists.txt b/benchmarks/nvector/mpiplusx/CMakeLists.txt index 6a1fd9c1f5..ff1683de9e 100644 --- a/benchmarks/nvector/mpiplusx/CMakeLists.txt +++ b/benchmarks/nvector/mpiplusx/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c b/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c index 1b4e5e949b..51142bb515 100644 --- a/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c +++ b/benchmarks/nvector/mpiplusx/test_nvector_performance_mpiplusx.c @@ -2,7 +2,7 @@ * Programmer(s): Cody J. Balos @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/openmp/CMakeLists.txt b/benchmarks/nvector/openmp/CMakeLists.txt index 0980bb8ef4..f7129de7ff 100644 --- a/benchmarks/nvector/openmp/CMakeLists.txt +++ b/benchmarks/nvector/openmp/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c index c5628bd7b3..5eccb88420 100644 --- a/benchmarks/nvector/openmp/test_nvector_performance_openmp.c +++ b/benchmarks/nvector/openmp/test_nvector_performance_openmp.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/openmpdev/CMakeLists.txt b/benchmarks/nvector/openmpdev/CMakeLists.txt index 54789c9a95..60869ae28b 100644 --- a/benchmarks/nvector/openmpdev/CMakeLists.txt +++ b/benchmarks/nvector/openmpdev/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -22,10 +22,9 @@ 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 - ../../../src/sundials/sundials_nvector.c) +sundials_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 diff --git a/benchmarks/nvector/openmpdev/test_nvector_performance_openmpdev.c b/benchmarks/nvector/openmpdev/test_nvector_performance_openmpdev.c index 7a942e7020..49d9c512f0 100644 --- a/benchmarks/nvector/openmpdev/test_nvector_performance_openmpdev.c +++ b/benchmarks/nvector/openmpdev/test_nvector_performance_openmpdev.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/parallel/CMakeLists.txt b/benchmarks/nvector/parallel/CMakeLists.txt index 87ed3138ba..81755d32e8 100644 --- a/benchmarks/nvector/parallel/CMakeLists.txt +++ b/benchmarks/nvector/parallel/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/parallel/test_nvector_performance_parallel.c b/benchmarks/nvector/parallel/test_nvector_performance_parallel.c index 94894ff1ce..305b5be80a 100644 --- a/benchmarks/nvector/parallel/test_nvector_performance_parallel.c +++ b/benchmarks/nvector/parallel/test_nvector_performance_parallel.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/parhyp/CMakeLists.txt b/benchmarks/nvector/parhyp/CMakeLists.txt index 216085064b..513082598a 100644 --- a/benchmarks/nvector/parhyp/CMakeLists.txt +++ b/benchmarks/nvector/parhyp/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c b/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c index b2bab65f0e..a2d721db14 100644 --- a/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c +++ b/benchmarks/nvector/parhyp/test_nvector_performance_parhyp.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/petsc/CMakeLists.txt b/benchmarks/nvector/petsc/CMakeLists.txt index fd9183593d..6ddcc47d0d 100644 --- a/benchmarks/nvector/petsc/CMakeLists.txt +++ b/benchmarks/nvector/petsc/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/petsc/test_nvector_performance_petsc.c b/benchmarks/nvector/petsc/test_nvector_performance_petsc.c index f90b4f4c46..775317185b 100644 --- a/benchmarks/nvector/petsc/test_nvector_performance_petsc.c +++ b/benchmarks/nvector/petsc/test_nvector_performance_petsc.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/plot_nvector_performance_results.py b/benchmarks/nvector/plot_nvector_performance_results.py index c5e9f69301..c66ae62e40 100755 --- a/benchmarks/nvector/plot_nvector_performance_results.py +++ b/benchmarks/nvector/plot_nvector_performance_results.py @@ -3,7 +3,7 @@ # Programmer(s): David J. Gardner @ LLNL # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/plot_nvector_performance_speedup.py b/benchmarks/nvector/plot_nvector_performance_speedup.py index baaaf43682..65813f4e30 100755 --- a/benchmarks/nvector/plot_nvector_performance_speedup.py +++ b/benchmarks/nvector/plot_nvector_performance_speedup.py @@ -3,7 +3,7 @@ # Programmer(s): David J. Gardner @ LLNL # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/pthreads/CMakeLists.txt b/benchmarks/nvector/pthreads/CMakeLists.txt index bc7cac35f2..a781126c27 100644 --- a/benchmarks/nvector/pthreads/CMakeLists.txt +++ b/benchmarks/nvector/pthreads/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c index 25da5d09b3..eb5b49e149 100644 --- a/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c +++ b/benchmarks/nvector/pthreads/test_nvector_performance_pthreads.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/raja/CMakeLists.txt b/benchmarks/nvector/raja/CMakeLists.txt index 9c37eb6d99..2ba5889213 100644 --- a/benchmarks/nvector/raja/CMakeLists.txt +++ b/benchmarks/nvector/raja/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/raja/test_nvector_performance_raja.cpp b/benchmarks/nvector/raja/test_nvector_performance_raja.cpp index 75cca0d74f..2d2b1ab68b 100644 --- a/benchmarks/nvector/raja/test_nvector_performance_raja.cpp +++ b/benchmarks/nvector/raja/test_nvector_performance_raja.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/serial/CMakeLists.txt b/benchmarks/nvector/serial/CMakeLists.txt index edac263500..8e6cfd977a 100644 --- a/benchmarks/nvector/serial/CMakeLists.txt +++ b/benchmarks/nvector/serial/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/serial/test_nvector_performance_serial.c b/benchmarks/nvector/serial/test_nvector_performance_serial.c index 8b16c3a829..a6bb545f16 100644 --- a/benchmarks/nvector/serial/test_nvector_performance_serial.c +++ b/benchmarks/nvector/serial/test_nvector_performance_serial.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/sycl/CMakeLists.txt b/benchmarks/nvector/sycl/CMakeLists.txt index b92c202b53..9d0080b9e4 100644 --- a/benchmarks/nvector/sycl/CMakeLists.txt +++ b/benchmarks/nvector/sycl/CMakeLists.txt @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp b/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp index 52b12e966f..b6220d515f 100644 --- a/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp +++ b/benchmarks/nvector/sycl/test_nvector_performance_sycl.cpp @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/benchmarks/nvector/test_nvector_performance.c b/benchmarks/nvector/test_nvector_performance.c index 36224a9c38..5cb3781dce 100644 --- a/benchmarks/nvector/test_nvector_performance.c +++ b/benchmarks/nvector/test_nvector_performance.c @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * @@ -43,7 +43,7 @@ static void time_stats(N_Vector X, double* times, int start, int ntimes, int print_time = 0; /* flag for printing timing data */ int nwarmups = 1; /* number of extra tests to perform and ignore in average */ -#if defined(SUNDIALS_HAVE_POSIX_TIMERS) && defined(_POSIX_TIMERS) +#if defined(SUNDIALS_HAVE_POSIX_TIMERS) time_t base_time_tv_sec = 0; /* Base time; makes time values returned by get_time easier to read when printed since they will be zero @@ -2723,7 +2723,7 @@ void SetNumWarmups(int num_warmups) void SetTiming(int onoff, int myid) { -#if defined(SUNDIALS_HAVE_POSIX_TIMERS) && defined(_POSIX_TIMERS) +#if defined(SUNDIALS_HAVE_POSIX_TIMERS) struct timespec spec; clock_gettime(CLOCK_MONOTONIC, &spec); base_time_tv_sec = spec.tv_sec; @@ -2812,7 +2812,7 @@ void rand_realtype_constraints(sunrealtype* data, sunindextype len) static double get_time(void) { double time; -#if defined(SUNDIALS_HAVE_POSIX_TIMERS) && defined(_POSIX_TIMERS) +#if defined(SUNDIALS_HAVE_POSIX_TIMERS) struct timespec spec; clock_gettime(CLOCK_MONOTONIC, &spec); time = (double)(spec.tv_sec - base_time_tv_sec) + diff --git a/benchmarks/nvector/test_nvector_performance.h b/benchmarks/nvector/test_nvector_performance.h index 74528b749d..a7a3893206 100644 --- a/benchmarks/nvector/test_nvector_performance.h +++ b/benchmarks/nvector/test_nvector_performance.h @@ -2,7 +2,7 @@ * Programmer(s): David J. Gardner @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start - * Copyright (c) 2002-2024, Lawrence Livermore National Security + * Copyright (c) 2002-2025, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * diff --git a/cmake/SUNDIALSConfig.cmake.in b/cmake/SUNDIALSConfig.cmake.in index a5f255f035..0e95338973 100644 --- a/cmake/SUNDIALSConfig.cmake.in +++ b/cmake/SUNDIALSConfig.cmake.in @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsBuildOptionsPost.cmake b/cmake/SundialsBuildOptionsPost.cmake index 6d05b9846e..9f71d66faf 100644 --- a/cmake/SundialsBuildOptionsPost.cmake +++ b/cmake/SundialsBuildOptionsPost.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsBuildOptionsPre.cmake b/cmake/SundialsBuildOptionsPre.cmake index 96e17ea087..9878943f63 100644 --- a/cmake/SundialsBuildOptionsPre.cmake +++ b/cmake/SundialsBuildOptionsPre.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -33,8 +33,9 @@ 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}) +set(SUNDIALS_PRECISION + "${_upper_SUNDIALS_PRECISION}" + CACHE STRING "${DOCSTR}" FORCE) # --------------------------------------------------------------- # Option to specify index type @@ -75,10 +76,10 @@ endif() # Option to enable/disable error checking # --------------------------------------------------------------- -if(CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo") - set(_default_err_checks OFF) -else() +if(CMAKE_BUILD_TYPE MATCHES "Debug") set(_default_err_checks ON) +else() + set(_default_err_checks OFF) endif() set(DOCSTR @@ -310,26 +311,85 @@ endif() # Options for SUNDIALS testing # --------------------------------------------------------------- +sundials_option(SUNDIALS_TEST_ENABLE_DEV_TESTS BOOL "Include development tests" + OFF ADVANCED) + +sundials_option(SUNDIALS_TEST_ENABLE_UNIT_TESTS BOOL "Include unit tests" OFF + ADVANCED) + +if(SUNDIALS_TEST_ENABLE_UNIT_TESTS) + set(_default_gtest ON) +else() + set(_default_gtest OFF) +endif() + +sundials_option(SUNDIALS_TEST_ENABLE_GTEST BOOL "Include GTest unit tests" + ${_default_gtest} ADVANCED) + +if(SUNDIALS_TEST_ENABLE_GTEST AND NOT SUNDIALS_TEST_ENABLE_UNIT_TESTS) + message( + FATAL_ERROR "Unit tests with Google test are enabled but unit tests are OFF" + ) +endif() + +if(SUNDIALS_TEST_ENABLE_UNIT_TESTS AND NOT SUNDIALS_TEST_ENABLE_GTEST) + message( + WARNING + "Unit tests are enabled but unit tests with Google test are OFF. Some " + "unit test will not be run.") +endif() + +if(SUNDIALS_TEST_ENABLE_DEV_TESTS OR SUNDIALS_TEST_ENABLE_UNIT_TESTS) + set(_default_diff_output ON) +else() + set(_default_diff_output OFF) +endif() + +sundials_option( + SUNDIALS_TEST_ENABLE_DIFF_OUTPUT BOOL + "Compare test output with saved answer files" ${_default_diff_output} + ADVANCED) + +if((SUNDIALS_TEST_ENABLE_DEV_TESTS OR SUNDIALS_TEST_ENABLE_UNIT_TESTS) + AND NOT SUNDIALS_TEST_ENABLE_DIFF_OUTPUT) + message( + WARNING "Development or unit tests are enabled but output comparison is OFF" + ) +endif() + sundials_option( SUNDIALS_TEST_FLOAT_PRECISION STRING - "Precision for floating point comparisons (number of digits)" "-1" ADVANCED) + "Precision for floating point comparisons (number of digits)" "4" ADVANCED) sundials_option( SUNDIALS_TEST_INTEGER_PRECISION STRING - "Precision for integer comparisons (percent difference)" "-1" ADVANCED) + "Precision for integer comparisons (percent difference)" "10" ADVANCED) -sundials_option(SUNDIALS_TEST_OUTPUT_DIR PATH - "Location to write testing output files" "" ADVANCED) +sundials_option( + SUNDIALS_TEST_OUTPUT_DIR PATH "Location to write test output files" + "${PROJECT_BINARY_DIR}/Testing/output" ADVANCED) -sundials_option(SUNDIALS_TEST_ANSWER_DIR PATH - "Location of testing answer files" "" ADVANCED) +sundials_option(SUNDIALS_TEST_ANSWER_DIR PATH "Location of test answer files" + "" ADVANCED) -sundials_option(SUNDIALS_TEST_PROFILE BOOL - "Use Caliper to profile SUNDIALS tests" OFF ADVANCED) +if(SUNDIALS_TEST_ENABLE_DIFF_OUTPUT AND NOT SUNDIALS_TEST_ANSWER_DIR) + message( + WARNING + "Test output comparison is enabled but an answer directory was not " + "supplied. Using the default answer files may produce erroneous test " + "failures due to hardware or round-off differences.") +endif() + +sundials_option(SUNDIALS_TEST_ENABLE_PROFILING BOOL "Profile tests" OFF + ADVANCED) sundials_option( - SUNDIALS_TEST_NODIFF BOOL - "Disable output comparison in the regression test suite" OFF ADVANCED) + SUNDIALS_TEST_CALIPER_OUTPUT_DIR PATH "Location to write test Caliper files" + "${PROJECT_BINARY_DIR}/Testing/caliper" ADVANCED) + +# --------------------------------------------------------------- +# Options for SUNDIALS testing with containers +# --------------------------------------------------------------- sundials_option(SUNDIALS_TEST_CONTAINER_EXE PATH "Path to docker or podman" "" ADVANCED) @@ -343,29 +403,31 @@ 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 unit tests in regression tests -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) +# --------------------------------------------------------------- +# Options for SUNDIALS development +# --------------------------------------------------------------- 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) +# --------------------------------------------------------------- +# Options for SUNDIALS benchmarks +# --------------------------------------------------------------- + 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_BENCHMARK_OUTPUT_DIR PATH "Location to write benchmark output files" + "${PROJECT_BINARY_DIR}/Benchmarking/output" ADVANCED) + +sundials_option( + SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR PATH + "Location to write benchmark caliper files" + "${PROJECT_BINARY_DIR}/Benchmarking/caliper" ADVANCED) sundials_option(SUNDIALS_BENCHMARK_NUM_CPUS STRING "Number of CPU cores to run benchmarks with" "40" ADVANCED) diff --git a/cmake/SundialsDeprecated.cmake b/cmake/SundialsDeprecated.cmake index 017e867c73..e123489ba2 100644 --- a/cmake/SundialsDeprecated.cmake +++ b/cmake/SundialsDeprecated.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -189,3 +189,64 @@ if(DEFINED CUDA_ARCH) CACHE STRING "CUDA Architectures" FORCE) unset(CUDA_ARCH) endif() + +# +# Deprecated Testing Options +# + +if(SUNDIALS_TEST_PROFILE) + message(DEPRECATION "The CMake option SUNDIALS_TEST_PROFILE is deprecated. " + "Use SUNDIALS_TEST_ENABLE_PROFILING instead.") + set(SUNDIALS_TEST_ENABLE_PROFILING + ${SUNDIALS_TEST_PROFILE} + CACHE BOOL "Profile tests" FORCE) + unset(SUNDIALS_TEST_PROFILE) +endif() + +if(SUNDIALS_TEST_NODIFF) + message(DEPRECATION "The CMake option SUNDIALS_TEST_NODIFF is deprecated. " + "Use SUNDIALS_TEST_ENABLE_DIFF_OUTPUT instead.") + if(SUNDIALS_TEST_NODIFF) + set(_new_value OFF) + else() + set(_new_value ON) + endif() + set(SUNDIALS_TEST_ENABLE_DIFF_OUTPUT + ${_new_value} + CACHE BOOL "Compare test output with saved answer files" FORCE) + unset(SUNDIALS_TEST_NODIFF) + unset(_new_value) +endif() + +if(SUNDIALS_TEST_DEVTESTS) + message(DEPRECATION "The CMake option SUNDIALS_TEST_DEVTESTS is deprecated. " + "Use SUNDIALS_TEST_ENABLE_DEV_TESTS instead.") + set(SUNDIALS_TEST_ENABLE_DEV_TESTS + ${SUNDIALS_TEST_DEVTESTS} + CACHE BOOL "Include development tests" FORCE) + unset(SUNDIALS_TEST_DEVTESTS) +endif() + +if(SUNDIALS_TEST_UNITTESTS) + message(DEPRECATION "The CMake option SUNDIALS_TEST_UNITTESTS is deprecated. " + "Use SUNDIALS_TEST_ENABLE_UNIT_TESTS instead.") + set(SUNDIALS_TEST_ENABLE_UNIT_TESTS + ${SUNDIALS_TEST_UNITTESTS} + CACHE BOOL "Include units tests" FORCE) + unset(SUNDIALS_TEST_UNITTESTS) +endif() + +if(SUNDIALS_CALIPER_OUTPUT_DIR) + message( + DEPRECATION + "The CMake option SUNDIALS_CALIPER_OUTPUT_DIR is deprecated. " + "Use SUNDIALS_TEST_CALIPER_OUTPUT_DIR and SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR instead." + ) + set(SUNDIALS_TEST_CALIPER_OUTPUT_DIR + ${SUNDIALS_TEST_CALIPER_OUTPUT_DIR} + CACHE PATH "Location to write test caliper files" FORCE) + set(SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR + ${SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR} + CACHE PATH "Location to write benchmark caliper files" FORCE) + unset(SUNDIALS_CALIPER_OUTPUT_DIR) +endif() diff --git a/cmake/SundialsExampleOptions.cmake b/cmake/SundialsExampleOptions.cmake index 8d54377bd6..4a848d0bfc 100644 --- a/cmake/SundialsExampleOptions.cmake +++ b/cmake/SundialsExampleOptions.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -55,7 +55,9 @@ if(BUILD_FORTRAN_MODULE_INTERFACE) WARNING "F2003 examples are not compatible with ${SUNDIALS_PRECISION} precision. " "Setting EXAMPLES_ENABLE_F2003 to OFF.") - force_variable(EXAMPLES_ENABLE_F2003 BOOL "${DOCSTR}" OFF) + set(EXAMPLES_ENABLE_F2003 + OFF + CACHE BOOL "${DOCSTR}" FORCE) endif() else() @@ -65,7 +67,9 @@ else() 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) + set(EXAMPLES_ENABLE_F2003 + OFF + CACHE BOOL "${DOCSTR}" FORCE) endif() endif() diff --git a/cmake/SundialsIndexSize.cmake b/cmake/SundialsIndexSize.cmake index f8f4836144..c9355f8720 100644 --- a/cmake/SundialsIndexSize.cmake +++ b/cmake/SundialsIndexSize.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # ----------------------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupBenchmarks.cmake b/cmake/SundialsSetupBenchmarks.cmake new file mode 100644 index 0000000000..0d49d68d5a --- /dev/null +++ b/cmake/SundialsSetupBenchmarks.cmake @@ -0,0 +1,55 @@ +# --------------------------------------------------------------- +# Programmer(s): David J. Gardner @ LLNL +# --------------------------------------------------------------- +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# --------------------------------------------------------------- +# Enable SUNDIALS Benchmarks +# --------------------------------------------------------------- + +# +# Check if the test runner is needed +# +if(NOT TESTRUNNER) + # 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 REQUIRED) + message(STATUS "Found testRunner: ${TESTRUNNER}") + set(TESTRUNNER + ${TESTRUNNER} + CACHE INTERNAL "") +endif() + +# Create the benchmark output directory +if(NOT EXISTS ${SUNDIALS_BENCHMARK_OUTPUT_DIR}) + file(MAKE_DIRECTORY ${SUNDIALS_BENCHMARK_OUTPUT_DIR}) +endif() +message(STATUS "Benchmark output directory: ${SUNDIALS_BENCHMARK_OUTPUT_DIR}") + +if(ENABLE_CALIPER) + message(STATUS "Enabled benchmark profiling with Caliper") + if(NOT EXISTS ${SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR}) + file(MAKE_DIRECTORY ${SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR}) + endif() + message( + STATUS + "Benchmark Caliper output directory: ${SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR}" + ) +endif() + +# +# Create `make benchmark` +# +add_custom_target(benchmark ${CMAKE_COMMAND} -E cmake_echo_color --cyan + "All benchmarks complete.") diff --git a/cmake/SundialsSetupCXX.cmake b/cmake/SundialsSetupCXX.cmake index 187e597d40..d52d35fe8e 100644 --- a/cmake/SundialsSetupCXX.cmake +++ b/cmake/SundialsSetupCXX.cmake @@ -3,7 +3,7 @@ # Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index aad26bdaf7..b8025a859f 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -79,26 +79,34 @@ endif() if(ENABLE_ALL_WARNINGS) message(STATUS "Enabling all compiler warnings") + # Some warning flags are not supported by all compilers so ignore unknown + # flags with -Wno-unknown-warning-option. Ironically, this is not supported by + # some compilers. + set(WARNING_FLAGS + "-Wno-unknown-warning-option -Wall -Wpedantic -Wextra -Wshadow \ +-Wwrite-strings -Wcast-align -Wdisabled-optimization -Wvla -Walloca \ +-Wduplicated-cond -Wduplicated-branches -Wunused-macros \ +-Wunused-local-typedefs") + # TODO(SBR): Try to add -Wredundant-decls once SuperLU version is updated in + # CI tests + # Avoid numerous warnings from printf if(SUNDIALS_PRECISION MATCHES "EXTENDED") - set(CMAKE_C_FLAGS "-Wdouble-promotion ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wdouble-promotion ${CMAKE_CXX_FLAGS}") + set(WARNING_FLAGS "-Wdouble-promotion ${WARNING_FLAGS}") endif() 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}") + set(WARNING_FLAGS "-Wconversion -Wno-sign-conversion ${WARNING_FLAGS}") endif() # Avoid numerous warnings from SWIG generated functions if(NOT BUILD_FORTRAN_MODULE_INTERFACE) - set(CMAKE_C_FLAGS "-Wmissing-declarations -Wcast-qual ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wmissing-declarations -Wcast-qual ${CMAKE_CXX_FLAGS}") + set(WARNING_FLAGS "-Wmissing-declarations -Wcast-qual ${WARNING_FLAGS}") endif() - set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wextra -Wshadow ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Wextra -Wshadow ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "${WARNING_FLAGS} ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${WARNING_FLAGS} ${CMAKE_CXX_FLAGS}") # TODO(DJG): Add -fcheck=all,no-pointer,no-recursion once Jenkins is updated # to use gfortran > 5.5 which segfaults with -fcheck=array-temps,bounds,do,mem @@ -125,18 +133,39 @@ if(ENABLE_WARNINGS_AS_ERRORS) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Werror") endif() +# With clang it is not possible to combine the -fsanitize=address and +# -fsanitize=memory checkers. + 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") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=address") +endif() + +if(ENABLE_MEMORY_SANITIZER) + message(STATUS "Enabling memory sanitizer") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=memory") +endif() + +if(ENABLE_LEAK_SANITIZER) + message(STATUS "Enabling leak sanitizer") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=leak") +endif() + +if(ENABLE_UNDEFINED_BEHAVIOR_SANITIZER) + message(STATUS "Enabling undefined behavior sanitizer") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=undefined") endif() if(SUNDIALS_DEBUG) @@ -393,7 +422,7 @@ endif() # =============================================================== if(BUILD_BENCHMARKS - OR SUNDIALS_TEST_UNITTESTS + OR SUNDIALS_TEST_ENABLE_UNIT_TESTS OR EXAMPLES_ENABLE_CXX OR ENABLE_CUDA OR ENABLE_HIP diff --git a/cmake/SundialsSetupConfig.cmake b/cmake/SundialsSetupConfig.cmake index 7000a90396..7a174d480e 100644 --- a/cmake/SundialsSetupConfig.cmake +++ b/cmake/SundialsSetupConfig.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupCuda.cmake b/cmake/SundialsSetupCuda.cmake index ef01d0faba..d8ff4e178a 100644 --- a/cmake/SundialsSetupCuda.cmake +++ b/cmake/SundialsSetupCuda.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -53,6 +53,15 @@ if((CMAKE_CXX_COMPILER_ID MATCHES GNU) endif() endif() +# =============================================================== +# Prohibit CUDA interface when using extended precision. +# =============================================================== + +if(SUNDIALS_PRECISION MATCHES "EXTENDED") + message( + FATAL_ERROR "CUDA interfaces are incompatible with extended precision.") +endif() + # =============================================================== # Enable CUDA lang and find the CUDA libraries. # =============================================================== diff --git a/cmake/SundialsSetupFortran.cmake b/cmake/SundialsSetupFortran.cmake index bdef010422..0cccae9be4 100644 --- a/cmake/SundialsSetupFortran.cmake +++ b/cmake/SundialsSetupFortran.cmake @@ -2,7 +2,7 @@ # Programmer(s): Radu Serban, David Gardner, Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupHIP.cmake b/cmake/SundialsSetupHIP.cmake index 709e335d55..4df9d02ccc 100644 --- a/cmake/SundialsSetupHIP.cmake +++ b/cmake/SundialsSetupHIP.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupTPLs.cmake b/cmake/SundialsSetupTPLs.cmake index d23bb95503..30685f5337 100644 --- a/cmake/SundialsSetupTPLs.cmake +++ b/cmake/SundialsSetupTPLs.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/SundialsSetupTesting.cmake b/cmake/SundialsSetupTesting.cmake index b261ffe385..c5563056b4 100644 --- a/cmake/SundialsSetupTesting.cmake +++ b/cmake/SundialsSetupTesting.cmake @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -17,164 +17,146 @@ # Enable testing with 'make test' include(CTest) -# Check if development tests are enabled -if(SUNDIALS_TEST_DEVTESTS OR BUILD_BENCHMARKS) +# +# Check if the test runner is needed +# +if(SUNDIALS_TEST_ENABLE_DIFF_OUTPUT OR (SUNDIALS_TEST_ENABLE_PROFILING + AND ENABLE_CALIPER)) + set(SUNDIALS_TEST_USE_RUNNER TRUE) # Python is needed to use the test runner find_package(Python3 REQUIRED) - - # look for the testRunner script in the test directory + # Look for the testRunner script in the test directory 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." - ) - endif() + NO_DEFAULT_PATH REQUIRED) message(STATUS "Found testRunner: ${TESTRUNNER}") set(TESTRUNNER ${TESTRUNNER} CACHE INTERNAL "") - +else() + set(SUNDIALS_TEST_USE_RUNNER FALSE) endif() -# Check if development tests are enabled -if(SUNDIALS_TEST_DEVTESTS) - - message("SUNDIALS Development testing") - - # Create the default test output directory - set(TEST_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Testing/output) - - if(NOT EXISTS ${TEST_OUTPUT_DIR}) - file(MAKE_DIRECTORY ${TEST_OUTPUT_DIR}) - endif() +# +# Print comparison settings +# +if(SUNDIALS_TEST_ENABLE_DIFF_OUTPUT) + message(STATUS "Enabled comparing test output with answer files") - # 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}") - if(NOT EXISTS ${SUNDIALS_TEST_OUTPUT_DIR}) - file(MAKE_DIRECTORY ${SUNDIALS_TEST_OUTPUT_DIR}) - endif() + # Create the test output directory + if(NOT EXISTS ${SUNDIALS_TEST_OUTPUT_DIR}) + file(MAKE_DIRECTORY ${SUNDIALS_TEST_OUTPUT_DIR}) endif() + message(STATUS "Test output directory: ${SUNDIALS_TEST_OUTPUT_DIR}") # 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 "Test answer directory: ${SUNDIALS_TEST_ANSWER_DIR}") if(NOT EXISTS ${SUNDIALS_TEST_ANSWER_DIR}) - message(FATAL_ERROR "SUNDIALS_TEST_ANSWER_DIR does not exist!") + message(FATAL_ERROR "${SUNDIALS_TEST_ANSWER_DIR} does not exist!") endif() endif() - # 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}" - ) - if(NOT EXISTS ${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}) - file(MAKE_DIRECTORY ${SUNDIALS_CALIPER_OUTPUT_DIR}/Example/${JOB_ID}) - endif() - endif() - - # 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}") - endif() + message( + STATUS + "Test float comparison precision (number of digits): ${SUNDIALS_TEST_FLOAT_PRECISION}" + ) + message( + STATUS + "Test integer comparison precision (percent difference): ${SUNDIALS_TEST_INTEGER_PRECISION}" + ) +endif() - if(SUNDIALS_TEST_INTEGER_PRECISION GREATER_EQUAL "0") - message( - STATUS - "Using non-default integer precision: ${SUNDIALS_TEST_INTEGER_PRECISION}" - ) +# +# Print Caliper profiling settings +# +if(SUNDIALS_TEST_ENABLE_PROFILING AND ENABLE_CALIPER) + message(STATUS "Enabled test profiling with Caliper") + if(NOT EXISTS ${SUNDIALS_TEST_CALIPER_OUTPUT_DIR}) + file(MAKE_DIRECTORY ${SUNDIALS_TEST_CALIPER_OUTPUT_DIR}) endif() + message( + STATUS "Test Caliper output directory: ${SUNDIALS_TEST_CALIPER_OUTPUT_DIR}") +endif() - # - # Target to run tests in CI containers - # - if(NOT SUNDIALS_TEST_CONTAINER_EXE) - find_program(container_exe docker) - 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) +# +# Target to run tests in CI containers +# +if(NOT SUNDIALS_TEST_CONTAINER_EXE) + find_program(container_exe docker) + 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) +endif() - if(SUNDIALS_TEST_CONTAINER_EXE) - add_custom_target(setup_local_ci ${CMAKE_COMMAND} -E cmake_echo_color - --cyan "Pulled SUNDIALS CI containers.") - +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( + 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( - 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_} - 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_}) - - 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_} - COMMENT "Running tests in CI container ${container}:${tag}" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND ${SUNDIALS_TEST_CONTAINER_EXE} ${container_exe_args} - VERBATIM) - add_dependencies(test_local_ci test_local_ci_${index_size}_${precision_}) - - unset(container) - unset(container_exe_args) - unset(container_test_exe) - unset(container_test_exe_args) - endmacro() - - add_local_ci_target(${SUNDIALS_INDEX_SIZE} ${SUNDIALS_PRECISION} latest) - endif() - + 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_}) + + 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_} + COMMENT "Running tests in CI container ${container}:${tag}" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND ${SUNDIALS_TEST_CONTAINER_EXE} ${container_exe_args} + VERBATIM) + add_dependencies(test_local_ci test_local_ci_${index_size}_${precision_}) + + unset(container) + unset(container_exe_args) + unset(container_test_exe) + unset(container_test_exe_args) + endmacro() + + add_local_ci_target(${SUNDIALS_INDEX_SIZE} ${SUNDIALS_PRECISION} latest) endif() -# Check if unit tests are enabled -if(SUNDIALS_TEST_UNITTESTS AND SUNDIALS_TEST_ENABLE_GTEST) +# +# Check if GTest is needed +# +if(SUNDIALS_TEST_ENABLE_GTEST) # find_package(GTest) if(NOT (TARGET GTest::gtest_main OR TARGET GTest::Main)) include(FetchContent) @@ -194,7 +176,9 @@ if(SUNDIALS_TEST_UNITTESTS AND SUNDIALS_TEST_ENABLE_GTEST) endif() endif() -# If examples are installed, create post install smoke test targets +# +# Create `make test_install` and `make test_install_all` +# if(EXAMPLES_INSTALL) # Directories for installation testing @@ -218,13 +202,3 @@ if(EXAMPLES_INSTALL) --cyan "All installation tests complete.") endif() - -# If benchmarks are enabled, set up `make benchmark` -if(BUILD_BENCHMARKS) - - message("SUNDIALS Benchmarking") - - # Create benchmark targets - 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 291709c8a8..c94d34b681 100644 --- a/cmake/SundialsTPLOptions.cmake +++ b/cmake/SundialsTPLOptions.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -70,12 +70,11 @@ sundials_option( sundials_option(ENABLE_LAPACK BOOL "Enable Lapack support" OFF) sundials_option(LAPACK_LIBRARIES STRING "Lapack and Blas libraries" - "${LAPACK_LIBRARIES}" DEPENDS_ON ENABLE_LAPACK) + "${LAPACK_LIBRARIES}") sundials_option( LAPACK_WORKS BOOL "Set to ON to force CMake to accept a given LAPACK configuration" OFF - DEPENDS_ON ENABLE_LAPACK ADVANCED) # --------------------------------------------------------------- @@ -84,7 +83,7 @@ sundials_option( 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) + "${Ginkgo_DIR}") sundials_option( SUNDIALS_GINKGO_BACKENDS @@ -96,7 +95,6 @@ sundials_option( sundials_option( GINKGO_WORKS BOOL "Set to ON to force CMake to accept a given Ginkgo configuration" OFF - DEPENDS_ON ENABLE_GINKGO ADVANCED) # --------------------------------------------------------------- @@ -105,7 +103,7 @@ sundials_option( 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) + "${MAGMA_DIR}") sundials_option( SUNDIALS_MAGMA_BACKENDS STRING @@ -116,9 +114,7 @@ sundials_option( sundials_option( MAGMA_WORKS BOOL - "Set to ON to force CMake to accept a given MAGMA configuration" OFF - DEPENDS_ON ENABLE_MAGMA - ADVANCED) + "Set to ON to force CMake to accept a given MAGMA configuration" OFF ADVANCED) # --------------------------------------------------------------- # Enable SuperLU_DIST support? @@ -127,30 +123,24 @@ 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) + "${SUPERLUDIST_DIR}") sundials_option( SUPERLUDIST_INCLUDE_DIRS PATH "SuperLU_DIST include directories" - "${SUPERLUDIST_INCLUDE_DIRS}" - DEPENDS_ON ENABLE_SUPERLUDIST - ADVANCED) + "${SUPERLUDIST_INCLUDE_DIRS}" ADVANCED) sundials_option( SUPERLUDIST_LIBRARIES STRING "Semi-colon separated list of libraries needed for SuperLU_DIST." - "${SUPERLUDIST_LIBRARIES}" - DEPENDS_ON ENABLE_SUPERLUDIST - ADVANCED) + "${SUPERLUDIST_LIBRARIES}" ADVANCED) sundials_option( SUPERLUDIST_OpenMP BOOL - "Enable SUNDIALS support for SuperLU_DIST OpenMP on-node parallelism" OFF - DEPENDS_ON ENABLE_SUPERLUDIST) + "Enable SUNDIALS support for SuperLU_DIST OpenMP on-node parallelism" OFF) sundials_option( SUPERLUDIST_WORKS BOOL "Set to ON to force CMake to accept a given SuperLU_DIST configuration" OFF - DEPENDS_ON ENABLE_SUPERLUDIST ADVANCED) # --------------------------------------------------------------- @@ -159,24 +149,22 @@ sundials_option( 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) + "${SUPERLUMT_INCLUDE_DIR}") sundials_option(SUPERLUMT_LIBRARY_DIR PATH "SuperLU_MT library directory" - "${SUPERLUMT_LIBRARY_DIR}" DEPENDS_ON ENABLE_SUPERLUMT) + "${SUPERLUMT_LIBRARY_DIR}") sundials_option( SUPERLUMT_LIBRARIES STRING "Semi-colon separated list of additional libraries needed for SuperLU_MT." - "${SUPERLUMT_LIBRARIES}" DEPENDS_ON ENABLE_SUPERLUMT) + "${SUPERLUMT_LIBRARIES}") -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") sundials_option( SUPERLUMT_WORKS BOOL "Set to ON to force CMake to accept a given SUPERLUMT configuration" OFF - DEPENDS_ON ENABLE_SUPERLUMT ADVANCED) # --------------------------------------------------------------- @@ -185,36 +173,31 @@ sundials_option( 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) + "${KLU_INCLUDE_DIR}") sundials_option(KLU_LIBRARY_DIR PATH "KLU library directory" - "${KLU_LIBRARY_DIR}" DEPENDS_ON ENABLE_KLU) + "${KLU_LIBRARY_DIR}") sundials_option( KLU_WORKS BOOL "Set to ON to force CMake to accept a given KLU configuration" - OFF - DEPENDS_ON ENABLE_KLU - ADVANCED) + OFF ADVANCED) # --------------------------------------------------------------- # Enable hypre support? # --------------------------------------------------------------- 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_DIR PATH "Path to hypre installation" "${HYPRE_DIR}") sundials_option(HYPRE_INCLUDE_DIR PATH "HYPRE include directory" - "${HYPRE_INCLUDE_DIR}" DEPENDS_ON ENABLE_HYPRE) + "${HYPRE_INCLUDE_DIR}") sundials_option(HYPRE_LIBRARY_DIR PATH "HYPRE library directory" - "${HYPRE_LIBRARY_DIR}" DEPENDS_ON ENABLE_HYPRE) + "${HYPRE_LIBRARY_DIR}") sundials_option( HYPRE_WORKS BOOL - "Set to ON to force CMake to accept a given hypre configuration" OFF - DEPENDS_ON ENABLE_HYPRE - ADVANCED) + "Set to ON to force CMake to accept a given hypre configuration" OFF ADVANCED) # --------------------------------------------------------------- # Enable PETSc support? @@ -223,36 +206,30 @@ sundials_option( 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) + "${PETSC_DIR}") sundials_option(PETSC_ARCH STRING "PETSc architecture (optional)" - "${PETSC_ARCH}" DEPENDS_ON ENABLE_PETSC) + "${PETSC_ARCH}") sundials_option( PETSC_LIBRARIES STRING "Semi-colon separated list of PETSc link libraries" - "${PETSC_LIBRARIES}" - DEPENDS_ON ENABLE_PETSC - ADVANCED) + "${PETSC_LIBRARIES}" ADVANCED) sundials_option( - PETSC_INCLUDES STRING "Semi-colon separated list of PETSc include directories" - "${PETSC_INCLUDES}" - DEPENDS_ON ENABLE_PETSC + PETSC_INCLUDES STRING + "Semi-colon separated list of PETSc include directories" "${PETSC_INCLUDES}" ADVANCED) sundials_option( PETSC_WORKS BOOL - "Set to ON to force CMake to accept a given PETSc configuration" OFF - DEPENDS_ON ENABLE_PETSC - ADVANCED) + "Set to ON to force CMake to accept a given PETSc configuration" OFF ADVANCED) # ------------------------------------------------------------- # Enable RAJA support? # ------------------------------------------------------------- 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(RAJA_DIR PATH "Path to root of RAJA installation" "${RAJA_DIR}") sundials_option( SUNDIALS_RAJA_BACKENDS STRING @@ -276,24 +253,20 @@ sundials_option(Trilinos_DIR PATH "Path to root of Trilinos installation" 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) + "${XBRAID_DIR}") sundials_option( XBRAID_LIBRARIES STRING "Semi-colon separated list of XBraid link libraries" - "${XBRAID_LIBRARIES}" - DEPENDS_ON ENABLE_XBRAID - ADVANCED) + "${XBRAID_LIBRARIES}" ADVANCED) sundials_option( XBRAID_INCLUDES STRING - "Semi-colon separated list of XBraid include directories" "${XBRAID_INCLUDES}" - DEPENDS_ON ENABLE_XBRAID - ADVANCED) + "Semi-colon separated list of XBraid include directories" + "${XBRAID_INCLUDES}" ADVANCED) sundials_option( XBRAID_WORKS BOOL "Set to ON to force CMake to accept a given XBraid configuration" OFF - DEPENDS_ON ENABLE_XBRAID ADVANCED) # ------------------------------------------------------------- @@ -303,12 +276,11 @@ sundials_option( 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) + "${ONEMKL_DIR}") 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( @@ -331,12 +303,11 @@ 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) + "${CALIPER_DIR}") sundials_option( CALIPER_WORKS BOOL "Set to ON to force CMake to accept a given CALIPER configuration" OFF - DEPENDS_ON ENABLE_CALIPER ADVANCED) # --------------------------------------------------------------- @@ -347,7 +318,7 @@ 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) + "${ADIAK_DIR}") # --------------------------------------------------------------- # Enable Kokkos support? @@ -361,7 +332,6 @@ sundials_option(Kokkos_DIR PATH "Path to the root of a Kokkos installation" sundials_option( KOKKOS_WORKS BOOL "Set to ON to force CMake to accept a given Kokkos configuration" OFF - DEPENDS_ON ENABLE_KOKKOS ADVANCED) # --------------------------------------------------------------- @@ -377,5 +347,4 @@ sundials_option( 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 f5352f2d29..631700a9e1 100644 --- a/cmake/macros/SundialsAddBenchmark.cmake +++ b/cmake/macros/SundialsAddBenchmark.cmake @@ -1,8 +1,8 @@ -# --------------------------------------------------------------- +# ------------------------------------------------------------------------------ # Programmer(s): Yu Pan @ LLNL -# --------------------------------------------------------------- +# ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -10,81 +10,89 @@ # # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMake macro for adding benchmarks to `make benchmark`. -# --------------------------------------------------------------- +# ------------------------------------------------------------------------------ -macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) +# ~~~ +# sundials_add_benchmark( +# [NUM_CORES cores] +# [BENCHMARK_ARGS args] +# [IDENTIFIER ident] +# [TEST_RUNNER_ARGS args] +# [ENABLE_GPU] +# ~~~ +# +# CMake function for adding benchmarks to `make benchmark`. +# +# The option NUM_CORES sets the number of cores (GPU count or CPU count) to run +# on/number of resource sets. +# +# The option BENCHMARK_ARGS sets the arguments to pass to the executable. +# +# The option IDENTIFIER sets the suffix to append to end of benchmark name +# +# The option TEST_RUNNER_ARGS sets the command line arguments to pass to the +# test executable +# +# The option ENABLE_GPU indicates this benchmark should be run with GPUs - # 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 - set(oneValueArgs NUM_CORES BENCHMARK_ARGS IDENTIFIER) +function(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) - # TEST_RUNNER_ARGS = command line arguments to pass to the test executable + set(oneValueArgs NUM_CORES BENCHMARK_ARGS IDENTIFIER) 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}) + # parse inputs and create variables arg_ + cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN}) # set the target name - if(sundials_add_benchmark_IDENTIFIER) - set(TARGET_NAME ${NAME}_${sundials_add_benchmark_IDENTIFIER}) + if(arg_IDENTIFIER) + set(TARGET_NAME ${NAME}_${arg_IDENTIFIER}) else() - if(sundials_add_benchmark_BENCHMARK_ARGS) - string(REPLACE " " "_" TEST_SUFFIX - "${sundials_add_benchmark_BENCHMARK_ARGS}") + if(arg_BENCHMARK_ARGS) + string(REPLACE " " "_" TEST_SUFFIX "${arg_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 - if(SUNDIALS_CALIPER_OUTPUT_DIR) - 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}) - endif() - - # make the caliper output directory if it doesn't exist - if(NOT EXISTS ${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${TARGET_NAME}) - file(MAKE_DIRECTORY ${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${TARGET_NAME}) - endif() - # make the the output directory if it doesn't exist - if(NOT EXISTS ${SUNDIALS_BENCHMARK_OUTPUT_DIR}/output) - file(MAKE_DIRECTORY ${SUNDIALS_BENCHMARK_OUTPUT_DIR}/output) + set(_output_dir + "${SUNDIALS_BENCHMARK_OUTPUT_DIR}/${BASE_BENCHMARK_NAME}/${TARGET_NAME}") + if(NOT EXISTS ${_output_dir}) + file(MAKE_DIRECTORY ${_output_dir}) endif() # 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") + "--verbose" "--executablename=$" + "--outputdir=${_output_dir}" "--nodiff") + + if(ENABLE_CALIPER) + set(_caliper_dir + "${SUNDIALS_BENCHMARK_CALIPER_OUTPUT_DIR}/${BASE_BENCHMARK_NAME}/${TARGET_NAME}" + ) + if(NOT EXISTS ${_caliper_dir}) + file(MAKE_DIRECTORY ${_caliper_dir}) + endif() + list(APPEND TEST_RUNNER_ARGS "--profile") + list(APPEND TEST_RUNNER_ARGS "--calidir=${_caliper_dir}") + endif() # 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" - ) + set(SCHEDULER_STRING " -n${arg_NUM_CORES}") elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "jsrun") - set(SCHEDULER_STRING " -n${sundials_add_benchmark_NUM_CORES} -a1 -c1") + if(${arg_ENABLE_GPU}) + set(SCHEDULER_STRING + " --smpiargs=\\\"-gpu\\\" -n${arg_NUM_CORES} -a1 -c1 -g1") + else() + set(SCHEDULER_STRING " -n${arg_NUM_CORES} -a1 -c1") + endif() elseif(SUNDIALS_SCHEDULER_COMMAND STREQUAL "srun") set(SCHEDULER_STRING - " -n${sundials_add_benchmark_NUM_CORES} --cpus-per-task=1 --ntasks-per-node=1" - ) + " -n${arg_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}") @@ -93,8 +101,7 @@ 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}" + list(APPEND TEST_RUNNER_ARGS "--runargs=${arg_BENCHMARK_ARGS}" "--testname=${TARGET_NAME}") add_custom_target( ${TARGET_NAME} @@ -102,4 +109,4 @@ macro(sundials_add_benchmark NAME EXECUTABLE BASE_BENCHMARK_NAME) COMMAND ${PYTHON_EXECUTABLE} ${TESTRUNNER} ${TEST_RUNNER_ARGS}) add_dependencies(benchmark ${TARGET_NAME}) -endmacro() +endfunction() diff --git a/cmake/macros/SundialsAddExamplesGinkgo.cmake b/cmake/macros/SundialsAddExamplesGinkgo.cmake index c723f68f29..d4d12b9639 100644 --- a/cmake/macros/SundialsAddExamplesGinkgo.cmake +++ b/cmake/macros/SundialsAddExamplesGinkgo.cmake @@ -2,7 +2,7 @@ # Programmer(s): David J. Gardner @ LLNL # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/macros/SundialsAddExecutable.cmake b/cmake/macros/SundialsAddExecutable.cmake index 00508c76b2..6b0f347425 100644 --- a/cmake/macros/SundialsAddExecutable.cmake +++ b/cmake/macros/SundialsAddExecutable.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -11,31 +11,25 @@ # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # --------------------------------------------------------------- -# CMake macro for adding executables. +# CMake function that wraps the add_executable command. +# +# It adds one extra single-value argument, SCALAR_TYPE. Otherwise +# this function behaves exactly as add_executable does. +# # --------------------------------------------------------------- -macro(sundials_add_nvector_benchmark NAME) +function(sundials_add_executable NAME) set(options) - set(singleValueArgs) - set(multiValueArgs SOURCES SUNDIALS_TARGETS LINK_LIBRARIES INSTALL_SUBDIR) + set(singleValueArgs SCALAR_TYPE) + set(multiValueArgs) 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}) - - set_target_properties(${NAME} PROPERTIES FOLDER "Benchmarks") - - target_include_directories(${NAME} PRIVATE ${BENCHMARKS_DIR}/nvector) - - target_link_libraries(${NAME} PRIVATE ${arg_SUNDIALS_TARGETS} - ${arg_LINK_LIBRARIES} -lm) - - install(TARGETS ${NAME} - DESTINATION "${BENCHMARKS_INSTALL_PATH}/${arg_INSTALL_SUBDIR}") + string(TOUPPER "${arg_SCALAR_TYPE}" _scalarUpper) + if(NOT _scalarUpper OR _scalarUpper STREQUAL SUNDIALS_SCALAR_TYPE) + add_executable(${NAME} ${arg_UNPARSED_ARGUMENTS}) + endif() -endmacro(sundials_add_nvector_benchmark) +endfunction() diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake index e3d0bb893d..9af64418c2 100644 --- a/cmake/macros/SundialsAddLibrary.cmake +++ b/cmake/macros/SundialsAddLibrary.cmake @@ -2,7 +2,7 @@ # Programmer(s): Cody J. Balos @ LLNL # --------------------------------------------------------------- # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # diff --git a/cmake/macros/SundialsAddNvectorBenchmark.cmake b/cmake/macros/SundialsAddNvectorBenchmark.cmake new file mode 100644 index 0000000000..aefca33a03 --- /dev/null +++ b/cmake/macros/SundialsAddNvectorBenchmark.cmake @@ -0,0 +1,41 @@ +# --------------------------------------------------------------- +# Programmer(s): Cody J. Balos @ LLNL +# --------------------------------------------------------------- +# SUNDIALS Copyright Start +# Copyright (c) 2002-2025, Lawrence Livermore National Security +# and Southern Methodist University. +# All rights reserved. +# +# See the top-level LICENSE and NOTICE files for details. +# +# SPDX-License-Identifier: BSD-3-Clause +# SUNDIALS Copyright End +# --------------------------------------------------------------- +# CMake macro for adding nvector benchmark executables. +# --------------------------------------------------------------- + +function(sundials_add_nvector_benchmark NAME) + + set(options) + set(singleValueArgs) + set(multiValueArgs SOURCES SUNDIALS_TARGETS LINK_LIBRARIES INSTALL_SUBDIR) + + 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}) + + set_target_properties(${NAME} PROPERTIES FOLDER "Benchmarks") + + target_include_directories(${NAME} PRIVATE ${BENCHMARKS_DIR}/nvector) + + target_link_libraries(${NAME} PRIVATE ${arg_SUNDIALS_TARGETS} + ${arg_LINK_LIBRARIES} -lm) + + install(TARGETS ${NAME} + DESTINATION "${BENCHMARKS_INSTALL_PATH}/${arg_INSTALL_SUBDIR}") + +endfunction(sundials_add_nvector_benchmark) diff --git a/cmake/macros/SundialsAddTest.cmake b/cmake/macros/SundialsAddTest.cmake index a1b491dc49..1e2f27e58c 100644 --- a/cmake/macros/SundialsAddTest.cmake +++ b/cmake/macros/SundialsAddTest.cmake @@ -2,7 +2,7 @@ # Programmer(s): Steven Smith and David J. Gardner @ LLNL # ------------------------------------------------------------------------------ # SUNDIALS Copyright Start -# Copyright (c) 2002-2024, Lawrence Livermore National Security +# Copyright (c) 2002-2025, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # @@ -21,7 +21,8 @@ # [ANSWER_DIR path] # [ANSWER_FIEL file] # [EXAMPLE_TYPE type] -# [TEST_ARGS arg1 arg2 ...]) +# [TEST_ARGS arg1 arg2 ...] +# [LABELS label1 label2 ...]) # ~~~ # # CMake macro to add a SUNDIALS regression test. Keyword input arguments can be @@ -46,14 +47,19 @@ # # 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 -# respectively). +# The option TEST_ARGS are command line arguments to pass to the executable # -# When SUNDIALS_TEST_DEVTESTS is ON the executable is run and its output is -# compared with the corresponding .out file. If the output differs significantly -# then the test fails. The default level of significance is 4 decimal places for -# floating point values and 10% for integer values. +# The options LABELS are labels added to the test properties to easily run (or +# exclude) groups of test with ctest -L