Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add labels to "end type" statements to eliminate warnings in CCPP pre… #164

Conversation

mkavulich
Copy link

This PR adds labels for "end type" statements in the rrtmgp code. These end statements are technically not required by the CCPP standards, but all other "end" statements in CCPP must be labeled, and this helps reduce the potential for ambiguity in the code. These changes will also eliminate warnings when running ccpp_prebuild.py and the new ccpp_track_variables.py script (NCAR/ccpp-framework#419):

WARNING:root:In file mo_gas_optics_rrtmgp.F90, module mo_gas_optics_rrtmgp
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_gas_optics_rrtmgp
WARNING:root:In file mo_optical_props.F90, module mo_optical_props
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props
WARNING:root:In file mo_optical_props.F90, module mo_optical_props

etc.

This should have no change in results, as it is simply for human (and CCPP) readability.

dustinswales and others added 30 commits May 8, 2019 13:18
…ion#25)

* Missed one file in last commit

* tweaks for CPU compilation

* In OpenACC: allocating types as well as data components in ACC copyins, deletes

* Ignoring things for Luis...

* Missing statement

* Aligning array sizes in kernels with arguments

* Refined argument intents for some kernels

* Workaround for PGI compiler problem with logicals

* Input sanitizing gets it own module

* Yeah, we'll need the sanitizing module too.

* OpenACC-compatible checking for max and min values

* OpenACC value checking working; OLCF makefile doesn't use managed memory

* Logical kind chosen with pre-preprocessor flags
-- Several small bug fixes (argument intent, maximum interpolation indices, thanks to Sebastian Rast)
-- Parameterized checking for out-of-range values (works also on GPU)
-- Continuous integration with Travis (thanks to Valentin Clement)
-- Logical type defaults to Fortran; can be set to use c_bool with -DUSE_CBOOL
-- Internal build system can use environmental variables instead of specified files (Makefile.conf etc.) to define compilers, flags, choose kernel directory
-- Python scripts to automate running and testing of RFMIP examples
-- Update RFMIP examples to use version 1.2 of atmospheres file
-- End-to-end RFMIP examples on GPU are broken; fixes pending
…on#29)

Remove nullify statements on declaration of pointers in subroutines to ensure
thread safety for mo_gas_optics_rrtmgp. When pointers get assigned in
declarations, they implicitly get a save attribute and are assumed static. This
is a problem when then occurs in a threaded region, so this code was NOT
thread-safe before. Removing the `=> NULL()` does not change the behavior of the
code for non-threaded applications, but does ensure thread-safety.
Open coefficients files for read-only, rather than read-write access
because we do NOT want to accidentally write to these files, nor do we
want to require users to have write-permissions to load these files.

Closes earth-system-radiation#31, earth-system-radiation#32.
* Shortwave RFMIP running end-to-end on GPU. Boundary conditions still on CPU.

* Upper boundary condition lives on GPU in LW no-scattering calculation.

* Moved optical props validation in rte_lw(); simplified data movement in gas optics. Source function still sloshing back and forth between host and device.

* Surface emissivity computed on GPU in LW RFMIP example

* Moved transposition of surface Planck source onto GPU, clumsily; LW RFMIP cases now running end-to-end on device.

* RFMIP boundary conditions on GPU; removing async (may add back later)

* Reorder kernels use a single source

* Moving array-zeroing routines into mo_util_array

* Single-source for array utilities

* rte_sw uses array utilities to check validity of boundary conditions

* Adding 1D array-zeroing routine

* Some SW RFMIP boundary conditions on GPU.

* Single-source for fluxes_broadband_kernels

* Removing an unneeded OpenACC data transfer

* Array value checking uses functions in mo_rte_lw; syntactic cleanup

* Correcting mal-formed Makefile

* Refined copying of one array in SW examples.

* Ben Hillman spots a GPU array being initialized on the CPU. Fixed that.
Contributions from Dmitry Alexeev from Nvidia. Dramatically improves performance of clear-sky RFMIP standalone cases on GPUs. Fixes compiler bug in PGI related to private local variables. 

* tiling reorder, could still be improved by about 40%

* using kernels in the mo_util_array, faster and more compact

* constant shouldn't be explicitly allocated

* tile combine_and_reorder, almost full bandwidth now

* process several elements per thread in expensive kernels

* fix interpolation, use gang vector

* add another kernel for optical_depths_minor, only working in a special case (hopefully typical case). about 3x faster.

* avoid atomics in sum_broadband, 2.5x faster

* explicitly make private arrays stay in global memory, fixed possible errors and 8x faster due to collapsed loop

* fuse lw_source_noscat into lw_solver_noscat, faster by about 1ms on Piz Daint

* fixed subscript typo in denom

* fix out-of-bounds issue

* added comments about how the reorder kernels work

* introduce point-wise lw_source_noscat_stencil to express concepts separation while keeping fused loops

* added comments explaining bug workaround for adding routine

* fixed unrolled loop bounds and added comments

* removed unused variable

* added missing data deletion

* remove the default kernel in gas_optical_depths_minor, the optimized kernel can deal with variable number of g-points per band now
…PUs during calculations (earth-system-radiation#53)

Should be more tightly integrated with host models already running on the GPU.
RobertPincus and others added 16 commits April 13, 2021 22:01
* Fix CCPP metadata in several files, convert from dos to unix line endings

* Revert line endings change in rte/mo_optical_props.F90
@RobertPincus
Copy link
Member

Hi, thanks for this contribution @mkavulich. I don't mind doing this - could you please change the target of the PR to develop? The changes will make their way downstream to dtc/ccpp eventually.

@mkavulich
Copy link
Author

@RobertPincus Sure, I originally had targeted there but I didn't realize the branches had diverged so much, so my PR (based on the dtc/ccpp branch) was bringing in a lot of unrelated changes to develop. I can re-open this PR based on the develop branch.

@RobertPincus
Copy link
Member

@mkavulich Aha. Mayne don't bother then - the changes are small enough that I can introduce them by hand.

RobertPincus added a commit that referenced this pull request Apr 8, 2022
RobertPincus added a commit that referenced this pull request Apr 9, 2022
1. Narrow the range of public procedures in the Fortran kernel modules; the remaining ~12 are the kernel API.
2. Remove C bindings from any non-public functions (#161)
3. C-bindings are now prefixed with "rte_" or "rrtmgp_" (#158)
4. Add labels to end type statements (#164)
5. Remove unneeded array-reordering kernels
6. Update use of conda in continuous integration using Github Actions
@mkavulich mkavulich changed the base branch from dtc/ccpp to main April 21, 2022 20:38
@mkavulich mkavulich changed the base branch from main to develop April 21, 2022 20:38
@mkavulich mkavulich changed the base branch from develop to main April 21, 2022 20:40
@mkavulich mkavulich closed this Apr 21, 2022
@mkavulich mkavulich reopened this Apr 21, 2022
@dustinswales
Copy link
Contributor

@mkavulich
You can close this.
Robert made this change in develop, which I will pull into dtc/ccpp and update the ccpp-physics hash

@mkavulich
Copy link
Author

@dustinswales Sounds good, thanks for looking into it!

@mkavulich mkavulich closed this Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.