ecmwf-ifs / ecrad

ECMWF atmospheric radiation scheme
https://confluence.ecmwf.int/display/ECRAD
Apache License 2.0
48 stars 31 forks source link

Spartacus shortwave optimizations + avoiding double prec. in two-stream kernels #2

Closed peterukk closed 3 years ago

peterukk commented 3 years ago

Hello,

Here are the performance optimizations I discussed. Most of them target the expm computations in spartacus_sw. In my tests, the solver was about 45% faster (single core on an Intel laptop, ifort -O3).

Also included in this pull request is a fix to the two-stream kernels which removes the need for any double precision variables/computations by instead adjusting the minimum "k" parameter based on working precision. This change should be tested some more - I only tested the McICA and Spartacus shortwave and longwave solvers and found that net upwelling and downwelling fluxes for the test IFS profiles changed by less than 0.1 W/m2. The benefit is increased performance for single precision computations; 20-25% faster mcica_sw and mcica_lw in my tests. If you want, I can also scrap this and make a pull request for only spartacus_sw.

FussyDuck commented 3 years ago

CLA assistant check
All committers have signed the CLA.

rjhogan commented 3 years ago

Many thanks for this! Could I request the following changes please: