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

Enable GPU exection of atm_advance_acoustic_step via OpenACC #1251

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

gdicker1
Copy link
Collaborator

@gdicker1 gdicker1 commented Dec 6, 2024

This PR makes small code modifications and adds OpenACC directives so the atm_advance_acoustic_step_work routine can execute on GPU(s).

Timing information for the OpenACC data transfers in this routine is captured in the log file by a new timer: atm_advance_acoustic_step [ACC_data_xfer].

Invariant fields used in this routine are also copied to the device within mpas_atm_dynamics_init and are deleted in mpas_atm_dynamics_finalize.

These changes are mostly cosmetic and to remove unnecessary characters.

In one case, these modifcations make the specZoneMaskCell if condition
more apparent. The improved readability will help the porting steps that
follow.
This includes grouping together some variable assignments to reduce if
conditions, making array assignments explicit to ensure the operations
are parallelizable, and fusing some loops that have the same bounds to
reduce iterations.
Use OpenACC parallel and loop directives so this work routine can be
executed on a GPU. More changes will be needed to improve performance.
@mgduda mgduda added Atmosphere OpenACC Work related to OpenACC acceleration of code labels Dec 13, 2024
@mgduda mgduda requested review from mgduda and abishekg7 December 13, 2024 20:35
@gdicker1
Copy link
Collaborator Author

NOTE: This PR is paused. I am sorting out the merge conflicts and a run-time error. I will notify again when this PR is ready for review.

@gdicker1 gdicker1 force-pushed the atmosphere/acc_advance_acoustic_step branch from 58ba84a to 0730fa2 Compare January 7, 2025 20:52
@gdicker1
Copy link
Collaborator Author

gdicker1 commented Jan 7, 2025

Force push from 58ba84a to 0730fa2 is to bring this more in line with the develop branch. This PR should now be ready for review, @mgduda!

Ensures the fields which don't change while the model is running are
present on the device from model startup until model shutdown.

It builds on the changes in PR MPAS-Dev#1176 to copyin invariant fields during
mpas_atm_dynamics_init and delete them from the device during
mpas_atm_dynamics_finalize.
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_advance_acoustic_step [ACC_data_xfer]'.
@gdicker1 gdicker1 force-pushed the atmosphere/acc_advance_acoustic_step branch from 0730fa2 to 09e60a5 Compare January 10, 2025 19:35
@gdicker1
Copy link
Collaborator Author

Force-push 0730fa2 to 09e60a5 to consistently add new invariant fields at the end of sections in mpas_atm_dynamics_{init,finalize}.

@mgduda and @abishekg7 this should be ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atmosphere OpenACC Work related to OpenACC acceleration of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants