Skip to content

Commit

Permalink
Using default(present) in the parallel clause for atm_divergence_damp…
Browse files Browse the repository at this point in the history
…ing_3d

This commit introduces changes in order to replace the structured data clause
with a default(present) statement in the parallel clause. This change also
requires dereferencing the pointers to nCellsSolve and nVertLevels, in order to
avoid runtime error messages such as the following:

FATAL ERROR: data in PRESENT clause was not found on device 1: name=ncellssolve
  • Loading branch information
abishekg7 committed Jan 15, 2025
1 parent 4e1b7a7 commit 3b82420
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/core_atmosphere/dynamics/mpas_atm_time_integration.F
Original file line number Diff line number Diff line change
Expand Up @@ -2584,8 +2584,10 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart
real (kind=RKIND), dimension(:), pointer :: specZoneMaskEdge
integer, dimension(:,:), pointer :: cellsOnEdge
integer, pointer :: nCellsSolve
integer, pointer :: nVertLevels
integer, pointer :: nCellsSolve_ptr
integer, pointer :: nVertLevels_ptr
integer :: nCellsSolve
integer :: nVertLevels
real (kind=RKIND) :: divCell1, divCell2, rdts, coef_divdamp
integer :: cell1, cell2, iEdge, k
Expand All @@ -2598,21 +2600,23 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart
call mpas_pool_get_array(diag, 'rtheta_pp_old', rtheta_pp_old)
call mpas_pool_get_array(diag, 'ru_p', ru_p)
call mpas_pool_get_dimension(mesh, 'nCellsSolve', nCellsSolve)
call mpas_pool_get_dimension(mesh, 'nVertLevels', nVertLevels)
call mpas_pool_get_dimension(mesh, 'nCellsSolve', nCellsSolve_ptr)
call mpas_pool_get_dimension(mesh, 'nVertLevels', nVertLevels_ptr)
call mpas_pool_get_config(configs, 'config_smdiv', smdiv)
call mpas_pool_get_config(configs, 'config_len_disp', config_len_disp)
rdts = 1.0_RKIND / dts
coef_divdamp = 2.0_RKIND * smdiv * config_len_disp * rdts
nCellsSolve = nCellsSolve_ptr
nVertLevels = nVertLevels_ptr
MPAS_ACC_TIMER_START('atm_divergence_damping_3d [ACC_data_xfer]')
!$acc data present(specZoneMaskEdge, cellsOnEdge)
!$acc enter data copyin(ru_p, rtheta_pp, rtheta_pp_old, theta_m)
MPAS_ACC_TIMER_STOP('atm_divergence_damping_3d [ACC_data_xfer]')
!$acc parallel
!$acc parallel default(present)
!$acc loop gang worker
do iEdge=edgeStart,edgeEnd ! MGD do we really just need edges touching owned cells?
Expand Down Expand Up @@ -2646,7 +2650,6 @@ subroutine atm_divergence_damping_3d( state, diag, mesh, configs, dts, edgeStart
MPAS_ACC_TIMER_START('atm_divergence_damping_3d [ACC_data_xfer]')
!$acc exit data copyout(ru_p) &
!$acc delete(rtheta_pp, rtheta_pp_old, theta_m)
!$acc end data
MPAS_ACC_TIMER_STOP('atm_divergence_damping_3d [ACC_data_xfer]')
Expand Down

0 comments on commit 3b82420

Please sign in to comment.