Skip to content

Commit 03f6c1e

Browse files
committed
Merge branch 'atmosphere/acc_atm_zero_gradient_w_bdy_work' into develop (PR #1272)
This merge enables execution of the atm_zero_gradient_w_bdy_work subroutine on GPUs through the addition of OpenACC directives. * atmosphere/acc_atm_zero_gradient_w_bdy_work: Add OpenACC directives to enable executing atm_zero_gradient_w_bdy_work on GPUs.
2 parents a3046e6 + 125ff0b commit 03f6c1e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/core_atmosphere/dynamics/mpas_atm_time_integration.F

+19
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ subroutine mpas_atm_dynamics_init(domain)
238238
real (kind=RKIND), dimension(:), pointer :: fzp
239239
real (kind=RKIND), dimension(:,:,:), pointer :: zb
240240
real (kind=RKIND), dimension(:,:,:), pointer :: zb3
241+
integer, dimension(:), pointer :: nearestRelaxationCell
241242
#endif
242243

243244

@@ -376,6 +377,8 @@ subroutine mpas_atm_dynamics_init(domain)
376377
call mpas_pool_get_array(mesh, 'zb3', zb3)
377378
!$acc enter data copyin(zb3)
378379

380+
call mpas_pool_get_array(mesh, 'nearestRelaxationCell', nearestRelaxationCell)
381+
!$acc enter data copyin(nearestRelaxationCell)
379382
#endif
380383

381384
end subroutine mpas_atm_dynamics_init
@@ -450,6 +453,7 @@ subroutine mpas_atm_dynamics_finalize(domain)
450453
real (kind=RKIND), dimension(:), pointer :: fzp
451454
real (kind=RKIND), dimension(:,:,:), pointer :: zb
452455
real (kind=RKIND), dimension(:,:,:), pointer :: zb3
456+
integer, dimension(:), pointer :: nearestRelaxationCell
453457
#endif
454458

455459

@@ -588,6 +592,8 @@ subroutine mpas_atm_dynamics_finalize(domain)
588592
call mpas_pool_get_array(mesh, 'zb3', zb3)
589593
!$acc exit data delete(zb3)
590594

595+
call mpas_pool_get_array(mesh, 'nearestRelaxationCell', nearestRelaxationCell)
596+
!$acc exit data delete(nearestRelaxationCell)
591597
#endif
592598

593599
end subroutine mpas_atm_dynamics_finalize
@@ -6555,14 +6561,27 @@ subroutine atm_zero_gradient_w_bdy_work( w, bdyMaskCell, nearestRelaxationCell,
65556561

65566562
integer :: iCell, k
65576563

6564+
MPAS_ACC_TIMER_START('atm_zero_gradient_w_bdy_work [ACC_data_xfer]')
6565+
!$acc enter data copyin(w)
6566+
MPAS_ACC_TIMER_STOP('atm_zero_gradient_w_bdy_work [ACC_data_xfer]')
6567+
6568+
!$acc parallel default(present)
6569+
!$acc loop gang worker
65586570
do iCell=cellSolveStart,cellSolveEnd
65596571
if (bdyMaskCell(iCell) > nRelaxZone) then
65606572
!DIR$ IVDEP
6573+
!$acc loop vector
65616574
do k = 2, nVertLevels
65626575
w(k,iCell) = w(k,nearestRelaxationCell(iCell))
65636576
end do
65646577
end if
65656578
end do
6579+
!$acc end parallel
6580+
6581+
MPAS_ACC_TIMER_START('atm_zero_gradient_w_bdy_work [ACC_data_xfer]')
6582+
!$acc exit data copyout(w)
6583+
MPAS_ACC_TIMER_STOP('atm_zero_gradient_w_bdy_work [ACC_data_xfer]')
6584+
65666585

65676586
end subroutine atm_zero_gradient_w_bdy_work
65686587

0 commit comments

Comments
 (0)