Skip to content

Add build-hpc workflow for Github Actions #1

Add build-hpc workflow for Github Actions

Add build-hpc workflow for Github Actions #1

Workflow file for this run

name: build-hpc
# Controls when the action will run
on:
# Trigger the workflow on all pull requests
pull_request: ~
# Allow workflow to be dispatched on demand
workflow_dispatch: ~
jobs:
ci-hpc:
name: ci-hpc
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
prec: [dp, sp]
cuda: [False, True]
name:
- ac-gpu nvhpc
include:
- name: ac-gpu nvhpc
site: ac-batch
sbatch_options: |
#SBATCH --time=00:20:00
#SBATCH --nodes=1
#SBATCH --ntasks=2
#SBATCH --cpus-per-task=32
#SBATCH --gpus-per-task=1
#SBATCH --mem=200G
#SBATCH --qos=dg
runs-on: [self-hosted, linux, hpc]
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: ecmwf-actions/reusable-workflows/ci-hpc-generic@v2
with:
site: ${{ matrix.site }}
troika_user: ${{ secrets.HPC_CI_SSH_USER }}
sbatch_options: ${{ matrix.sbatch_options }}
template_data: |
modules:
- cmake
- fcm
- ninja
- ecbuild
- prgenv/nvidia
- hpcx-openmpi
- python3
cmake_options:
- -DENABLE_ACC=ON
- -DENABLE_CUDA=${{ matrix.cuda }}
- -DENABLE_SINGLE_PRECISION=${{ matrix.prec == 'sp' }}
- -DENABLE_DOUBLE_PRECISION=${{ matrix.prec == 'dp' }}
dependencies:
ecmwf/fckit:
version: 0.13.0
cmake_options:
- -DENABLE_TESTS=OFF
- -DENABLE_FCKIT_VENV=ON
ecmwf-ifs/fiat:
version: 1.4.1
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_SINGLE_PRECISION=${{ matrix.prec == 'sp' }}
- -DENABLE_DOUBLE_PRECISION=${{ matrix.prec == 'dp' }}
template: |
{% for module in modules %}
module load {{module}}
{% endfor %}
BASEDIR=$PWD
{% for name, options in dependencies.items() %}
mkdir -p {{name}}
pushd {{name}}
git init
git remote add origin ${{ github.server_url }}/{{name}}
git fetch origin {{options['version']}}
git reset --hard FETCH_HEAD
cmake -G Ninja -S . -B build \
{% for name in dependencies %}
{% set org, proj = name.split('/') %}
-D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \
{% endfor %}
{{ options['cmake_options']|join(' ') }}
cmake --build build
cmake --install build --prefix installation
popd
{% endfor %}
mkdir -p ${{ github.repository }}
pushd ${{ github.repository }}
git init
git remote add origin ${{ github.server_url }}/${{ github.repository }}
git fetch origin ${{ github.sha }}
git reset --hard FETCH_HEAD
popd
cmake -G Ninja -S ${{ github.repository }} -B build \
{% for name in dependencies %}
{% set org, proj = name.split('/') %}
-D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \
{% endfor %}
{{ cmake_options|join(' ') }}
cmake --build build
ctest --test-dir build