Skip to content

Commit

Permalink
Refactored two-stream, new LW source functions and quadrature, kernel…
Browse files Browse the repository at this point in the history
… API (#284)

Accumulated changes and bug fixes. Changes LW answers (data repo is alsoupdated).
- New LW weights and secants (Change LW quadrature angles #282)
- A single source function on levels (Simplify LW source functions #250)
- Kernel API header files in Fortran and C (Add kernel API #272)
- Refactored two-stream, fixing RTE shortwave kernel not vectorizing #215 (Re-vectorize SW two-stream #275)
- Buxfixes, change to internal build systems and continuous integration (thanks to @skosukhin for ongoing help)
  • Loading branch information
RobertPincus authored May 21, 2024
1 parent 1e08721 commit 41c5fcd
Show file tree
Hide file tree
Showing 51 changed files with 3,993 additions and 832 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/check-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check Fortran API
on:
push:
branches:
- main
- develop
pull_request:
branches-ignore:
- documentation
workflow_dispatch:


jobs:
API:
runs-on: ubuntu-22.04
env:
# Core variables:
FC: gfortran-12
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g -DRTE_USE_CBOOL"
RRTMGP_ROOT: ${{ github.workspace }}
RTE_KERNELS: extern
steps:
#
# Check out repository under $GITHUB_WORKSPACE
#
- name: Check out code
uses: actions/checkout@v4
#
# Build libraries
#
- name: Build libraries
run: |
$FC --version
make -j4 libs
51 changes: 35 additions & 16 deletions .github/workflows/containerized-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ on:
jobs:
Containerized-CI:
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
fortran-compiler: [ifort, ifx, nvfortran]
rte-kernels: [default, accel]
fpmodel: [DP, SP]
include:
# The tests are not experimental by default:
- experimental: false
# Set flags for Intel Fortran Compiler Classic
- fortran-compiler: ifort
fcflags: -m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08
fcflags: -m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08 -diag-disable=10448
# Set flags for Intel Fortran Compiler
- fortran-compiler: ifx
rte-kernels: default
fcflags: -debug -traceback -O0 -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08
- fortran-compiler: ifx
rte-kernels: accel
fcflags: -debug -traceback -O0 -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08 -fiopenmp -fopenmp-targets=spir64
experimental: true
# Set flags for NVIDIA Fortran compiler
- fortran-compiler: nvfortran
rte-kernels: default
Expand All @@ -42,11 +38,11 @@ jobs:
fcflags: -Mallocatable=03 -Mstandard -Mbounds -Mchkptr -Kieee -Mchkstk -acc
# Set container images
- fortran-compiler: ifort
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:ifort
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi
- fortran-compiler: ifx
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:ifort
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi
- fortran-compiler: nvfortran
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:nvfortran
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:nvhpc
container:
image: ${{ matrix.image }}
env:
Expand Down Expand Up @@ -76,30 +72,53 @@ jobs:
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: v1.8.1
#
# Build libraries, examples and tests
# Build libraries, examples and tests (expect success)
#
- name: Build libraries, examples and tests
- name: Build libraries, examples and tests (expect success)
id: build-success
if: matrix.fortran-compiler != 'ifx' || matrix.rte-kernels != 'accel'
run: |
$FC --version
make libs
make -C build separate-libs
make -j4 libs
#
# Build libraries, examples and tests (expect failure)
#
- name: Build libraries, examples and tests (expect failure)
if: steps.build-success.outcome == 'skipped'
shell: bash
run: |
$FC --version
make -j4 libs 2> >(tee make.err >&2) && {
echo "Unexpected success"
exit 1
} || {
grep make.err -e 'Internal compiler error' && {
echo "Expected failure"
} || {
echo "Unexpected failure"
exit 1
}
}
#
# Run examples and tests
#
- name: Run examples and tests
run: make tests
if: steps.build-success.outcome != 'skipped'
run: make -j4 tests
#
# Relax failure thresholds for single precision
#
- name: Relax failure threshold for single precision
if: matrix.fpmodel == 'SP'
if: matrix.fpmodel == 'SP' && steps.build-success.outcome != 'skipped'
run: echo "FAILURE_THRESHOLD=3.5e-1" >> $GITHUB_ENV
#
# Compare the results
#
- name: Compare the results
run: make check
if: steps.build-success.outcome != 'skipped'
run: make -j4 check
#
# Generate validation plots
#
Expand All @@ -112,7 +131,7 @@ jobs:
#
- name: Upload validation plots
if: matrix.fortran-compiler == 'ifort' && matrix.rte-kernels == 'default' && matrix.fpmodel == 'DP'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: valdiation-plot
path: tests/validation-figures.pdf
18 changes: 9 additions & 9 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g -DRTE_USE_CBOOL -DRTE_USE_${{ matrix.fpmodel }}"
# Make variables:
NFHOME: /usr
FCINCLUDE: -I/usr/include
RRTMGP_ROOT: ${{ github.workspace }}
RRTMGP_DATA: ${{ github.workspace }}/rrtmgp-data
RUN_CMD:
Expand All @@ -52,6 +52,7 @@ jobs:
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: v1.8.1
#
# Synchronize the package index
#
Expand All @@ -66,7 +67,7 @@ jobs:
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: conda-pkgs
Expand All @@ -79,25 +80,24 @@ jobs:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment-noplots.yml
python-version: 3.9
python-version: 3.11
auto-activate-base: false
# Use the cache properly:
use-only-tar-bz2: true
#
# Build libraries, examples and tests
#
- name: Build libraries, examples and tests
- name: Build libraries
run: |
$FC --version
make libs
make -C build separate-libs
make -j4 libs
#
# Run examples and tests
#
- name: Run examples and tests
run: make tests
- name: Build and run examples and tests
run: make -j4 tests
#
# Compare the results
#
- name: Compare the results
run: make check
run: make -j4 check
4 changes: 2 additions & 2 deletions .github/workflows/doc-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
# Upload documentation
#
- name: Upload Documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: documentation
path: public/
Expand All @@ -70,7 +70,7 @@ jobs:
# Deploy documentation
#
- name: Deploy API Documentation
uses: JamesIves/github-pages-deploy-action@v4.5.0
uses: JamesIves/github-pages-deploy-action@v4.6.1
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/documentation' }}
with:
branch: gh-pages
Expand Down
107 changes: 102 additions & 5 deletions .github/workflows/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
if: |
github.repository_owner == 'earth-system-radiation' &&
( github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.owner.login == github.repository_owner )
( github.event.pull_request.head.repo.owner.login == github.repository_owner &&
github.event.pull_request.user.login != 'dependabot[bot]' ))
runs-on: ubuntu-latest
outputs:
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
Expand Down Expand Up @@ -61,7 +62,6 @@ jobs:
levante:
runs-on: ubuntu-latest
needs: levante-init
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
Expand All @@ -72,9 +72,6 @@ jobs:
- nag-cpu-default-SP
- nag-cpu-accel-DP
#- nag-cpu-accel-SP
include:
# The tests are not experimental by default:
- experimental: false
steps:
#
# Build, run and check (fetch the log)
Expand All @@ -100,3 +97,103 @@ jobs:
ref-type: tag
ref-name: ${{ needs.levante-init.outputs.ref-name }}
force: true
#
# Deferred GitLab pipelines on Lumi at CSC (see .gitlab/lumi.yml):
#
lumi-init:
if: |
github.repository_owner == 'earth-system-radiation' &&
( github.event_name != 'pull_request' ||
( github.event.pull_request.head.repo.owner.login == github.repository_owner &&
github.event.pull_request.user.login != 'dependabot[bot]' ))
runs-on: ubuntu-latest
outputs:
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
pipeline-id: ${{ steps.gl-create-pipeline.outputs.pipeline-id }}
steps:
#
# Check out GitHub repository
#
- name: Check out GitHub repository
uses: actions/checkout@v4
with:
fetch-depth: 0
#
# Push to GitLab repository
#
- name: Push to GitLab repository
id: g-push-rev
uses: "skosukhin/git-ci-hub-lab/g-push-rev@v1"
with:
remote-url: ${{ vars.GITLAB_SERVER }}/${{ vars.GITLAB_PROJECT }}.git
password: ${{ secrets.GITLAB_TOKEN }}
rev-id: ${{ github.sha }}
rev-signing-format: ssh
rev-signing-key: ${{ secrets.GITLAB_SIGNING_KEY }}
ref-type: tag
ref-message: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
force-push: true
#
# Create GitLab CI/CD Pipeline
#
- name: Create GitLab CI/CD Pipeline
id: gl-create-pipeline
uses: "skosukhin/git-ci-hub-lab/gl-create-pipeline@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
expected-sha: ${{ steps.g-push-rev.outputs.ref-commit }}
#
# Set up Python virtual environment (fetch the log)
#
- name: Set up Python virtual environment (fetch the log)
uses: "skosukhin/git-ci-hub-lab/gl-attach-job@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ steps.gl-create-pipeline.outputs.pipeline-id }}
job-name: setup-python
lumi:
runs-on: ubuntu-latest
needs: lumi-init
strategy:
fail-fast: false
matrix:
config-name:
- cce-gpu-openacc-DP
- cce-gpu-openacc-SP
steps:
#
# Build, run and check (fetch the log)
#
- name: Build, run and check (fetch the log)
uses: "skosukhin/git-ci-hub-lab/gl-attach-job@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ needs.lumi-init.outputs.pipeline-id }}
job-name: ${{ matrix.config-name }}
lumi-cleanup:
runs-on: ubuntu-latest
needs: [lumi-init, lumi]
if: always() && needs.lumi-init.result != 'skipped'
continue-on-error: true
steps:
- uses: "skosukhin/git-ci-hub-lab/gl-cancel-pipeline@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ needs.lumi-init.outputs.pipeline-id }}
- uses: "skosukhin/git-ci-hub-lab/gl-delete-ref@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
ref-type: tag
ref-name: ${{ needs.lumi-init.outputs.ref-name }}
force: true
Loading

0 comments on commit 41c5fcd

Please sign in to comment.