Skip to content

Commit

Permalink
Rework main job simplifying bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Jan 3, 2025
1 parent 5b1cd46 commit 6722e64
Showing 1 changed file with 68 additions and 70 deletions.
138 changes: 68 additions & 70 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,45 @@ jobs:
fail-fast: false
matrix:
image: ['oldest', 'latest']
backend: ['cpu-gcc', 'cpu-clang', 'cuda', 'hip']
cxx_version: ['17', '20', '23']
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: 'cuda'
backend:
name: 'cuda'
cxx_version: '20'
- image: 'oldest' # nvcc 11 only supports C++-17
backend: 'cuda'
backend:
name: 'cuda'
cxx_version: '23'
- image: 'oldest' # clang bug with multidimensional bracket operator and parameter packs
backend: 'hip'
backend:
name: 'hip'
cxx_version: '23'
- image: 'latest' # nvcc 12 only supports C++-20
backend: 'cuda'
backend:
name: 'cuda'
cxx_version: '23'
runs-on: ubuntu-20.04
needs: [docker-build, id_repo]
Expand All @@ -144,12 +168,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: |
${{matrix.image}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}-artifact
${{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}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}.tar
rm ${{matrix.image}}_${{fromJSON('{"cpu-gcc":"cpu","cpu-clang":"cpu"}')[matrix.backend] || matrix.backend}}.tar
docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar
rm ${{matrix.image}}_${{matrix.backend.name}}.tar
- name: Test
id: test
run: |
Expand All @@ -164,80 +188,60 @@ jobs:
export KokkosFFT_ROOT=$PWD/opt/kokkos-fft
export KokkosKernels_ROOT=$PWD/opt/kokkos-kernels
case "${{matrix.backend}}" in
'cuda')
export CC=${CUDA_GCC}
export CXX=${CUDA_GXX}
EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_CONSTEXPR=ON -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ARCH_AMPERE80=ON"
;;
'hip')
export CC=hipcc
export CXX=hipcc
EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ENABLE_ROCTHRUST=OFF -DKokkos_ARCH_AMD_GFX90A=ON"
;;
'cpu-clang')
export CC=clang
export CXX=clang++
DDC_CMAKE_CXX_FLAGS="-Wextra-semi -Wextra-semi-stmt -Wold-style-cast"
;;
'cpu-gcc')
export CC=gcc
export CXX=g++
DDC_CMAKE_CXX_FLAGS="-Wextra-semi -Wold-style-cast"
if [ 'xDebug' = 'x${{matrix.cmake_build_type}}' ]
then
DDC_CMAKE_CXX_FLAGS="${DDC_CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address"
fi
;;
esac
export CMAKE_BUILD_PARALLEL_LEVEL=2
export CMAKE_BUILD_TYPE=${{matrix.cmake_build_type}}
export CC=${{matrix.backend.c_compiler}}
export CXX=${{matrix.backend.cxx_compiler}}
export DDC_CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -pedantic-errors ${{matrix.backend.ddc_extra_cxx_flags}}"
if [ 'xcpu-g++-Debug' = 'x${{matrix.backend.name}}-${{matrix.backend.cxx_compiler}}-${{matrix.cmake_build_type}}' ]
then
export DDC_CXXFLAGS="$DDC_CXXFLAGS -fno-omit-frame-pointer -fsanitize=address"
fi
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-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 --parallel 2
cmake --build build
cmake --install build --prefix $benchmark_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-B build \
-S /src/vendor/googletest
cmake --build build --parallel 2
cmake --build build
cmake --install build --prefix $GTest_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DKokkos_ENABLE_SERIAL=ON \
${EXTRA_CMAKE_FLAGS} \
${{matrix.backend.kokkos_extra_cmake_flags}} \
-B build \
-S /src/vendor/kokkos
cmake --build build --parallel 2
cmake --build build
cmake --install build --prefix $Kokkos_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DKokkosFFT_ENABLE_HOST_AND_DEVICE=ON \
-B build \
-S /src/vendor/kokkos-fft
cmake --build build --parallel 2
cmake --build build
cmake --install build --prefix $KokkosFFT_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DKokkosKernels_ADD_DEFAULT_ETI=OFF \
-DKokkosKernels_ENABLE_ALL_COMPONENTS=OFF \
Expand All @@ -249,15 +253,12 @@ jobs:
-DKokkosKernels_ENABLE_TPL_LAPACK=OFF \
-B build \
-S /src/vendor/kokkos-kernels
cmake --build build --parallel 2
cmake --build build
cmake --install build --prefix $KokkosKernels_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_FLAGS="\
-Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -pedantic-errors \
${DDC_CMAKE_CXX_FLAGS}" \
-DCMAKE_CXX_FLAGS=$DDC_CXXFLAGS \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DDDC_BUILD_BENCHMARKS=ON \
-DDDC_benchmark_DEPENDENCY_POLICY=INSTALLED \
Expand All @@ -266,33 +267,30 @@ jobs:
-DDDC_KokkosFFT_DEPENDENCY_POLICY=INSTALLED \
-B build \
-S /src
cmake --build build --parallel 2
case "${{matrix.backend}}" in
'cpu-'*)
ctest --test-dir build --parallel 2 --output-on-failure --timeout 10 --output-junit tests.xml
cmake --build build
if [ 'xcpu' = 'x${{matrix.backend.name}}' ]
then
ctest --test-dir build --output-on-failure --timeout 10 --output-junit tests.xml
./build/examples/characteristics_advection
./build/examples/game_of_life
./build/examples/heat_equation_spectral
./build/examples/heat_equation
./build/examples/uniform_heat_equation
./build/examples/non_uniform_heat_equation
./build/examples/heat_equation_spectral
./build/examples/game_of_life
./build/examples/characteristics_advection
;;
esac
./build/examples/uniform_heat_equation
fi
cmake --install build --prefix $DDC_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-B build \
-S /src/install_test
cmake --build build --parallel 2
cmake --build build
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} \
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 /home/runner/work/ddc/ddc/tests.xml
then echo "with_report=true" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -348,12 +346,12 @@ jobs:
cmake --build build --parallel 2
export UBSAN_OPTIONS=print_stacktrace=1,halt_on_error=1,suppressions=/src/ubsan.supp
ctest --test-dir build --parallel 2 --output-on-failure --timeout 10 --output-junit tests.xml
./build/examples/characteristics_advection
./build/examples/game_of_life
./build/examples/heat_equation_spectral
./build/examples/heat_equation
./build/examples/uniform_heat_equation
./build/examples/non_uniform_heat_equation
./build/examples/heat_equation_spectral
./build/examples/game_of_life
./build/examples/characteristics_advection
./build/examples/uniform_heat_equation
EOF
docker run \
--cidfile='docker.cid' \
Expand Down

0 comments on commit 6722e64

Please sign in to comment.