Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 34 additions & 9 deletions .github/actions/build_run_model/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ inputs:
description: 'arguments to use when running specified program'
required: false
default: ''
compiler:
description: 'compiler to use when building and running model'
type: string
required: false
default: gfortran
use-mpi:
description: 'specify whether to run program without MPI, with MPI, or with MPIF08'
type: string
Expand All @@ -32,6 +37,10 @@ inputs:
type: number
required: false
default: 2

defaults:
run:
shell: bash -elo pipefail {0}

runs:
using: "composite"
Expand All @@ -40,44 +49,60 @@ runs:
- name: Creating Makefile template :)
run: |
cd build_templates
cp mkmf.template.gfortran mkmf.template
echo 'FFLAGS = -g -Wuninitialized -Wunused -ffree-line-length-none -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow $(INCS)' >> mkmf.template
shell: bash
case ${{ inputs.compiler }} in
gfortran)
cp mkmf.template.gfortran mkmf.template
echo 'FFLAGS = -g -Wuninitialized -Wunused -ffree-line-length-none -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow $(INCS)' >> mkmf.template
;;
nvhpc)
cp mkmf.template.nvhpc mkmf.template
echo 'FFLAGS = -g -C -traceback -Ktrap=fp -Mbackslash -Kieee $(INCS)' >> mkmf.template
;;
ifx)
cp mkmf.template.ifx.linux mkmf.template
echo 'FFLAGS = -g -O0 -C -check noarg_temp_created -check nouninit -fpe0 -fp-model precise -ftrapuv -traceback -warn declarations,uncalled,unused $(INCS)' >> mkmf.template
;;
*)
echo "Unknown or unsupported compiler: ${{ inputs.compiler }}" >&2
exit 1
;;
esac
shell: bash -elo pipefail {0}
# Steps to compile and build model
- name: Building ${{ inputs.model }} model (use-mpi=nompi)
if: ${{ inputs.use-mpi == 'nompi' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work
./quickbuild.sh nompi
shell: bash
shell: bash -elo pipefail {0}
- name: Building ${{ inputs.model }} model (use-mpi=mpi)
if: ${{ inputs.use-mpi == 'mpi' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work
./quickbuild.sh
shell: bash
shell: bash -elo pipefail {0}
- name: Building ${{ inputs.model }} model (use-mpi=mpif08)
if: ${{ inputs.use-mpi == 'mpif08' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work
./quickbuild.sh mpif08
shell: bash
shell: bash -elo pipefail {0}
# Steps to run the specified run-program with mpi options
- name: Running ${{ inputs.model }} ${{ inputs.run-program }} program (use-mpi=nompi)
if: ${{ inputs.use-mpi == 'nompi' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work/
./${{ inputs.run-program }} ${{ inputs.run-program-args }}
shell: bash
shell: bash -elo pipefail {0}
- name: Running ${{ inputs.model }} ${{ inputs.run-program }} program (use-mpi=mpi)
if: ${{ inputs.use-mpi == 'mpi' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work/
mpirun -n ${{ inputs.mpi-n-tasks }} ./${{ inputs.run-program }} ${{ inputs.run-program-args }}
shell: bash
shell: bash -elo pipefail {0}
- name: Running ${{ inputs.model }} ${{ inputs.run-program }} program (use-mpi=mpif08)
if: ${{ inputs.use-mpi == 'mpif08' }}
run: |
cd ${{ inputs.models-directory }}/${{ inputs.model }}/work/
mpirun -n ${{ inputs.mpi-n-tasks }} ./${{ inputs.run-program }} ${{ inputs.run-program-args }}
shell: bash
shell: bash -elo pipefail {0}
77 changes: 77 additions & 0 deletions .github/workflows/cirrus_action_on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CIRRUS Action on Pull Request

on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

env:
OMPI_MCA_hwloc_use_cset: 0 # Disables control group based CPU affinity detections
OMPI_MCA_opal_hwloc_base_binding_policy: none # Disable automatically binding processes to specific hardware resources

jobs:
build-run-lorenz_96:

strategy:
fail-fast: false # This prevents the matrix from cancelling other jobs if one fails
matrix:
compiler: [gfortran, nvhpc, ifx]
use-mpi: [mpi, nompi, mpif08]
include:
# Container image per compiler
- compiler: gfortran
container: docker.io/ncarcisl/hpcdev-x86_64:almalinux10-gcc-openmpi-latest
- compiler: nvhpc
container: docker.io/ncarcisl/hpcdev-x86_64:almalinux10-nvhpc-openmpi-latest
- compiler: ifx
container: docker.io/ncarcisl/hpcdev-x86_64:almalinux10-oneapi-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 }}
Loading