Adding a Github Action that runs on CIRRUS runner scale sets and NCAR HPC containers #23
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
| name: CIRRUS Action on Pull Request | |
| on: | |
| pull_request: | |
| types: [ opened, reopened, synchronize, ready_for_review ] | |
| jobs: | |
| build-run-lorenz_96: | |
| strategy: | |
| fail-fast: false # This prevents the matrix from cancelling other jobs if one fails | |
| matrix: | |
| compiler: [gfortran, nvhpc] | |
| use-mpi: [mpi, nompi, mpif08] | |
| include: | |
| # Container image per compiler | |
| - compiler: gfortran | |
| container: docker.io/ncarcisl/hpcdev-x86_64:almalinux9-gcc-openmpi-latest | |
| - compiler: nvhpc | |
| container: docker.io/ncarcisl/hpcdev-x86_64:almalinux9-nvhpc-openmpi-latest | |
| # Number of MPI tasks for parallel runs (nompi leaves this unset) | |
| - use-mpi: mpi | |
| mpi-n-tasks: 4 | |
| - use-mpi: mpif08 | |
| mpi-n-tasks: 4 | |
| # Runner instance OS | |
| runs-on: | |
| group: cirrus-4x8 | |
| # The 'ncarcisl' containers initialize their software environment | |
| # through 'sourcing' a common configuration file (/container/config_env.sh). | |
| # This is done by starting a bash *login* shell (bash -l [...]) | |
| defaults: | |
| run: | |
| shell: bash -elo pipefail {0} | |
| # Deploy container on top of runner instance | |
| container: | |
| image: ${{ matrix.container }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set checked out repo as a safe git directory | |
| run: git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} | |
| - name: Source container config file and modify mkmf to use 4 cores for compilation | |
| run: | | |
| source "/container/config_env.sh" | |
| cd build_templates | |
| sed -i 's|exec '\''make'\'', '\''-f'\'', \$opt_m if \$opt_x;|exec '\''make'\'', '\''-j'\'', '\''4'\'', '\''-f'\'', \$opt_m if \$opt_x;|' mkmf | |
| - name: Modify nvhpc mkmf template to not use derecho ftn wrapper | |
| if: matrix.compiler == 'nvhpc' | |
| run: | | |
| cd build_templates | |
| sed -i 's/MPIFC = ftn/MPIFC = mpif90/' mkmf.template.nvhpc | |
| sed -i 's/MPILD = ftn/MPILD = mpif90/' mkmf.template.nvhpc | |
| sed -i 's/LD = ftn/LD = nvfortran/' mkmf.template.nvhpc | |
| sed -i 's/FC = ftn/FC = nvfortran/' mkmf.template.nvhpc | |
| - name: Build and run lorenz_96 | |
| uses: ./.github/actions/build_run_model | |
| with: | |
| model: lorenz_96 | |
| run-program: ./filter | |
| compiler: ${{ matrix.compiler }} | |
| use-mpi: ${{ matrix.use-mpi }} | |
| mpi-n-tasks: ${{ matrix.mpi-n-tasks }} |