Additional comments and changed variable names in heat equation example #1073
Workflow file for this run
This file contains 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
name: test | |
on: | |
push: { branches: [ main ] } | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: DoozyX/[email protected] | |
with: | |
source: 'include/ddc/ tests/ examples/' | |
exclude: '' | |
extensions: 'hpp,cpp' | |
clangFormatVersion: 12 | |
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'] | |
exclude: | |
- image: 'oldest' | |
backend: 'cuda' | |
needs: id_repo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/[email protected] | |
with: { tool-cache: true, large-packages: false } | |
- name: Checkout built branch | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin || true | |
docker pull ghcr.io/cexa-project/ddc/${{matrix.image}}_${{matrix.backend}} || true | |
docker build \ | |
--build-arg BACKEND=${{matrix.backend}} \ | |
--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@v3 | |
with: | |
name: ${{matrix.image}}_${{matrix.backend}}-artifact | |
path: ${{matrix.image}}_${{matrix.backend}}.tar | |
retention-days: 1 | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
image: ['oldest', 'latest'] | |
backend: ['cpu-gcc', 'cpu-clang', 'cuda', 'hip'] | |
cxx_version: ['17', '20', '23'] | |
cmake_build_type: ['Debug', 'Release'] | |
exclude: | |
- image: 'oldest' # image not available | |
backend: 'cuda' | |
- image: 'oldest' # no compiler supports C++-23 in oldest | |
cxx_version: '23' | |
- image: 'oldest' # clang does not support C++-20 in oldest | |
backend: 'cpu-clang' | |
cxx_version: '20' | |
- image: 'latest' # nvcc only supports C++-17 | |
backend: 'cuda' | |
cxx_version: '20' | |
- image: 'latest' # nvcc only supports C++-17 | |
backend: 'cuda' | |
cxx_version: '23' | |
runs-on: ubuntu-latest | |
needs: [docker-build, id_repo] | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/[email protected] | |
with: { tool-cache: true, large-packages: false } | |
- name: Checkout built branch | |
uses: actions/checkout@v3 | |
with: { submodules: recursive } | |
- name: Collect image artifact | |
if: needs.id_repo.outputs.in_base_repo == 'false' | |
uses: actions/download-artifact@v3 | |
with: | |
name: | | |
${{matrix.image}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}-artifact | |
- name: Load image artifact into docker | |
if: needs.id_repo.outputs.in_base_repo == 'false' | |
run: | | |
docker load < ${{matrix.image}}_${{fromJSON('{"gcc":"cpu","clang":"cpu"}')[matrix.backend] || matrix.backend}}.tar | |
rm ${{matrix.image}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}.tar | |
- name: Test | |
id: test | |
run: | | |
cat<<-'EOF' > run.sh | |
set -xe | |
git config --global --add safe.directory '*' | |
case "${{matrix.backend}}" in | |
'cuda') | |
export CC=${CUDA_GCC} | |
export CXX=${CUDA_GXX} | |
EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON -DKokkos_ENABLE_LIBDL=OFF" | |
;; | |
'hip') | |
export CC=hipcc | |
export CXX=hipcc | |
EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON -DCMAKE_PREFIX_PATH=/opt/rocm" | |
CMAKE_CXX_FLAGS="-Wno-gnu-zero-variadic-macro-arguments" | |
;; | |
'cpu-clang') | |
export CC=clang | |
export CXX=clang++ | |
CMAKE_CXX_FLAGS="-Wno-gnu-zero-variadic-macro-arguments" | |
;; | |
'cpu-gcc') | |
export CC=gcc | |
export CXX=g++ | |
if [ 'xDebug' = 'x${{matrix.cmake_build_type}}' ] | |
then | |
CMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address" | |
fi | |
;; | |
esac | |
cmake \ | |
-DBUILD_BENCHMARKS=ON \ | |
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \ | |
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ | |
-DMDSPAN_CXX_STANDARD=${{matrix.cxx_version}} \ | |
-DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ | |
-DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ | |
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ | |
-DCMAKE_CXX_FLAGS="\ | |
-Wall -Wextra -Wpedantic \ | |
-Werror=vla \ | |
-Werror=implicit-fallthrough \ | |
${CMAKE_CXX_FLAGS}" \ | |
${EXTRA_CMAKE_FLAGS} \ | |
/src | |
make -j 2 | |
case "${{matrix.backend}}" in | |
'cpu-'*) | |
ctest -j 2 --output-on-failure --timeout 5 --output-junit tests.xml | |
;; | |
esac | |
EOF | |
docker run \ | |
--cidfile='docker.cid' \ | |
-v ${PWD}:/src:ro \ | |
ghcr.io/cexa-project/ddc/${{matrix.image}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}:${GITHUB_SHA:0:7} \ | |
bash /src/run.sh | |
if docker cp "$(cat docker.cid)":/data/tests.xml /home/runner/work/ddc/ddc/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@v3 | |
if: ( success() || failure() ) && steps.test.outputs.with_report == 'true' # always run even if the previous step fails | |
with: | |
report_paths: '/home/runner/work/ddc/ddc/tests.xml' | |
clang-tidy-test: | |
runs-on: ubuntu-latest | |
needs: [docker-build, id_repo] | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/[email protected] | |
with: { tool-cache: true, large-packages: false } | |
- name: Checkout built branch | |
uses: actions/checkout@v3 | |
with: { submodules: recursive } | |
- name: Collect image artifact | |
if: needs.id_repo.outputs.in_base_repo == 'false' | |
uses: actions/download-artifact@v3 | |
with: { name: 'latest_cpu-artifact' } | |
- name: Load image artifact into docker | |
if: needs.id_repo.outputs.in_base_repo == 'false' | |
run: | | |
docker load < latest_cpu-artifact.tar | |
rm latest_cpu-artifact.tar | |
- name: clang-tidy | |
run: | | |
cat<<-'EOF' > run.sh | |
set -xe | |
git config --global --add safe.directory '*' | |
cmake \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
-DBUILD_BENCHMARKS=ON \ | |
-DBUILD_TESTING=ON \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_CXX_STANDARD=17 \ | |
-DMDSPAN_CXX_STANDARD=17 \ | |
-DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ | |
-DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ | |
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ | |
-S /src \ | |
-B build | |
find /src/benchmarks /src/examples /src/tests -name '*.cpp' -exec clang-tidy-14 -p build -header-filter="(/src/include/ddc/.*|/src/tests/.*)" '{}' '+' | |
EOF | |
docker run \ | |
-v ${PWD}:/src:ro ghcr.io/cexa-project/ddc/latest_cpu:${GITHUB_SHA:0:7} \ | |
bash /src/run.sh |