Skip to content

Commit

Permalink
Merge branch 'mark-petersen/ocn/fix-intel-opt-decomp' into next (PR #…
Browse files Browse the repository at this point in the history
…5356)

Move bottomDepthEdge calculation to single loop over all edges

After #5195 was merged, the MPAS-Ocean standalone test
ocean/baroclinic_channel/10km/decomp_test failed to match between 4 and
8 partitions, but only for intel optimized. All compass nightly suite
tests passed for gnu debug, gnu optimized, intel debug.

This PR solves the problem by merging the computation of bottomDepthEdge
into a single edge loop. Previously it was split into two loops,
1:nEdgesOwned (with many other calculations) and another from
nEdgesOwned+1:nEdgesArray(4). The intel optimized compiler must have
changed order-of-operations in these two loops for different partitions.

Fixes #5219
[BFB]
  • Loading branch information
jonbob committed Dec 13, 2022
2 parents 0acd39d + 824850e commit 02f05e1
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
edgeHaloComputeCounter, &! halo counters to reduce
cellHaloComputeCounter ! halo updates during cycling

integer, dimension(:), pointer :: nEdgesArray

real (kind=RKIND) :: &
normalThicknessFluxSum, &! sum of thickness flux in column
thicknessSum, &! sum of thicknesses in column
Expand Down Expand Up @@ -385,8 +383,6 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{

call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracersNew, 2)

call mpas_pool_get_dimension(meshPool,'nEdgesArray', nEdgesArray)

allocate(bottomDepthEdge(nEdgesAll+1))

if (config_transport_tests_flow_id > 0) then
Expand Down Expand Up @@ -775,8 +771,6 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
enddo
barotropicForcing(iEdge) = splitFact* &
normalThicknessFluxSum/thicknessSum/dt
bottomDepthEdge(iEdge) = thicknessSum &
- 0.5_RKIND*(sshNew(cell1) + sshNew(cell2))
do k = minLevelEdgeBot(iEdge), maxLevelEdgeTop(iEdge)
! These two steps are together here:
Expand All @@ -798,7 +792,7 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(cell1, cell2, k, thicknessSum)
do iEdge = nEdgesOwned+1, nEdgesArray(4)
do iEdge = 1, nEdgesHalo(config_num_halos+1)
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
thicknessSum = layerThickEdgeFlux(minLevelEdgeBot(iEdge),iEdge)
Expand Down

0 comments on commit 02f05e1

Please sign in to comment.