Skip to content

Introduce OpenMP in GEOS_SolarGridComp: hybrid parallelism for RRTMGP block loop #1387

@tclune

Description

@tclune

Motivation

GEOS_SolarGridComp.F90 contains a do b = 1,nBlocks loop inside SORADCORE (which is an internal subroutine of RUN) that processes RRTMGP shortwave radiative transfer in chunks of columns. Each iteration is independent — inputs are read-only slices colS:colE of shared arrays, outputs are written to non-overlapping colS:colE slices, and all per-block temporaries are allocated fresh each iteration. This makes the loop an excellent candidate for ! PARALLEL DO.

Approach

To safely introduce OpenMP we will first refactor cautiously, keeping the code compilable and correct at each step before any OpenMP directives are added:

  1. Extract loop body into a subroutine — pull the body of do b = 1,nBlocks into a new contained subroutine (e.g. PROCESS_RRTMGP_BLOCK). Per-block allocatables become local variables (thread-private by construction); shared arrays become explicit dummy arguments.
  2. Verify bit-reproducibility with the extracted subroutine before touching anything else.
  3. Add ! PARALLEL DO to the loop calling the new subroutine.
  4. Verify correctness under OpenMP.

Assumption

RRTMGP library routines called within the block loop (rte_sw, gas/cloud optics kernels, etc.) are assumed to be thread-safe. This has been confirmed by RRTMGP developers. No locking around RRTMGP calls is therefore required.

Tracking

Step-by-step plan and code changes tracked in the associated PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions