Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Commit

Permalink
move empty sendlist checks up to pack call to be more DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
Larofeticus committed Dec 18, 2017
1 parent 61cee75 commit 80974b1
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/framework/mpas_dmpar.F
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 80974b1

Please sign in to comment.