Skip to content
Open
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
39 changes: 30 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,56 @@ 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 = -gopt -C -traceback -Ktrap=fp -Mbackslash -Kieee $(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}
247 changes: 247 additions & 0 deletions .github/workflows/cirrus_action_on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
name: CIRRUS Action on Pull Request

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

jobs:
# Job 1
build-run-lorenz_96-mpi-gfortran:

# 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: ncarcisl/hpcdev-x86_64:almalinux9-gcc-openmpi-latest

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: Build and run lorenz_96 with mpi
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: gfortran
use-mpi: mpi
mpi-n-tasks: 4

# Job 2
build-run-lorenz_96-nompi-gfortran:

# Runner instance OS
runs-on:
group: cirrus-4x8

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

# Deploy container on top of runner instance
container:
image: ncarcisl/hpcdev-x86_64:almalinux9-gcc-openmpi-latest

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: Build and run lorenz_63 with no mpi
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: gfortran
use-mpi: nompi

# Job 3
build-run-lorenz_96-mpif08-gfortran:

# Runner instance OS
runs-on:
group: cirrus-4x8

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

# Deploy container on top of runner instance
container:
image: ncarcisl/hpcdev-x86_64:almalinux9-gcc-openmpi-latest

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: Build and run lorenz_96 with mpif08
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: gfortran
use-mpi: mpif08
mpi-n-tasks: 4

# Job 4
build-run-lorenz_96-mpi-nvhpc:

# 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: ncarcisl/hpcdev-x86_64:almalinux9-nvhpc-openmpi-latest

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 }}

# nvhpc requires some modifications to not use the ftn wrapper for derecho
- 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/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
sed -i 's|exec '\''make'\'', '\''-f'\'', \$opt_m if \$opt_x;|exec '\''make'\'', '\''-j'\'', '\''4'\'', '\''-f'\'', \$opt_m if \$opt_x;|' mkmf

- name: Build and run lorenz_96 with mpi
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: nvhpc
use-mpi: mpi
mpi-n-tasks: 4

# Job 5
build-run-lorenz_96-nompi-nvhpc:

# Runner instance OS
runs-on:
group: cirrus-4x8

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

# Deploy container on top of runner instance
container:
image: ncarcisl/hpcdev-x86_64:almalinux9-nvhpc-openmpi-latest

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 }}

# nvhpc requires some modifications to not use the ftn wrapper for derecho
- 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/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
sed -i 's|exec '\''make'\'', '\''-f'\'', \$opt_m if \$opt_x;|exec '\''make'\'', '\''-j'\'', '\''4'\'', '\''-f'\'', \$opt_m if \$opt_x;|' mkmf

- name: Build and run lorenz_63 with no mpi
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: nvhpc
use-mpi: nompi

# Job 6
build-run-lorenz_96-mpif08-nvhpc:

# Runner instance OS
runs-on:
group: cirrus-4x8

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

# Deploy container on top of runner instance
container:
image: ncarcisl/hpcdev-x86_64:almalinux9-nvhpc-openmpi-latest

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 }}

# nvhpc requires some modifications to not use the ftn wrapper for derecho
- 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/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
sed -i 's|exec '\''make'\'', '\''-f'\'', \$opt_m if \$opt_x;|exec '\''make'\'', '\''-j'\'', '\''4'\'', '\''-f'\'', \$opt_m if \$opt_x;|' mkmf

- name: Build and run lorenz_96 with mpif08
uses: ./.github/actions/build_run_model
with:
model: lorenz_96
run-program: ./filter
compiler: nvhpc
use-mpi: mpif08
mpi-n-tasks: 4
Loading