Skip to content

Commit

Permalink
Fixing loop indentation and cleaning up exit data clause
Browse files Browse the repository at this point in the history
- copyout also deallocates device memory, so a delete is superfluous
- Fixing the indentation of loops
- Changing exit data clause to conform to style
  • Loading branch information
abishekg7 committed Aug 2, 2024
1 parent c41c187 commit 249a183
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/core_atmosphere/dynamics/mpas_atm_time_integration.F
Original file line number Diff line number Diff line change
Expand Up @@ -1663,29 +1663,29 @@ subroutine atm_rk_integration_setup( state, diag, nVertLevels, num_scalars, &
do iEdge = edgeStart,edgeEnd
!$acc loop vector
do k = 1,nVertLevels
ru_save(k,iEdge) = ru(k,iEdge)
u_2(k,iEdge) = u_1(k,iEdge)
ru_save(k,iEdge) = ru(k,iEdge)
u_2(k,iEdge) = u_1(k,iEdge)
end do
end do

!$acc loop gang worker
do iCell = cellStart,cellEnd
!$acc loop vector
do k = 1,nVertLevels
rtheta_p_save(k,iCell) = rtheta_p(k,iCell)
rho_p_save(k,iCell) = rho_p(k,iCell)
theta_m_2(k,iCell) = theta_m_1(k,iCell)
rho_zz_2(k,iCell) = rho_zz_1(k,iCell)
rho_zz_old_split(k,iCell) = rho_zz_1(k,iCell)
rtheta_p_save(k,iCell) = rtheta_p(k,iCell)
rho_p_save(k,iCell) = rho_p(k,iCell)
theta_m_2(k,iCell) = theta_m_1(k,iCell)
rho_zz_2(k,iCell) = rho_zz_1(k,iCell)
rho_zz_old_split(k,iCell) = rho_zz_1(k,iCell)
end do
end do

!$acc loop gang worker
do iCell = cellStart,cellEnd
!$acc loop vector
do k = 1,nVertLevels+1
rw_save(k,iCell) = rw(k,iCell)
w_2(k,iCell) = w_1(k,iCell)
rw_save(k,iCell) = rw(k,iCell)
w_2(k,iCell) = w_1(k,iCell)
end do
end do

Expand All @@ -1701,11 +1701,10 @@ subroutine atm_rk_integration_setup( state, diag, nVertLevels, num_scalars, &
!$acc end parallel

MPAS_ACC_TIMER_START('atm_rk_integration_setup [ACC_data_xfer]')
!$acc exit data copyout(ru_save, rw_save, rtheta_p_save, rho_p_save) &
!$acc copyout(u_2, w_2, theta_m_2, rho_zz_2, rho_zz_old_split, scalars_2)
!$acc exit data delete(ru, ru_save, rw, rw_save, rtheta_p, rtheta_p_save) &
!$acc delete(rho_p, rho_p_save, u_1, u_2, w_1, w_2, theta_m_1, theta_m_2) &
!$acc delete(rho_zz_1, rho_zz_2, rho_zz_old_split, scalars_1, scalars_2)
!$acc exit data copyout(ru_save, rw_save, rtheta_p_save, rho_p_save, u_2, &
!$acc w_2, theta_m_2, rho_zz_2, rho_zz_old_split, scalars_2) &
!$acc delete(ru, rw, rtheta_p, rho_p, u_1, w_1, theta_m_1, &
!$acc rho_zz_1, scalars_1)
MPAS_ACC_TIMER_STOP('atm_rk_integration_setup [ACC_data_xfer]')

end subroutine atm_rk_integration_setup
Expand Down

0 comments on commit 249a183

Please sign in to comment.