-
Notifications
You must be signed in to change notification settings - Fork 330
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_divergence_damping_3d via OpenACC #1237
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2599,6 +2599,13 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart | |
rdts = 1.0_RKIND / dts | ||
coef_divdamp = 2.0_RKIND * smdiv * config_len_disp * rdts | ||
|
||
MPAS_ACC_TIMER_START('atm_divergence_damping_3d [ACC_data_xfer]') | ||
!$acc enter data copyin(ru_p, rtheta_pp, rtheta_pp_old, specZoneMaskEdge, & | ||
!$acc theta_m, cellsOnEdge) | ||
MPAS_ACC_TIMER_STOP('atm_divergence_damping_3d [ACC_data_xfer]') | ||
|
||
!$acc parallel async | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it would be best to remove this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed this async, but wanted to note that there's another one in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think we're good to leave that |
||
!$acc loop gang worker | ||
do iEdge=edgeStart,edgeEnd ! MGD do we really just need edges touching owned cells? | ||
|
||
cell1 = cellsOnEdge(1,iEdge) | ||
|
@@ -2608,6 +2615,7 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart | |
if (cell1 <= nCellsSolve .or. cell2 <= nCellsSolve ) then | ||
|
||
!DIR$ IVDEP | ||
!$acc loop vector | ||
do k=1,nVertLevels | ||
|
||
!! unscaled 3d divergence damping | ||
|
@@ -2625,6 +2633,13 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart | |
end do | ||
end if ! edges for block-owned cells | ||
end do ! end loop over edges | ||
!$acc end parallel | ||
|
||
MPAS_ACC_TIMER_START('atm_divergence_damping_3d [ACC_data_xfer]') | ||
!$acc exit data copyout(ru_p) delete(rtheta_pp, rtheta_pp_old, & | ||
!$acc specZoneMaskEdge, theta_m, cellsOnEdge) | ||
MPAS_ACC_TIMER_STOP('atm_divergence_damping_3d [ACC_data_xfer]') | ||
|
||
|
||
end subroutine atm_divergence_damping_3d | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specZoneMaskEdge
andcellsOnEdge
are invariant fields (the won't change after init). I believe your PR should make sure these variables are handled inatm_dynamics_init
and shouldn't copyin or delete these fields inatm_divergence_damping_3d
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that the convention we've been following so far? I assumed the routine to be ported has localized data movement clauses. I might also need to rework my other PRs if this is the case. Thanks for pointing it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to follow up.. Talked to @mgduda, and got this cleared up. Will make changes to these invariant fields. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been following that pattern, it was set in #1176.
I've been doing things similarly to what may happen here - do all the data movement that is needed locally for the function being ported, and then separate out those invariant fields and handle them in the
atm_dynamics_{init,finalize}
routines. Typically these invariant fields are part of themesh
var_struct as described in the src/core_atmosphere/Registry.xml.