Joss paper #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (C) The DDC development team, see COPYRIGHT.md file | |
| # | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| name: Tests on Ubuntu | |
| # yamllint disable-line rule:truthy | |
| on: | |
| pull_request: | |
| paths: | |
| - '.github/workflows/tests-ubuntu.yaml' | |
| - '**.cpp' | |
| - '**.hpp' | |
| - '**.hpp.in' | |
| - 'CMakeLists.txt' | |
| - '**/CMakeLists.txt' | |
| - '**.cmake' | |
| - '**.cmake.in' | |
| - 'docker/**' | |
| - 'vendor/**' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/tests-ubuntu.yaml' | |
| - '**.cpp' | |
| - '**.hpp' | |
| - '**.hpp.in' | |
| - 'CMakeLists.txt' | |
| - '**/CMakeLists.txt' | |
| - '**.cmake' | |
| - '**.cmake.in' | |
| - 'docker/**' | |
| - 'vendor/**' | |
| concurrency: | |
| group: ${{github.workflow}}-${{github.ref == github.ref_protected && github.run_id || github.event.pull_request.number || github.ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jidicula/clang-format-action@v4.15.0 | |
| with: | |
| clang-format-version: '20' | |
| - name: Prefer 'if defined'/'if !defined' over 'ifdef'/'ifndef' | |
| run: if grep -RE "(ifdef|ifndef)" $(git ls-files '*.[ch]pp' ':!*/kokkos-kernels-ext/*'); then exit 1; fi | |
| - name: Do not include <iostream> in the headers of the library | |
| run: if grep -R "#include <iostream>" $(git ls-files 'include/*.[ch]pp'); then exit 1; fi | |
| - name: Find modifications of Kokkos reserved macros | |
| run: if grep -RE "(define|undef) KOKKOS_" $(git ls-files '*.[ch]pp'); then exit 1; fi | |
| id_repo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Identify repository | |
| id: identify_repo | |
| run: | | |
| echo "in_base_repo=${{(github.event_name == 'push' && github.repository == 'CExA-project/ddc') || github.event.pull_request.head.repo.full_name == 'CExA-project/ddc'}}" >> "$GITHUB_OUTPUT" | |
| outputs: {in_base_repo: '${{steps.identify_repo.outputs.in_base_repo}}'} | |
| docker-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ['oldest', 'latest'] | |
| backend: ['cpu', 'cuda', 'hip'] | |
| needs: id_repo | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: {tool-cache: true, large-packages: false} | |
| - name: Checkout built branch | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{github.actor}} | |
| password: ${{secrets.GITHUB_TOKEN}} | |
| - name: Build | |
| run: | | |
| DOCKER_BUILDKIT=1 docker build \ | |
| --build-arg BACKEND=${{matrix.backend}} \ | |
| --build-arg BUILDKIT_INLINE_CACHE=1 \ | |
| --cache-from ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \ | |
| -t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} \ | |
| -t ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}}:${GITHUB_SHA:0:7} \ | |
| docker/${{matrix.image}} | |
| - name: Publish image for current SHA | |
| if: needs.id_repo.outputs.in_base_repo == 'true' | |
| run: | | |
| docker push ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}}:${GITHUB_SHA:0:7} | |
| - name: Publish latest (default) image | |
| if: github.event_name == 'push' && github.ref_name == 'main' && needs.id_repo.outputs.in_base_repo == 'true' | |
| run: | | |
| docker push ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} | |
| - name: Create image tarball | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| run: | | |
| docker save ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}}:${GITHUB_SHA:0:7} > ${{matrix.image}}_${{matrix.backend}}.tar | |
| - name: Generate docker artifact from image | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{matrix.image}}_${{matrix.backend}}-artifact | |
| path: ${{matrix.image}}_${{matrix.backend}}.tar | |
| retention-days: 1 | |
| test: | |
| if: github.ref_name != 'main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ['oldest', 'latest'] | |
| backend: | |
| - name: 'cpu' | |
| c_compiler: 'gcc' | |
| cxx_compiler: 'g++' | |
| ddc_extra_cxx_flags: '-Wextra-semi -Wold-style-cast' | |
| kokkos_extra_cmake_flags: '' | |
| - name: 'cpu' | |
| c_compiler: 'clang' | |
| cxx_compiler: 'clang++' | |
| ddc_extra_cxx_flags: '-Wextra-semi -Wextra-semi-stmt -Wold-style-cast' | |
| kokkos_extra_cmake_flags: '' | |
| - name: 'cuda' | |
| c_compiler: '${CUDA_GCC}' | |
| cxx_compiler: '${CUDA_GXX}' | |
| ddc_extra_cxx_flags: '' | |
| kokkos_extra_cmake_flags: '-DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_CONSTEXPR=ON -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ARCH_AMPERE80=ON' | |
| - name: 'hip' | |
| c_compiler: 'hipcc' | |
| cxx_compiler: 'hipcc' | |
| ddc_extra_cxx_flags: '' | |
| kokkos_extra_cmake_flags: '-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ENABLE_ROCTHRUST=OFF -DKokkos_ARCH_AMD_GFX90A=ON' | |
| cxx_version: ['17', '20', '23'] | |
| cmake_build_type: ['Debug', 'Release'] | |
| exclude: | |
| - image: 'oldest' # nvcc 11 only supports C++-17 | |
| backend: | |
| name: 'cuda' | |
| cxx_version: '20' | |
| - image: 'oldest' # nvcc 11 only supports C++-17 | |
| backend: | |
| name: 'cuda' | |
| cxx_version: '23' | |
| - image: 'oldest' # clang bug with multidimensional bracket operator and parameter packs | |
| backend: | |
| name: 'hip' | |
| cxx_version: '23' | |
| - image: 'latest' # nvcc 12 only supports C++-20 | |
| backend: | |
| name: 'cuda' | |
| cxx_version: '23' | |
| runs-on: ubuntu-latest | |
| needs: [docker-build, id_repo] | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: {tool-cache: true, large-packages: false} | |
| - name: Checkout built branch | |
| uses: actions/checkout@v4 | |
| with: {submodules: true} | |
| - name: Collect image artifact | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: | | |
| ${{matrix.image}}_${{matrix.backend.name}}-artifact | |
| - name: Load image artifact into docker | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| run: | | |
| docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| rm ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| - name: Test | |
| id: test | |
| run: | | |
| cat<<-'EOF' > run.sh | |
| set -xe | |
| git config --global --add safe.directory '*' | |
| export benchmark_ROOT=$PWD/opt/benchmark | |
| export DDC_ROOT=$PWD/opt/ddc | |
| export GTest_ROOT=$PWD/opt/gtest | |
| export Kokkos_ROOT=$PWD/opt/kokkos | |
| export KokkosFFT_ROOT=$PWD/opt/kokkos-fft | |
| export KokkosKernels_ROOT=$PWD/opt/kokkos-kernels | |
| export CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| export CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} | |
| export CC=${{matrix.backend.c_compiler}} | |
| export CXX=${{matrix.backend.cxx_compiler}} | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DBENCHMARK_ENABLE_GTEST_TESTS=OFF \ | |
| -DBENCHMARK_ENABLE_TESTING=OFF \ | |
| -DBENCHMARK_INSTALL_DOCS=OFF \ | |
| -DBENCHMARK_USE_BUNDLED_GTEST=OFF \ | |
| -B build \ | |
| -S /src/vendor/benchmark | |
| cmake --build build | |
| cmake --install build --prefix $benchmark_ROOT | |
| rm -rf build | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -B build \ | |
| -S /src/vendor/googletest | |
| cmake --build build | |
| cmake --install build --prefix $GTest_ROOT | |
| rm -rf build | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ | |
| -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ | |
| -DKokkos_ENABLE_SERIAL=ON \ | |
| ${{matrix.backend.kokkos_extra_cmake_flags}} \ | |
| -B build \ | |
| -S /src/vendor/kokkos | |
| cmake --build build | |
| cmake --install build --prefix $Kokkos_ROOT | |
| rm -rf build | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DKokkosFFT_ENABLE_HOST_AND_DEVICE=ON \ | |
| -B build \ | |
| -S /src/vendor/kokkos-fft | |
| cmake --build build | |
| cmake --install build --prefix $KokkosFFT_ROOT | |
| rm -rf build | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DKokkosKernels_ADD_DEFAULT_ETI=OFF \ | |
| -DKokkosKernels_ENABLE_ALL_COMPONENTS=OFF \ | |
| -DKokkosKernels_ENABLE_COMPONENT_BLAS=ON \ | |
| -DKokkosKernels_ENABLE_COMPONENT_BATCHED=ON \ | |
| -DKokkosKernels_ENABLE_COMPONENT_LAPACK=OFF \ | |
| -DKokkosKernels_ENABLE_TPL_BLAS=OFF \ | |
| -DKokkosKernels_ENABLE_TPL_CUSOLVER=OFF \ | |
| -DKokkosKernels_ENABLE_TPL_LAPACK=OFF \ | |
| -B build \ | |
| -S /src/vendor/kokkos-kernels | |
| cmake --build build | |
| cmake --install build --prefix $KokkosKernels_ROOT | |
| rm -rf build | |
| cmake \ | |
| -DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -pedantic-errors ${{matrix.backend.ddc_extra_cxx_flags}}" \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DDDC_BUILD_BENCHMARKS=ON \ | |
| -DDDC_benchmark_DEPENDENCY_POLICY=INSTALLED \ | |
| -DDDC_GTest_DEPENDENCY_POLICY=INSTALLED \ | |
| -DDDC_Kokkos_DEPENDENCY_POLICY=INSTALLED \ | |
| -DDDC_KokkosFFT_DEPENDENCY_POLICY=INSTALLED \ | |
| -B build \ | |
| -S /src | |
| cmake --build build | |
| if [ 'xcpu' = 'x${{matrix.backend.name}}' ] | |
| then | |
| ctest --test-dir build --output-on-failure --timeout 10 --output-junit tests.xml | |
| cp build/tests.xml . | |
| ./build/examples/characteristics_advection | |
| ./build/examples/game_of_life | |
| ./build/examples/heat_equation_spectral | |
| ./build/examples/heat_equation | |
| ./build/examples/non_uniform_heat_equation | |
| ./build/examples/uniform_heat_equation | |
| fi | |
| cmake --install build --prefix $DDC_ROOT | |
| rm -rf build | |
| cmake \ | |
| -B build \ | |
| -S /src/install_test | |
| cmake --build build | |
| EOF | |
| docker run \ | |
| --cidfile='docker.cid' \ | |
| --volume ${PWD}:/src:ro \ | |
| ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}}:${GITHUB_SHA:0:7} \ | |
| bash /src/run.sh | |
| if docker cp "$(cat docker.cid)":/data/tests.xml ${{github.workspace}}/tests.xml | |
| then echo "with_report=true" >> "$GITHUB_OUTPUT" | |
| else echo "with_report=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: ( success() || failure() ) && steps.test.outputs.with_report == 'true' # always run even if the previous step fails | |
| with: | |
| report_paths: '${{github.workspace}}/tests.xml' | |
| test-with-sanitizer: | |
| if: github.ref_name != 'main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ['latest'] | |
| backend: | |
| - name: 'cpu' | |
| c_compiler: 'gcc' | |
| cxx_compiler: 'g++' | |
| cxx_version: ['17'] | |
| cmake_build_type: ['Debug'] | |
| sanitizer: ['address', 'undefined'] | |
| runs-on: ubuntu-latest | |
| needs: [docker-build, id_repo] | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: {tool-cache: true, large-packages: false} | |
| - name: Checkout built branch | |
| uses: actions/checkout@v4 | |
| with: {submodules: true} | |
| - name: Collect image artifact | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: | | |
| ${{matrix.image}}_${{matrix.backend.name}}-artifact | |
| - name: Load image artifact into docker | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| run: | | |
| docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| rm ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| - name: Generate undefined sanitizer environment | |
| if: ${{matrix.sanitizer}} == 'undefined' | |
| run: | | |
| cat<<-'UBSAN_SUPP_EOF' > ubsan.supp | |
| vptr:ginkgo/core/solver/solver_base.hpp | |
| UBSAN_SUPP_EOF | |
| cat<<-'SANITIZER_ENV_EOF' > sanitizer_env.sh | |
| export UBSAN_OPTIONS=print_stacktrace=1,halt_on_error=1,suppressions=/src/ubsan.supp | |
| SANITIZER_ENV_EOF | |
| - name: Test | |
| id: test | |
| run: | | |
| cat<<-'EOF' > run.sh | |
| set -xe | |
| git config --global --add safe.directory '*' | |
| export CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| export CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} | |
| export CC=${{matrix.backend.c_compiler}} | |
| export CXX=${{matrix.backend.cxx_compiler}} | |
| cmake \ | |
| -DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}} -fno-omit-frame-pointer" \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DDDC_BUILD_BENCHMARKS=ON \ | |
| -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ | |
| -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ | |
| -B build \ | |
| -S /src | |
| cmake --build build | |
| if [ -f /src/sanitizer_env.sh ]; | |
| then | |
| . /src/sanitizer_env.sh | |
| fi | |
| ctest --test-dir build --output-on-failure --timeout 10 --output-junit tests.xml | |
| cp build/tests.xml . | |
| ./build/examples/characteristics_advection | |
| ./build/examples/game_of_life | |
| ./build/examples/heat_equation_spectral | |
| ./build/examples/heat_equation | |
| ./build/examples/non_uniform_heat_equation | |
| ./build/examples/uniform_heat_equation | |
| EOF | |
| docker run \ | |
| --cidfile='docker.cid' \ | |
| -v ${PWD}:/src:ro \ | |
| ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}}:${GITHUB_SHA:0:7} \ | |
| bash /src/run.sh | |
| if docker cp "$(cat docker.cid)":/data/tests.xml ${{github.workspace}}/tests.xml | |
| then echo "with_report=true" >> "$GITHUB_OUTPUT" | |
| else echo "with_report=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: ( success() || failure() ) && steps.test.outputs.with_report == 'true' # always run even if the previous step fails | |
| with: | |
| report_paths: '${{github.workspace}}/tests.xml' | |
| clang-tidy-test: | |
| if: github.ref_name != 'main' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: ['latest'] | |
| backend: | |
| - name: 'cpu' | |
| c_compiler: 'clang' | |
| cxx_compiler: 'clang++' | |
| cxx_version: ['17'] | |
| cmake_build_type: ['Release'] | |
| runs-on: ubuntu-latest | |
| needs: [docker-build, id_repo] | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: {tool-cache: true, large-packages: false} | |
| - name: Checkout built branch | |
| uses: actions/checkout@v4 | |
| with: {submodules: true} | |
| - name: Collect image artifact | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: | | |
| ${{matrix.image}}_${{matrix.backend.name}}-artifact | |
| - name: Load image artifact into docker | |
| if: needs.id_repo.outputs.in_base_repo == 'false' | |
| run: | | |
| docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| rm ${{matrix.image}}_${{matrix.backend.name}}.tar | |
| - name: clang-tidy | |
| run: | | |
| cat<<-'EOF' > run.sh | |
| set -xe | |
| git config --global --add safe.directory '*' | |
| export CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| export CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} | |
| export CC=${{matrix.backend.c_compiler}} | |
| export CXX=${{matrix.backend.cxx_compiler}} | |
| cmake \ | |
| -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DDDC_BUILD_BENCHMARKS=ON \ | |
| -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ | |
| -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ | |
| -B build \ | |
| -S /src | |
| find /src/benchmarks /src/examples /src/tests -name '*.cpp' -exec clang-tidy -p build -header-filter="(/src/include/ddc/.*|/src/tests/.*)" '{}' '+' | |
| EOF | |
| docker run \ | |
| -v ${PWD}:/src:ro \ | |
| ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend.name}}:${GITHUB_SHA:0:7} \ | |
| bash /src/run.sh |