From 3e21d47c34d93f66e5dfff185efb18e025278311 Mon Sep 17 00:00:00 2001 From: Abishek Gopal Date: Thu, 23 Jul 2026 09:06:01 -0600 Subject: [PATCH 1/3] Add timers --- src/core_atmosphere/dynamics/mpas_atm_time_integration.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F index 227fbde862..02cac93afa 100644 --- a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F +++ b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F @@ -5477,7 +5477,7 @@ subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdge !$acc end parallel !$OMP BARRIER - + call mpas_timer_start('atm_advance_scalars_mono_work_5481') !$acc parallel ! @@ -5549,7 +5549,7 @@ subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdge end do !$acc end parallel - + call mpas_timer_stop('atm_advance_scalars_mono_work_5481') !$OMP BARRIER !$acc parallel From 3e6c758ffd8b5cdfb325687a97d8e5a7ed2a43de Mon Sep 17 00:00:00 2001 From: Abishek Gopal Date: Thu, 23 Jul 2026 11:18:30 -0600 Subject: [PATCH 2/3] Opt 1 - Split into two parallel regions --- src/core_atmosphere/dynamics/mpas_atm_time_integration.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F index 02cac93afa..5faf7f8fcb 100644 --- a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F +++ b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F @@ -5519,11 +5519,11 @@ subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdge end do end do - + !$acc end parallel ! ! horizontal flux divergence for upwind update ! - + !$acc parallel ! upwind flux computation !$acc loop gang worker do iEdge=edgeStart,edgeEnd From 8122f7c7ea3521bc043c0cfffef4bbd74edccee0 Mon Sep 17 00:00:00 2001 From: Abishek Gopal Date: Thu, 23 Jul 2026 11:52:26 -0600 Subject: [PATCH 3/3] Opt 2 - Simplify vector loop in 2nd parallel region, move if condition to inside vector loop --- .../dynamics/mpas_atm_time_integration.F | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F index 5faf7f8fcb..b7386cdc6f 100644 --- a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F +++ b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F @@ -5536,15 +5536,12 @@ subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdge flux_upwind_tmp(k,iEdge) = dvEdge(iEdge) * dt * & (max(0.0_RKIND,uhAvg(k,iEdge))*scalar_old(k,cell1) + min(0.0_RKIND,uhAvg(k,iEdge))*scalar_old(k,cell2)) flux_tmp(k,iEdge) = dt * flux_arr(k,iEdge) - flux_upwind_tmp(k,iEdge) - end do - - if( config_apply_lbcs .and. (bdyMaskEdge(iEdge) == nRelaxZone) .or. (bdyMaskEdge(iEdge) == nRelaxZone-1) ) then - !$acc loop vector - do k=1,nVertLevels + + if( config_apply_lbcs .and. (bdyMaskEdge(iEdge) == nRelaxZone) .or. (bdyMaskEdge(iEdge) == nRelaxZone-1) ) then flux_tmp(k,iEdge) = 0.0_RKIND flux_arr(k,iEdge) = flux_upwind_tmp(k,iEdge) - end do - end if + end if + end do end do