From 80974b1b27aca654d16e95c51c9052cd2927defb Mon Sep 17 00:00:00 2001 From: Larofeticus Date: Mon, 18 Dec 2017 10:28:08 -0800 Subject: [PATCH] move empty sendlist checks up to pack call to be more DRY --- src/framework/mpas_dmpar.F | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/framework/mpas_dmpar.F b/src/framework/mpas_dmpar.F index ef82d27081..842b8e76e2 100644 --- a/src/framework/mpas_dmpar.F +++ b/src/framework/mpas_dmpar.F @@ -7933,6 +7933,7 @@ subroutine mpas_dmpar_exch_group_pack_buffers(allFieldsPool, exchangeGroup, iErr integer, optional, intent(out) :: iErr type (mpas_exchange_field_list), pointer :: exchFieldListPtr + type (mpas_communication_list), pointer :: commListPtr type (field1DInteger), pointer :: intField1D type (field2DInteger), pointer :: intField2D @@ -7949,6 +7950,9 @@ subroutine mpas_dmpar_exch_group_pack_buffers(allFieldsPool, exchangeGroup, iErr iErr = MPAS_DMPAR_NOERR end if + commListPtr => exchangeGroup % sendList + if (.not. associated(commListPtr)) return + ! Pack each feild entirely before moving on to the next field exchFieldListPtr => exchangeGroup % fieldList do while ( associated(exchFieldListPtr) ) @@ -8467,8 +8471,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field1d_integer(exchangeGroup, fiel iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, iBuffer) do listItem = 1, commListSize @@ -8532,8 +8534,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field2d_integer(exchangeGroup, fiel iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, iBuffer) do listItem = 1, commListSize @@ -8600,8 +8600,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field3d_integer(exchangeGroup, fiel iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, k, iBuffer) do listItem = 1, commListSize @@ -8670,8 +8668,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field1d_real(exchangeGroup, field, iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, iBuffer) do listItem = 1, commListSize @@ -8735,8 +8731,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field2d_real(exchangeGroup, field, iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, iBuffer) do listItem = 1, commListSize @@ -8802,8 +8796,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field3d_real(exchangeGroup, field, iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, k, iBuffer) do listItem = 1, commListSize @@ -8872,8 +8864,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field4d_real(exchangeGroup, field, iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, k, l, iBuffer) do listItem = 1, commListSize @@ -8945,8 +8935,6 @@ subroutine mpas_dmpar_exch_group_pack_buffer_field5d_real(exchangeGroup, field, iErr = MPAS_DMPAR_NOERR end if - commListPtr => exchangeGroup % sendList - if (.not. associated(commListPtr)) return commListSize = commListPtr % commListSize !$omp do private(commListPtr, listPosition, bufferOffset, nAdded, fieldCursor, exchListPtr, iExch, j, k, l, m, iBuffer) do listItem = 1, commListSize