Skip to content

[Draft] Consolidating OpenACC device-host memory transfers #1307

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

Closed
wants to merge 88 commits into from

Conversation

abishekg7
Copy link
Collaborator

Current work in progress of the effort to consolidate OpenACC device <-> host memory transfers to just before and after the call to atm_srk3 in the subroutine atm_timestep in mpas_atm_time_integration.F

gdicker1 and others added 30 commits January 16, 2025 13:49
This commit adds an initial port of this routine using OpenACC. More
changes are needed for performance and data management.
Ensures the fields which don't change while the model is running are
present on the device from model startup to model shutdown.
Ensure that the other, non-invariant fields are available for this
routine. Variables that are overwritten during this routine are only
created while others are copied in. Any variables overwritten by this
routine are copied out at the end.

Timing for these transfers are reported in the output log file in the
new timer: 'atm_bdy_adjust_scalars [ACC_data_xfer]'.

Also add default(present) to parallel directives to ensure data movement
is correct and prevent any implicit data movements from the compiler.
…ep_finish

This commit provides an interim fix for a potential issue in limited area runs
relating to the uninitialized garbage cells in the 1st time level of theta_m.
Keep consistency with explicit loop schedules
Add nVertLevels and derefernce integer pointers to loop bounds so they
transfer to the GPU correctly. Also make loops in vertical dimension
explicit for OpenACC parallel loop directives.
Since this routine is called before mpas_atm_dynamics_init during
atm_core_init, these fields must also be transfered within
mpas_reconstruct_2d routine. After mpas_atm_dynamics_init, these fields
are not transferred during following uses of mpas_reconstruct_2d due to
OpenACC present_or_copyin behavior.
This change allows data needed for the mpas_reconstruct_2d routine to be
fetched onto the device (GPU) at the beginning and end of the routine.
The time for these transfers are captured in a new timer
'mpas_reconstruct_2d [ACC_data_xfer]'.
To this point, results are bit-wise identical.
The changes in this PR haven't been tested, and doing so will require modifying
specific namelist options and creating new baselines.
Default configuration gives bit-identical results.
There is some code that hasn't been tested because it requires non-default
namelist settings to activate.
Some untested code has been ported.
@abishekg7 abishekg7 marked this pull request as draft May 8, 2025 02:04
@abishekg7
Copy link
Collaborator Author

Replaced by #1315

@abishekg7 abishekg7 closed this May 13, 2025
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.

3 participants