Changes to ensure RRTMGP for use on multiple threads.#568
Conversation
…ine when referencing.
climbfuji
left a comment
There was a problem hiding this comment.
Changes look good.
I don't understand why the $omp critical statements are needed, because by definition/CCPP requirement the _init phases are called outside of threaded environments. You can use threading inside the _init routine, provided that you do things like $OMP parallel num_threads(my_num_threads) where my_num_threads is a variable similar to mpicomm, but the call to the _init routine is definitely not happening by multiple threads.
At any rate, those $omp critical statements don't hurt, they may at worst cause confusion.
Will approve once the regression tests passed on all platforms.
@climbfuji |
|
@climbfuji |
| use mo_optical_props, only: ty_optical_props_1scl | ||
| use mo_compute_bc, only: compute_bc | ||
| use rrtmgp_aux, only: check_error_msg | ||
| use GFS_rrtmgp_pre, only: active_gases_array |
There was a problem hiding this comment.
This seems a bit weird to me to be passing in something to RRTMGP internal code from a GFS-based interstitial scheme. Seems like this could affect future portability, right? Is this necessary?
There was a problem hiding this comment.
I agree, but I couldn't get the code to work w/ multiple threads with active_gases_array defined as an Interstitial.
There was a problem hiding this comment.
Thanks for the reply. If it's critical to what the PR is trying to fix, then no problem. Maybe there will be a different solution in the future. I'm just thinking in terms of building a non-GFS-based suite with RRTMGP in the future. It would require some modifications to deal with this. That bridge can be crossed when the time comes.
grantfirl
left a comment
There was a problem hiding this comment.
I didn't see anything that raises my hackles CCPP-wise except for one comment that I made about passing in something via module from a GFS interstitial scheme.
This PR contains several changes to the initialization and setup of the RRTMGP radiation scheme to allow for use across multiple openMP threads. Additionally, MPI commands were added to the initialization routines.
*) Moved Interstitial RRTMGP DDTs (ty_rrtmgp_gas_optics, ty_cloud_optics) to static fields defined during initialization in module memory.
*) Add "$omp critical" statements around the calling type-bound procedures during initialization.
*) Move allocation of ty_gas_conc from Interstitial to GFS_typedefs. Initialize ty_gas_concs for all blocks during initialization.
The GP regression tests on hera using this branch were successful.