Transitions Newsletter Header

Bridges to Operations: Single-Precision Physics in CCPP

Autumn 2022

A constant struggle in NWP model design is the tradeoff between scientific improvements and computational cost. A method commonly used to balance that tradeoff is lowering some numerical calculations to single precision (or 32-bit calculations). Often, single-precision calculations have enough precision for physics, and they reduce disk storage, memory usage, and computation time. To apply single-precision calculations correctly, it is necessary to carefully evaluate and fine-tune algorithms, and perhaps in isolated places of the code, perform calculations in double precision (64 bits).

This approach is already used in several operational models. For example, the NOAA operational RAP and HRRR models (which use the WRF model) primarily use single-precision physics and the ECMWF Integrated Forecasting System (IFS) model recently switched the bulk of its physics calculations from double to single precision. However, until recently, the DTC-hosted Common Community Physics Package (CCPP), which is directly used by the UFS modeling system, was missing this key capability.

Earlier this year, the US Naval Research Laboratory (NRL) successfully enabled a single-precision physics suite in the Navy Environmental Prediction System Using the NUMA CorE (NEPTUNE) model. They focused on developing the RAP software suite available via the CCPP, leveraging previous work done over the years by the broad community that developed the RAP model. This suite had previously been widely tested and carefully tuned to work well with most of the code in single precision, while retaining key parts of the code in double precision. NRL’s work corrected some imprecise calculations and troublesome constants, addressing issues that were not present in the WRF version of the same parameterizations. 

This technical achievement by NRL, which was made available to the CCPP authoritative code repository, paved the way for the DTC to make the single-precision RAP suite more widely available. The DTC generalized the code and added support to the UFS, which employs the FV3 dynamical core. Since the UFS already supported both single and double precision for dynamics, the logic of mixed precision already existed, at least conceptually. Therefore, most of the work was of a mechanical nature: fixing type mismatches in the code and in connections to coupling, libraries, and stochastic physics.

The outcome of this work is that the single-precision RAP suite now works technically in the UFS. So far it has only been tested at low resolution, and results indicate that it runs approximately 25% faster than at double precision. 

There is much work to be done before single-precision physics in CCPP can be considered a finished product. First, scientific validation of the RAP suite has to be conducted, which may reveal the need for additional code adjustments. Second, further development could reduce computation cost of calculations. UFS only reads and writes files with double-precision floating point, and some areas of the code may still convert between single and double precision unnecessarily. Finally, additional suites could be made to work in single precision. This work has laid the foundation for budding capability on which the DTC and the community will be able to build, but only if agencies continue to invest in this development.

Contributed by Samuel Trahan (NOAA GSL and CU CIRES) and Ligia Bernardet (NOAA GSL)