From 5cbbb4a55b7a3f675ba6aad2e6aa8dd55ad307db Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Thu, 8 Feb 2024 18:15:03 +0100 Subject: [PATCH 01/13] Rename images and explicitly specify them --- .github/workflows/__build_base.yaml | 36 ++++++++++++++--------------- .github/workflows/build_test.yaml | 24 +++++++++++-------- docker/{openmp => gcc}/Dockerfile | 0 docker/{sycl => intel}/Dockerfile | 0 docker/{cuda => nvcc}/Dockerfile | 0 docker/{hip => rocm}/Dockerfile | 0 6 files changed, 33 insertions(+), 27 deletions(-) rename docker/{openmp => gcc}/Dockerfile (100%) rename docker/{sycl => intel}/Dockerfile (100%) rename docker/{cuda => nvcc}/Dockerfile (100%) rename docker/{hip => rocm}/Dockerfile (100%) diff --git a/.github/workflows/__build_base.yaml b/.github/workflows/__build_base.yaml index 0891c7e2..fb1b2d95 100644 --- a/.github/workflows/__build_base.yaml +++ b/.github/workflows/__build_base.yaml @@ -1,8 +1,8 @@ -# Generate base images for each backend. Images are stored on Github registry -# as Docker format inconditionnaly and as Singularity format only if requested. -# Docker images are used for building Kokkos FFT, while Singularity images are -# used for test execution on the righteous hardware. This workflow can only be -# invoked through another workflows. +# Generate base images for each compiler environment. Images are stored on +# Github registry as Docker format inconditionnaly and as Singularity format +# only if requested. Docker images are used for building Kokkos FFT, while +# Singularity images are used for test execution on the righteous hardware. +# This workflow can only be invoked through another workflows. name: Build base images @@ -25,14 +25,14 @@ jobs: strategy: matrix: - backend: - - name: openmp + image: + - name: gcc use_singularity: false - - name: cuda + - name: nvcc use_singularity: true - - name: hip + - name: rocm use_singularity: false - - name: sycl + - name: intel use_singularity: false steps: @@ -61,19 +61,19 @@ jobs: - name: Build Docker image run: | docker build \ - -t ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ inputs.image_name_suffix }} \ - --cache-from ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_main \ + -t ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} \ + --cache-from ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_main \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --progress=plain \ - docker/${{ matrix.backend.name }} + docker/${{ matrix.image.name }} - name: Push Docker image - run: docker push ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ inputs.image_name_suffix }} + run: docker push ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} - name: Convert Docker image to Singularity - run: singularity build base.sif docker://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ inputs.image_name_suffix }} - if: ${{ matrix.backend.use_singularity }} + run: singularity build base.sif docker://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} + if: ${{ matrix.image.use_singularity }} - name: Push Singularity image - run: singularity push base.sif oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_singularity_${{ inputs.image_name_suffix }} - if: ${{ matrix.backend.use_singularity }} + run: singularity push base.sif oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_singularity_${{ inputs.image_name_suffix }} + if: ${{ matrix.image.use_singularity }} diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 3656fc37..23dfef15 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -82,18 +82,22 @@ jobs: matrix: backend: - name: openmp + image: gcc c_compiler: gcc cxx_compiler: g++ cmake_flags: -DKokkos_ENABLE_OPENMP=ON - name: cuda + image: nvcc c_compiler: gcc cxx_compiler: g++ cmake_flags: -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON - name: hip + image: rocm c_compiler: hipcc cxx_compiler: hipcc cmake_flags: -DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON - name: sycl + image: intel c_compiler: icx cxx_compiler: icpx # building for Intel PVC was unsuccessful without the proper device @@ -124,7 +128,7 @@ jobs: - name: Configure run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake -B build \ -DCMAKE_INSTALL_PREFIX=/work/install \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ @@ -139,12 +143,12 @@ jobs: - name: Build run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake --build build -j $(( $(nproc) * 2 + 1 )) - name: Prepare artifacts # this is mandatory to preserve execution rights - run: tar -cvf tests_${{ matrix.backend.name }}.tar build/ + run: tar -cvf tests_${{ matrix.backend.image }}.tar build/ if: ${{ matrix.target.name == 'native' }} - name: Save artifacts @@ -157,13 +161,13 @@ jobs: - name: Install run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake --install build - name: Configure and build test code # Use the built and installed Kokkos FFT library to build a test code run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.mage }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake -B build_test \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_C_COMPILER=${{ matrix.backend.c_compiler }} \ @@ -171,7 +175,7 @@ jobs: -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH=/work/install \ install_test - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake --build build_test -j $(( $(nproc) * 2 + 1 )) test: @@ -189,9 +193,11 @@ jobs: backend: # run CUDA tests on Ruche supercomputer - name: cuda + image: nvcc runner: [self-hosted, cuda] # run OpenMP tests on Azure server - name: openmp + image: gcc runner: ubuntu-latest steps: @@ -206,18 +212,18 @@ jobs: - name: Pull Singularity image # pulling the image in advance seems necessary as sometimes invoking `singularity run` on the image URL fails because it cannot find ghcr.io - run: singularity pull oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}:latest + run: singularity pull oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}:latest if: ${{ matrix.backend.name == 'cuda' }} - name: Run CUDA tests within Slurm job and Singularity image run: | srun --nodes=1 --time=01:00:00 -p gpua100 --gres=gpu:1 \ - singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.name }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}_latest.sif \ + singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}_latest.sif \ ctest if: ${{ matrix.backend.name == 'cuda' }} - name: Run OpenMP tests within Docker image run: | - docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.name }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ ctest if: ${{ matrix.backend.name == 'openmp' }} diff --git a/docker/openmp/Dockerfile b/docker/gcc/Dockerfile similarity index 100% rename from docker/openmp/Dockerfile rename to docker/gcc/Dockerfile diff --git a/docker/sycl/Dockerfile b/docker/intel/Dockerfile similarity index 100% rename from docker/sycl/Dockerfile rename to docker/intel/Dockerfile diff --git a/docker/cuda/Dockerfile b/docker/nvcc/Dockerfile similarity index 100% rename from docker/cuda/Dockerfile rename to docker/nvcc/Dockerfile diff --git a/docker/hip/Dockerfile b/docker/rocm/Dockerfile similarity index 100% rename from docker/hip/Dockerfile rename to docker/rocm/Dockerfile From c65afe4de73e2fe38ad834269e4eb726b8508907 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Thu, 8 Feb 2024 18:16:02 +0100 Subject: [PATCH 02/13] Increase ctest verbosity --- .github/workflows/build_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 23dfef15..fab50670 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -219,11 +219,11 @@ jobs: run: | srun --nodes=1 --time=01:00:00 -p gpua100 --gres=gpu:1 \ singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}_latest.sif \ - ctest + ctest --verbose if: ${{ matrix.backend.name == 'cuda' }} - name: Run OpenMP tests within Docker image run: | docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ - ctest + ctest --verbose if: ${{ matrix.backend.name == 'openmp' }} From 95a19cd5da3d8ba1841112c887a00903d8542dfe Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 09:58:30 +0100 Subject: [PATCH 03/13] Fix CI --- .github/workflows/build_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index fab50670..2602cd77 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -167,7 +167,7 @@ jobs: - name: Configure and build test code # Use the built and installed Kokkos FFT library to build a test code run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.mage }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ cmake -B build_test \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_C_COMPILER=${{ matrix.backend.c_compiler }} \ From cc52e5840146e1dd601bf3c203cbaed202fcfd78 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 10:21:28 +0100 Subject: [PATCH 04/13] Fix CI --- .github/workflows/build_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 2602cd77..68fcf45e 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -148,7 +148,7 @@ jobs: - name: Prepare artifacts # this is mandatory to preserve execution rights - run: tar -cvf tests_${{ matrix.backend.image }}.tar build/ + run: tar -cvf tests_${{ matrix.backend.name }}.tar build/ if: ${{ matrix.target.name == 'native' }} - name: Save artifacts From ebf6e163aff36e0bb44adf48eba51f0000c15673 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 11:20:54 +0100 Subject: [PATCH 05/13] Build base images on push on main --- .github/workflows/pre_build_base.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre_build_base.yaml b/.github/workflows/pre_build_base.yaml index 5784b263..b45a6145 100644 --- a/.github/workflows/pre_build_base.yaml +++ b/.github/workflows/pre_build_base.yaml @@ -1,13 +1,16 @@ -# Recreate the base images inconditionnaly on a regural basis. This is to -# ensure that anybody using the Docker files for local development does not -# encounter weird bugs unnoticed by the CI, because the images would be too -# old. +# Recreate the base images inconditionnaly on a regural basis and on push on +# the main branch. This is to ensure that anybody using the Docker files for +# local development does not encounter weird bugs unnoticed by the CI, because +# the images would be too old. name: Pre-build base images on: schedule: - cron: "0 1 2,16 * *" # every 2nd and 16th of the month at 1am UTC + push: + branches: + - main jobs: build_base: From 4c7f2a9e577051f6de0320736131bbc788f3c991 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 11:28:21 +0100 Subject: [PATCH 06/13] Use tags for base images --- .github/workflows/__build_base.yaml | 19 ++++++++++++------- .github/workflows/build_test.yaml | 28 ++++++++++++++++------------ 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/__build_base.yaml b/.github/workflows/__build_base.yaml index fb1b2d95..b5eca785 100644 --- a/.github/workflows/__build_base.yaml +++ b/.github/workflows/__build_base.yaml @@ -9,11 +9,16 @@ name: Build base images on: workflow_call: inputs: - # suffix of the Docker and Singularity images - image_name_suffix: + image_suffix: + description: Suffix of the Docker and Singularity images required: false default: main type: string + image_tag: + description: Tag of the Docker and Singularity images + required: false + default: latest + type: string env: # Force the use of BuildKit for Docker @@ -61,19 +66,19 @@ jobs: - name: Build Docker image run: | docker build \ - -t ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} \ - --cache-from ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_main \ + -t ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }} \ + --cache-from ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_main:latest \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --progress=plain \ docker/${{ matrix.image.name }} - name: Push Docker image - run: docker push ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} + run: docker push ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }} - name: Convert Docker image to Singularity - run: singularity build base.sif docker://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_name_suffix }} + run: singularity build base.sif docker://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_${{ inputs.image_suffix }}:${{ inputs.image_tag }} if: ${{ matrix.image.use_singularity }} - name: Push Singularity image - run: singularity push base.sif oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_singularity_${{ inputs.image_name_suffix }} + run: singularity push base.sif oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.image.name }}_singularity_${{ inputs.image_suffix }}:${{ inputs.image_tag }} if: ${{ matrix.image.use_singularity }} diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 68fcf45e..1746097f 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -34,9 +34,12 @@ jobs: outputs: # true if any Docker file was modified in the PR (PR mode) or since last pushed commit (push mode) docker_files_have_changed: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} - # use "pr" as image name suffix if on PR mode and if any Docker file was modified, otherwise use "main" - # this is intended to avoid a PR test to alter Docker images for other PRs or for the main branch - image_name_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && 'pr' || 'main' }} + # use "pr" as image name suffix if on PR mode and if any Docker file was modified, otherwise use "main"; + # this is intended to avoid a PR to alter Docker images for other PRs or for the main branch + image_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && 'pr' || 'main' }} + # use "" as image name tag if on PR mode and if any Docker file was modified, otherwise use "latest"; + # this is intended to distinguish PR images from each other + image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && env.GITHUB_SHA || 'latest' }} steps: - uses: actions/checkout@v4 @@ -66,7 +69,8 @@ jobs: uses: ./.github/workflows/__build_base.yaml with: - image_name_suffix: ${{ needs.check_docker_files.outputs.image_name_suffix }} + image_suffix: ${{ needs.check_docker_files.outputs.image_suffix }} + image_tag: ${{ needs.check_docker_files.outputs.image_tag }} build: runs-on: ubuntu-latest @@ -128,7 +132,7 @@ jobs: - name: Configure run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ cmake -B build \ -DCMAKE_INSTALL_PREFIX=/work/install \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ @@ -143,7 +147,7 @@ jobs: - name: Build run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ cmake --build build -j $(( $(nproc) * 2 + 1 )) - name: Prepare artifacts @@ -161,13 +165,13 @@ jobs: - name: Install run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ cmake --install build - name: Configure and build test code # Use the built and installed Kokkos FFT library to build a test code run: | - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ cmake -B build_test \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_C_COMPILER=${{ matrix.backend.c_compiler }} \ @@ -175,7 +179,7 @@ jobs: -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH=/work/install \ install_test - docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ cmake --build build_test -j $(( $(nproc) * 2 + 1 )) test: @@ -212,18 +216,18 @@ jobs: - name: Pull Singularity image # pulling the image in advance seems necessary as sometimes invoking `singularity run` on the image URL fails because it cannot find ghcr.io - run: singularity pull oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}:latest + run: singularity pull oras://ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} if: ${{ matrix.backend.name == 'cuda' }} - name: Run CUDA tests within Slurm job and Singularity image run: | srun --nodes=1 --time=01:00:00 -p gpua100 --gres=gpu:1 \ - singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_name_suffix }}_latest.sif \ + singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_suffix }}_${{ needs.check_docker_files.outputs.image_tag }}.sif \ ctest --verbose if: ${{ matrix.backend.name == 'cuda' }} - name: Run OpenMP tests within Docker image run: | - docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_name_suffix }} \ + docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ ctest --verbose if: ${{ matrix.backend.name == 'openmp' }} From a44d0175e90b7e3f33540d383d7c9ff332636cb2 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 11:34:50 +0100 Subject: [PATCH 07/13] Output failed tests only --- .github/workflows/build_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 1746097f..f366d2c9 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -223,11 +223,11 @@ jobs: run: | srun --nodes=1 --time=01:00:00 -p gpua100 --gres=gpu:1 \ singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_suffix }}_${{ needs.check_docker_files.outputs.image_tag }}.sif \ - ctest --verbose + ctest --output-on-failure if: ${{ matrix.backend.name == 'cuda' }} - name: Run OpenMP tests within Docker image run: | docker run -v $PWD/build:/work/build -w /work/build ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \ - ctest --verbose + ctest --output-on-failure if: ${{ matrix.backend.name == 'openmp' }} From 40a68f5dd359a1d1c588430845cdbcdc5bd5f56f Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 11:42:23 +0100 Subject: [PATCH 08/13] Fix incorrect image tag hash value --- .github/workflows/build_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index f366d2c9..751f72d7 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -39,7 +39,7 @@ jobs: image_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && 'pr' || 'main' }} # use "" as image name tag if on PR mode and if any Docker file was modified, otherwise use "latest"; # this is intended to distinguish PR images from each other - image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && env.GITHUB_SHA || 'latest' }} + image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && github.sha || 'latest' }} steps: - uses: actions/checkout@v4 From 57db45f9a9693afcbadbd7af61f37aa6d1a709fd Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 12:14:02 +0100 Subject: [PATCH 09/13] Mutualize check Docker files --- .github/workflows/__build_base.yaml | 4 +- .github/workflows/__check_docker_files.yaml | 57 +++++++++++++++++++++ .github/workflows/build_test.yaml | 33 ++---------- .github/workflows/pre_build_base.yaml | 11 ++++ 4 files changed, 73 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/__check_docker_files.yaml diff --git a/.github/workflows/__build_base.yaml b/.github/workflows/__build_base.yaml index b5eca785..1767d599 100644 --- a/.github/workflows/__build_base.yaml +++ b/.github/workflows/__build_base.yaml @@ -10,12 +10,12 @@ on: workflow_call: inputs: image_suffix: - description: Suffix of the Docker and Singularity images + description: "Suffix of the Docker and Singularity images" required: false default: main type: string image_tag: - description: Tag of the Docker and Singularity images + description: "Tag of the Docker and Singularity images" required: false default: latest type: string diff --git a/.github/workflows/__check_docker_files.yaml b/.github/workflows/__check_docker_files.yaml new file mode 100644 index 00000000..15ad2b8a --- /dev/null +++ b/.github/workflows/__check_docker_files.yaml @@ -0,0 +1,57 @@ +# Check if Docker images have changed. In that case, proposes images suffix and +# tag. + +name: Check Docker files + +on: + workflow_call: + inputs: + event_name: + description: "Event name of the calling workflow" + required: true + type: string + + outputs: + docker_files_have_changed: + description: "True if any Docker file was modified" + value: ${{ jobs.check_docker_files.output.docker_files_have_changed }} + image_suffix: + description: "Suffix of the images" + value: ${{ jobs.check_docker_files.output.image_suffix }} + image_tag: + description: "Tag of the images" + value: ${{ jobs.check_docker_files.output.image_tag }} + +jobs: + check_docker_files: + runs-on: ubuntu-latest + + outputs: + # true if any Docker file was modified in the PR (PR mode) or since last pushed commit (push mode) + docker_files_have_changed: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} + # use "pr" as image name suffix if on PR mode and if any Docker file was modified, otherwise use "main"; + # this is intended to avoid a PR to alter Docker images for other PRs or for the main branch + image_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && inputs.event_name == 'pull_request' && 'pr' || 'main' }} + # use "" as image name tag if on PR mode and if any Docker file was modified, otherwise use "latest"; + # this is intended to distinguish PR images from each other + image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && inputs.event_name == 'pull_request' && github.sha || 'latest' }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get changed Dockerfiles + id: get_changed_docker_files + uses: tj-actions/changed-files@v42 + with: + files: docker/**/Dockerfile + + - name: List changed Dockerfiles + if: ${{ steps.docker_files_have_changed.outputs.any_changed == 'true' }} + env: + ALL_CHANGED_FILES: ${{ steps.docker_files_have_changed.outputs.all_changed_files }} + run: | + for file in "$ALL_CHANGED_FILES"; do + echo "$file was changed" + done diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index 751f72d7..351588a2 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -29,37 +29,10 @@ jobs: clangFormatVersion: 12 check_docker_files: - runs-on: ubuntu-latest - - outputs: - # true if any Docker file was modified in the PR (PR mode) or since last pushed commit (push mode) - docker_files_have_changed: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} - # use "pr" as image name suffix if on PR mode and if any Docker file was modified, otherwise use "main"; - # this is intended to avoid a PR to alter Docker images for other PRs or for the main branch - image_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && 'pr' || 'main' }} - # use "" as image name tag if on PR mode and if any Docker file was modified, otherwise use "latest"; - # this is intended to distinguish PR images from each other - image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && github.event_name == 'pull_request' && github.sha || 'latest' }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + uses: ./.github/workflows/__check_docker_files.yaml - - name: Get changed Dockerfiles - id: get_changed_docker_files - uses: tj-actions/changed-files@v42 - with: - files: docker/**/Dockerfile - - - name: List changed Dockerfiles - if: ${{ steps.docker_files_have_changed.outputs.any_changed == 'true' }} - env: - ALL_CHANGED_FILES: ${{ steps.docker_files_have_changed.outputs.all_changed_files }} - run: | - for file in "$ALL_CHANGED_FILES"; do - echo "$file was changed" - done + with: + event_name: ${{ github.event_name }} build_base: needs: check_docker_files diff --git a/.github/workflows/pre_build_base.yaml b/.github/workflows/pre_build_base.yaml index b45a6145..8c8111ab 100644 --- a/.github/workflows/pre_build_base.yaml +++ b/.github/workflows/pre_build_base.yaml @@ -13,5 +13,16 @@ on: - main jobs: + check_docker_files: + uses: ./.github/workflows/__check_docker_files.yaml + + with: + event_name: ${{ github.event_name }} + build_base: + needs: check_docker_files + + # run inconditionnaly on schedule mode or if Docker files changed on other modes + if: ${{ github.event_name == 'schedule' || needs.check_docker_files.outputs.docker_files_have_changed == 'true' }} + uses: ./.github/workflows/__build_base.yaml From 417cad6838511f3b6fd097981867295c970704c1 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 13:42:57 +0100 Subject: [PATCH 10/13] Fix CI --- .github/workflows/__check_docker_files.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/__check_docker_files.yaml b/.github/workflows/__check_docker_files.yaml index 15ad2b8a..335688de 100644 --- a/.github/workflows/__check_docker_files.yaml +++ b/.github/workflows/__check_docker_files.yaml @@ -14,13 +14,13 @@ on: outputs: docker_files_have_changed: description: "True if any Docker file was modified" - value: ${{ jobs.check_docker_files.output.docker_files_have_changed }} + value: ${{ jobs.check_docker_files.outputs.docker_files_have_changed }} image_suffix: description: "Suffix of the images" - value: ${{ jobs.check_docker_files.output.image_suffix }} + value: ${{ jobs.check_docker_files.outputs.image_suffix }} image_tag: description: "Tag of the images" - value: ${{ jobs.check_docker_files.output.image_tag }} + value: ${{ jobs.check_docker_files.outputs.image_tag }} jobs: check_docker_files: From 6fe88fec24e6963e5051f83d818e491295399a4d Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 13:57:50 +0100 Subject: [PATCH 11/13] Fix list of changed Docker files --- .github/workflows/__check_docker_files.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/__check_docker_files.yaml b/.github/workflows/__check_docker_files.yaml index 335688de..92a46da9 100644 --- a/.github/workflows/__check_docker_files.yaml +++ b/.github/workflows/__check_docker_files.yaml @@ -41,16 +41,16 @@ jobs: with: fetch-depth: 0 - - name: Get changed Dockerfiles + - name: Get changed Docker files id: get_changed_docker_files uses: tj-actions/changed-files@v42 with: files: docker/**/Dockerfile - - name: List changed Dockerfiles - if: ${{ steps.docker_files_have_changed.outputs.any_changed == 'true' }} + - name: List changed Docker files + if: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} env: - ALL_CHANGED_FILES: ${{ steps.docker_files_have_changed.outputs.all_changed_files }} + ALL_CHANGED_FILES: ${{ steps.get_changed_docker_files.outputs.all_changed_files }} run: | for file in "$ALL_CHANGED_FILES"; do echo "$file was changed" From 37c609127a75e5011c04e92de9d02afcaac98e07 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 14:33:10 +0100 Subject: [PATCH 12/13] Use latest ROCM image on Ubuntu 20.04 --- docker/rocm/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/rocm/Dockerfile b/docker/rocm/Dockerfile index 21f13e8d..5526f387 100644 --- a/docker/rocm/Dockerfile +++ b/docker/rocm/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE=rocm/dev-ubuntu-20.04:5.4 +ARG BASE=rocm/dev-ubuntu-20.04 FROM $BASE ARG ADDITIONAL_PACKAGES From 05e6626fc17bff854b50aa27004f8c4e01e9d8d3 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Fri, 9 Feb 2024 14:38:40 +0100 Subject: [PATCH 13/13] Fix wrong display of changed images --- .github/workflows/__check_docker_files.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/__check_docker_files.yaml b/.github/workflows/__check_docker_files.yaml index 92a46da9..5d1119d2 100644 --- a/.github/workflows/__check_docker_files.yaml +++ b/.github/workflows/__check_docker_files.yaml @@ -52,6 +52,6 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.get_changed_docker_files.outputs.all_changed_files }} run: | - for file in "$ALL_CHANGED_FILES"; do + for file in $ALL_CHANGED_FILES; do echo "$file was changed" done