@@ -280,6 +280,7 @@ subroutine mpas_halo_exch_group_complete(domain, groupName, iErr)
280280
281281 call refactor_lists(domain, groupName, iErr)
282282
283+ ! Logic to return early if there are no neighbors to send to
283284 if ( newGroup% nGroupSendNeighbors <= 0 ) then
284285 return
285286 end if
@@ -571,7 +572,6 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
571572
572573 ! Local variables
573574 integer :: i, bufstart, bufend
574- integer :: idxBuf, idxArr
575575 integer :: dim1, dim2
576576 integer :: i1, i2, j, iNeighbor, iReq
577577 integer :: iHalo, iEndp
@@ -624,7 +624,7 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
624624 messageType= MPAS_LOG_CRIT)
625625 end if
626626
627- ! Logic to return early if there no neighbors to send to
627+ ! Logic to return early if there are no neighbors to send to
628628 if ( group% nGroupSendNeighbors <= 0 ) then
629629 return
630630 end if
@@ -706,9 +706,8 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
706706 !$acc loop vector
707707 do j = 1 , maxNSendList
708708 if (j <= nSendLists(iHalo,iEndp)) then
709- idxBuf = packOffsets(iEndp) + sendListDst(j,iHalo,iEndp)
710- idxArr = sendListSrc(j,iHalo,iEndp)
711- group % sendBuf(idxBuf) = group % fields(i) % r1arr(idxArr)
709+ group % sendBuf(packOffsets(iEndp) + sendListDst(j,iHalo,iEndp)) = &
710+ group % fields(i) % r1arr(sendListSrc(j,iHalo,iEndp))
712711 end if
713712 end do
714713 end do
@@ -732,7 +731,6 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
732731
733732
734733 call mpas_timer_start(' packing_halo_exch' )
735- ! Kernels is good enough, use default present to force a run- time error if programmer forgot something
736734 !$acc parallel default(present) attach(group % fields(i) % r2arr) if (useGPUAwareMPI)
737735 !$acc loop gang collapse(3 )
738736 do iEndp = 1 , nSendEndpts
@@ -741,9 +739,8 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
741739 !$acc loop vector
742740 do i1 = 1 , dim1
743741 if (j <= nSendLists(iHalo,iEndp)) then
744- idxBuf = packOffsets(iEndp) + dim1 * (sendListDst(j,iHalo,iEndp) - 1 ) + i1
745- idxArr = sendListSrc(j,iHalo,iEndp)
746- group % sendBuf(idxBuf) = group % fields(i) % r2arr(i1,idxArr)
742+ group % sendBuf(packOffsets(iEndp) + dim1 * (sendListDst(j,iHalo,iEndp) - 1 ) + i1) = &
743+ group % fields(i) % r2arr(i1, sendListSrc(j,iHalo,iEndp))
747744 end if
748745 end do
749746 end do
@@ -772,10 +769,9 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
772769 !$acc loop vector
773770 do i1 = 1 , dim1
774771 if (j <= nSendLists(iHalo,iEndp)) then
775- idxBuf = packOffsets(iEndp) + dim1* dim2* (sendListDst(j,iHalo,iEndp) - 1 ) &
776- + dim1* (i2-1 ) + i1
777- idxArr = sendListSrc(j,iHalo,iEndp)
778- group % sendBuf(idxBuf) = group % fields(i) % r3arr(i1,i2,idxArr)
772+ group % sendBuf(packOffsets(iEndp) + dim1* dim2* (sendListDst(j,iHalo,iEndp) - 1 ) &
773+ + dim1* (i2-1 ) + i1) = &
774+ group % fields(i) % r3arr(i1, i2, sendListSrc(j,iHalo,iEndp))
779775 end if
780776 end do
781777 end do
@@ -863,9 +859,8 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
863859 !$acc loop vector
864860 do j = 1 , maxNRecvList
865861 if (j <= nRecvLists(iHalo,iEndp)) then
866- idxArr = recvListDst(j,iHalo,iEndp)
867- idxBuf = unpackOffsets(iEndp) + recvListSrc(j,iHalo,iEndp)
868- group % fields(i) % r1arr(idxArr) = group % recvBuf(idxBuf)
862+ group % fields(i) % r1arr(recvListDst(j,iHalo,iEndp)) = &
863+ group % recvBuf(unpackOffsets(iEndp) + recvListSrc(j,iHalo,iEndp))
869864 end if
870865 end do
871866 end do
@@ -888,9 +883,8 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
888883 !$acc loop vector
889884 do i1 = 1 , dim1
890885 if (j <= nRecvLists(iHalo,iEndp)) then
891- idxArr = recvListDst(j,iHalo,iEndp)
892- idxBuf = unpackOffsets(iEndp) + dim1 * (recvListSrc(j,iHalo,iEndp) - 1 ) + i1
893- group % fields(i) % r2arr(i1, idxArr) = group % recvBuf(idxBuf)
886+ group % fields(i) % r2arr(i1, recvListDst(j,iHalo,iEndp)) = &
887+ group % recvBuf(unpackOffsets(iEndp) + dim1 * (recvListSrc(j,iHalo,iEndp) - 1 ) + i1)
894888 end if
895889 end do
896890 end do
@@ -914,10 +908,9 @@ subroutine mpas_halo_exch_group_full_halo_exch(domain, groupName, withGPUAwareMP
914908 do i2 = 1 , dim2
915909 do i1 = 1 , dim1
916910 if (j <= nRecvLists(iHalo,iEndp)) then
917- idxArr = recvListDst(j,iHalo,iEndp)
918- idxBuf = unpackOffsets(iEndp) + dim1* dim2* (recvListSrc(j,iHalo,iEndp) - 1 ) &
919- + dim1* (i2-1 ) + i1
920- group % fields(i) % r3arr(i1, i2, idxArr) = group % recvBuf(idxBuf)
911+ group % fields(i) % r3arr(i1, i2, recvListDst(j,iHalo,iEndp)) = &
912+ group % recvBuf(unpackOffsets(iEndp) + dim1* dim2* (recvListSrc(j,iHalo,iEndp) - 1 ) &
913+ + dim1* (i2-1 ) + i1)
921914 end if
922915 end do
923916 end do
0 commit comments