Skip to content

Commit

Permalink
Ubuntu/gfortran CI for debugging; separate Conda-style builds (#360)
Browse files Browse the repository at this point in the history
Sets up mutli-platform CI for builds using gfortran from conda to mimic conda-build; simplifies Ubuntu CI but still exercises double/single precision and default/accelerator kernels. 

Closes #358, #359, #362
  • Loading branch information
RobertPincus authored Feb 25, 2025
1 parent 0c51fa2 commit e698a9e
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 109 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/conda-style-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Conda-compatible builds

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

defaults:
run:
# Enable Conda environment by using the login shell:
shell: bash -leo pipefail {0}

jobs:
CI:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-13, macos-latest, windows-2022]
build-type: [RelWithDebugInfo]
env:
FC: gfortran
CMAKE_BUILD_PARALLEL_LEVEL: 8
VERBOSE:
CTEST_PARALLEL_LEVEL: 8
CTEST_OUTPUT_ON_FAILURE: 1
runs-on: ${{ matrix.os }}
steps:
#
# Check out repository under $GITHUB_WORKSPACE
#
- name: Check out code
uses: actions/checkout@v4
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ matrix.os }}
#
# Set up Conda
#
- name: Set up Conda (testing scripts only)
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment-noplots.yml
python-version: 3.11
auto-activate-base: false
conda-remove-defaults: true
# Use the cache properly:
use-only-tar-bz2: false
#
# Install compiler and dependencies
#
- name: Install compiler, dependencies
run: |
conda install -c conda-forge "${FC}" netcdf-fortran ninja -y
#
# Adjust toolchain
#
- name: Adjust Windows toolchain
if: matrix.os == 'windows-2022'
run: echo "FC=${FC}.exe" >> "$GITHUB_ENV"
#
# Build libraries, examples, and tests
#
- name: Build libraries and tests
run: |
cmake -S . -B build -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type}} \
-DRTE_ENABLE_SP=OFF \
-DBUILD_TESTING=ON
cmake --build build
#
# Run examples, tests and checks
#
- name: Run examples, tests and checks
working-directory: build
run: ctest
124 changes: 25 additions & 99 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,120 +9,46 @@ on:

defaults:
run:
# Enable Conda environment by using the login shell:
shell: bash -leo pipefail {0}
shell: bash -eo pipefail {0}

jobs:
CI:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-13, macos-latest, windows-2022]
gfortran-version: [12, 13, 14]
gfortran-from: [system, conda]
rte-kernels: [default, accel]
fpmodel: [DP, SP]
exclude:
- os: ubuntu-24.04
gfortran-from: conda
- os: macos-13
gfortran-from: system
- os: macos-13
gfortran-version: 14
gfortran-from: conda
- os: macos-latest
gfortran-from: system
- os: macos-latest
gfortran-version: 14
gfortran-from: conda
- os: windows-2022
include:
- os: ubuntu-24.04
gfortran-version: 13
gfortran-from: conda
fpmodel: DP
- os: windows-2022
gfortran-version: 13
gfortran-from: conda
fpmodel: DP
- os: windows-2022
gfortran-version: 13
gfortran-from: conda
fpmodel: SP
- os: windows-2022
gfortran-version: 14
gfortran-from: conda
fpmodel: DP
- os: windows-2022
gfortran-version: 14
gfortran-from: conda
fpmodel: SP

env:
FC: gfortran-${{ matrix.gfortran-version }}
FFLAGS: "-m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan"
FFLAGS: -std=f2008 -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan
CMAKE_BUILD_PARALLEL_LEVEL: 8
VERBOSE:
CTEST_PARALLEL_LEVEL: 8
CTEST_OUTPUT_ON_FAILURE: 1
runs-on: ${{ matrix.os }}
runs-on: ubuntu-24.04
steps:
#
# Check out repository under $GITHUB_WORKSPACE
#
- name: Check out code
- name: Check out
uses: actions/checkout@v4
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ matrix.os }}
#
# Set up Conda
#
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment-noplots.yml
python-version: 3.11
auto-activate-base: false
# Use the cache properly:
use-only-tar-bz2: false
#
# Install compiler
#
- name: Install compiler
if: matrix.gfortran-from == 'conda'
run: |
conda install -c conda-forge gfortran=${{ matrix.gfortran-version }} -y
echo "FC=gfortran" >> "$GITHUB_ENV"
#
# Install dependencies
#
- name: Install dependencies
run: conda install -c conda-forge netcdf-fortran ninja -y
#
# Adjust toolchain
#
- name: Adjust toolchain
if: matrix.os == 'windows-2022'
run: echo "FC=${FC}.exe" >> "$GITHUB_ENV"
#
# Build libraries, examples, and tests
#
- name: Build libraries and tests
run: |
cmake -S . -B build -G "Ninja" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
libnetcdff-dev \
python3-dask \
python3-h5netcdf \
python3-numpy \
python3-scipy \
python3-xarray
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DRTE_ENABLE_SP="$(test '${{ matrix.fpmodel }}' = SP && echo ON || echo OFF)" \
-DKERNEL_MODE=${{ matrix.rte-kernels }} \
-DBUILD_TESTING=ON
cmake --build build
#
# Run examples, tests and checks
#
- name: Run examples, tests and checks
working-directory: build
run: ctest
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build
- name: Install
run: sudo cmake --install build
2 changes: 1 addition & 1 deletion .github/workflows/doc-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
# Deploy documentation
#
- name: Deploy API Documentation
uses: JamesIves/github-pages-deploy-action@v4.7.2
uses: JamesIves/github-pages-deploy-action@v4.7.3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
pre-commit:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
9 changes: 1 addition & 8 deletions rte-kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ if(BUILD_SHARED_LIBS)
endif()

target_compile_definitions(
rtekernels
PRIVATE $<$<BOOL:${RTE_ENABLE_SP}>:RTE_USE_SP>
rtekernels
$<$<BOOL:${RTE_BOOL}>:RTE_BOOL>
rtekernels
$<$<BOOL:${RTE_PRECISION}>:RTE_PRECISION>
rtekernels
$<$<BOOL:${RTE_EPSILON}>:RTE_EPSILON>
rtekernels PRIVATE $<$<BOOL:${RTE_ENABLE_SP}>:RTE_USE_SP>
)

target_include_directories(rtekernels PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
Expand Down

0 comments on commit e698a9e

Please sign in to comment.