Skip to content

GPU COARE 3.6 kernel — 1229x speedup at 1M ocean grid points #7

Description

@consigcody94

Summary

The COARE 3.6 bulk air-sea flux algorithm runs on GPU with one thread per ocean grid point. The 10-iteration Monin-Obukhov stability loop is compute-intensive (exp, log, sqrt, pow, atan, cbrt per iteration), making this well-suited for GPU.

Benchmark (RTX 3060)

Grid Points CPU GPU Speedup Max Rel Error (tau/hsb/hlb)
10K 18 ms 0.028 ms 643x 1.4e-06 / 2.3e-06 / 8.3e-04
100K 171 ms 0.171 ms 999x 1.8e-06 / 4.6e-06 / 1.0e-03
500K 854 ms 0.712 ms 1200x 3.0e-06 / 4.6e-06 / 2.1e-03
1M 1723 ms 1.40 ms 1229x 5.4e-06 / 4.6e-06 / 2.1e-03

Zero NaN across all configurations. The latent heat flux has slightly higher relative error (2.1e-03) due to GPU fast exp (__expf) in the saturation vapor pressure calculation. Momentum and sensible heat fluxes are accurate to < 6e-06.

Implementation

The GPU kernel implements the same iterative algorithm as module_coare36_model.f90:

  • Saturation vapor pressure (Tetens-Magnus)
  • Monin-Obukhov stability functions (psiu_26, psit_26)
  • Charnock roughness length
  • Transfer coefficients with stability correction
  • Cool-skin terms (simplified in this benchmark)

Each grid point runs independently in registers. The 10 iterations per point give high arithmetic intensity (~200 FLOPs/point/iteration), which is why GPU utilization is so high.

Code

https://github.com/consigcody94/noaa-gpu-kernels/tree/main/ocean/coare

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions