EGU21-12427, updated on 12 Jan 2022
EGU General Assembly 2021
© Author(s) 2022. This work is distributed under
the Creative Commons Attribution 4.0 License.

An automatic implementation of the mixed precision in NEMO 4.2

Stella Valentina Paronuzzi Ticco1, Oriol Tintó Prims2, Mario Acosta Cobos1, and Miguel Castrillo Melguizo1
Stella Valentina Paronuzzi Ticco et al.
  • 1Barcelona Supercomputing Center, Earth Science, Barcelona, Spain (
  • 2LMU Munich (

At the beginning of 2021 a mixed precision version of the NEMO code was included into the official NEMO repository. The implementation followed the approach presented in Tintó et al. 2019. The proposed optimization despite being not at all trivial, is not new, and quite popular nowadays. In fact, for historical reasons many computational models over-engineer the numerical precision, which leads to an under-optimal exploitation of computational infrastructures. By solving this miss-adjustment a conspicuous payback in terms of efficiency and throughput can be gained: we are not only taking a step toward a more environmentally friendly science, sometimes we are actually pushing the horizon of experiment feasibility a little further. For being able to smoothly include the changes needed in the official release an automatic workflow has been implemented: we attempt to minimize the number of changes required and, at the same time, maximize the number of variables that can be computed using single precision. Here we present a general sketch of the tool and workflow used.
Starting from the original code, we automatically produce a new version of the same, where the user can specify the precision of each real variable therein declared. With this new executable, a numerical precision analysis can be performed: a search algorithm specially designed for this task will drive a workflow manager toward the creation of a list of variables that is safe to switch to single precision. The algorithm compares the result of each intermediate step of the workflow with reliable results from a double precision version of the same code, detecting which variables need to retain a higher accuracy.
The result of this analysis is eventually used to perform the modification needed into the code in order to produce the desired working mixed precision version, while also keeping the number of necessary changes low. Finally, the previous double precision and the new mixed precision versions will be compared, including a computational comparison and a scientific validation to prove that the new version can be used for operational configurations, without losing accuracy and increasing the computational performance dramatically.

How to cite: Paronuzzi Ticco, S. V., Tintó Prims, O., Acosta Cobos, M., and Castrillo Melguizo, M.: An automatic implementation of the mixed precision in NEMO 4.2, EGU General Assembly 2021, online, 19–30 Apr 2021, EGU21-12427,, 2021.