Skip to content

tests: set cmake platform via environment variable #431

tests: set cmake platform via environment variable

tests: set cmake platform via environment variable #431

Workflow file for this run

name: Build and test
on:
push:
branches:
- "**"
pull_request:
jobs:
gfortran:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
version: [9, 10, 11, 12]
os: [ubuntu-latest]
include:
#- version: 4.8
# os: ubuntu-18.04
# cmake_args: -DFABM_USE_IEEE_ARITHMETIC=OFF
#- version: 5
# os: ubuntu-18.04
#- version: 6
# os: ubuntu-18.04
- version: 7
os: ubuntu-20.04
- version: 8
os: ubuntu-20.04
cmake_args: -DFABM_USE_CONTIGUOUS=OFF
- version: 13
os: ubuntu-24.04
- version: 14
os: ubuntu-24.04
fail-fast: false
runs-on: ${{ matrix.os }}
env:
FFLAGS: -fcheck=all
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.7"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pyyaml
- name: Install compiler
run: |
sudo apt-get update
sudo apt-get install gfortran-${{ matrix.version }}
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: python3 util/developers/run_all_testcases.py harness --show_logs --compiler gfortran-${{ matrix.version }} ${{ matrix.cmake_args }}
- name: Run all test cases with pyfabm
run: python3 util/developers/run_all_testcases.py pyfabm --show_logs --compiler gfortran-${{ matrix.version }} ${{ matrix.cmake_args }}
ifort:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
include:
- version: "2021.1.2.62"
url_dir: "https://registrationcenter-download.intel.com/akdlm/irc_nas/17508"
- version: "2022.2.1.16992"
url_dir: "https://registrationcenter-download.intel.com/akdlm/irc_nas/18998"
- version: "2023.2.0.49254"
url_dir: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/237236c4-434b-4576-96ac-020ceeb22619"
fail-fast: false
runs-on: ubuntu-latest
env:
FFLAGS: -check all
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.7"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pyyaml
- name: Install compiler
run: |
wget --no-verbose ${{ matrix.url_dir }}/l_fortran-compiler_p_${{ matrix.version }}_offline.sh
/bin/sh l_fortran-compiler_p_${{ matrix.version }}_offline.sh -a --silent --cli --install-dir ${HOME}/intel --eula accept
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: |
source ${HOME}/intel/setvars.sh
python3 util/developers/run_all_testcases.py harness --show_logs --compiler ifort
- name: Run all test cases with pyfabm
run: |
source ${HOME}/intel/setvars.sh
python3 util/developers/run_all_testcases.py pyfabm --show_logs --compiler ifort
env:
FFLAGS: ${{ env.FFLAGS }} -fp-model precise -fp-model source
ifx:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
include:
- version: "2023.2.0.49254"
url_dir: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/237236c4-434b-4576-96ac-020ceeb22619"
#- version: "2024.0.2.28"
# url_dir: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/41df6814-ec4b-4698-a14d-421ee2b02aa7"
fail-fast: false
runs-on: ubuntu-latest
env:
FFLAGS: -check all,nouninit,nocontiguous
# nouninit because https://community.intel.com/t5/Intel-Fortran-Compiler/ifx-missing-clang-rt-msan-to-link-Fortran-program-in-debug-build/m-p/1536555
# nocontiguous because spurious errors occur when assigning null() to contiguous pointers
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.7"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pyyaml
- name: Install compiler
run: |
wget --no-verbose ${{ matrix.url_dir }}/l_fortran-compiler_p_${{ matrix.version }}_offline.sh
/bin/sh l_fortran-compiler_p_${{ matrix.version }}_offline.sh -a --silent --cli --install-dir ${HOME}/intel --eula accept
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: |
source ${HOME}/intel/setvars.sh
python3 util/developers/run_all_testcases.py harness --show_logs --compiler ifx
- name: Run all test cases with pyfabm
run: |
source ${HOME}/intel/setvars.sh
python3 util/developers/run_all_testcases.py pyfabm --show_logs --compiler ifx
env:
FFLAGS: ${{ env.FFLAGS }} -fp-model=precise
nvfortran:
# for available versions, see https://developer.nvidia.com/nvidia-hpc-sdk-releases
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
include:
- version: "20.9" # released 2020-10
exe: nvhpc_2020_209_Linux_x86_64_cuda_11.0
- version: "22.9" # released 2022-10
exe: nvhpc_2022_229_Linux_x86_64_cuda_11.7
- version: "23.7" # released 2023-07
exe: nvhpc_2023_237_Linux_x86_64_cuda_12.2
fail-fast: false
runs-on: ubuntu-latest
env:
FFLAGS: -Mbounds -Mchkptr
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.7"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pyyaml
- name: Install compiler
run: |
wget --no-verbose https://developer.download.nvidia.com/hpc-sdk/${{ matrix.version }}/${{ matrix.exe }}.tar.gz
tar xpzf ${{ matrix.exe }}.tar.gz
rm ${{ matrix.exe }}.tar.gz
${{ matrix.exe }}/install
env:
NVHPC_SILENT: true
NVHPC_INSTALL_DIR: /home/runner/nvhpc
NVHPC_INSTALL_TYPE: single
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: python3 util/developers/run_all_testcases.py harness --show_logs --compiler /home/runner/nvhpc/Linux_x86_64/${{ matrix.version }}/compilers/bin/pgfortran
- name: Run all test cases with pyfabm
run: python3 util/developers/run_all_testcases.py pyfabm --show_logs --compiler /home/runner/nvhpc/Linux_x86_64/${{ matrix.version }}/compilers/bin/pgfortran
aocc:
# for available versions, see https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/aocc/package.py
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
include:
- version: "3.2.0" # released 2021-12-02
pyfabm_cmake_args: -DCMAKE_Fortran_FLAGS_DEBUG= # skip -g as that triggers segfault
url_dir: https://download.amd.com/developer/eula/aocc-compiler
- version: "4.0.0" # released 2022-11-10
url_dir: https://download.amd.com/developer/eula/aocc-compiler
- version: "4.1.0" # released 2023-08-04
url_dir: https://download.amd.com/developer/eula/aocc/aocc-4-1
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.7"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pyyaml
- name: Install compiler
run: |
cd /home/runner
wget --no-verbose ${{ matrix.url_dir }}/aocc-compiler-${{ matrix.version }}.tar
tar xpf aocc-compiler-${{ matrix.version }}.tar
rm aocc-compiler-${{ matrix.version }}.tar
./aocc-compiler-${{ matrix.version }}/install.sh
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: |
source /home/runner/setenv_AOCC.sh
python3 util/developers/run_all_testcases.py harness --show_logs --compiler flang
- name: Run all test cases with pyfabm
run: |
source /home/runner/setenv_AOCC.sh
python3 util/developers/run_all_testcases.py pyfabm --show_logs --compiler flang ${{ matrix.pyfabm_cmake_args }}
flang-new:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
os: [windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
env:
CMAKE_GENERATOR: Ninja
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
- name: Install Python dependencies
run: conda install -c conda-forge/label/llvm_dev -c conda-forge pyyaml flang ninja c-compiler
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run all test cases with host emulators
run: python util/developers/run_all_testcases.py harness --show_logs --compiler flang-new
- name: Run all test cases with pyfabm
run: python util/developers/run_all_testcases.py pyfabm --show_logs --compiler flang-new
pyfabm:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
fail-fast: false
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip build
- name: Build distribution
run: python -m build
- name: Install
run: python -m pip install -v .
- name: Test
run: |
python -c "import pyfabm;print('pyfabm version =', getattr(pyfabm, '__version__', None))"
for f in testcases/*.yaml; do fabm_describe_model $f; done
for f in testcases/*.yaml; do fabm_complete_yaml --add_missing $f; done
- name: Install with customization via command line arguments
run: |
rm -rf build
python -m pip install -v -C--build-option=build_ext -C--build-option="--cmake-opts=-DFABM_INSTITUTES=examples" .
- name: Install with customization via setup.cfg
run: |
rm -rf build
echo "[build_ext]" > setup.cfg
echo "cmake_opts=-DFABM_INSTITUTES=examples" >> setup.cfg
python -m pip install -v .
fabm0d:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Install NetCDF
run: |
sudo apt-get update
sudo apt-get install libnetcdff-dev
- name: Clone FABM
uses: actions/checkout@v4
with:
submodules: recursive
- name: Clone GOTM
uses: actions/checkout@v4
with:
repository: gotm-model/code
ref: v6.0
path: gotm
submodules: recursive
- name: Build
run: |
cmake -S src/drivers/0d -B build -DGOTM_BASE=gotm
cmake --build build --target install
stat ~/local/fabm/0d/bin/fabm0d
cmake:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
cmake-version: ["3.13"]
runs-on: ubuntu-latest
steps:
- name: Clone FABM
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download and extract cmake
run: |
wget --no-verbose https://cmake.org/files/v${{ matrix.cmake-version }}/cmake-${{ matrix.cmake-version }}.0-Linux-x86_64.tar.gz
tar -xvf cmake-${{ matrix.cmake-version }}.0-Linux-x86_64.tar.gz
- name: Build
run: |
cmake-${{ matrix.cmake-version }}.0-Linux-x86_64/bin/cmake -S . -B build
cmake-${{ matrix.cmake-version }}.0-Linux-x86_64/bin/cmake --build build --target install
ninja:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Clone FABM
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Ninja
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Build
run: |
cmake -S . -B build -G Ninja
cmake --build build --target install