This module provides routines for doing MxN transfer of data in an Attribute Vector between two components on separate sets of MPI processes. Uses the Router datatype.
SEE ALSO:
m_RearrangerINTERFACE:
module m_TransferUSES:
use m_MCTWorld, only : MCTWorld use m_MCTWorld, only : ThisMCTWorld use m_AttrVect, only : AttrVect use m_AttrVect, only : nIAttr,nRAttr use m_AttrVect, only : Permute, Unpermute use m_AttrVect, only : AttrVect_init => init use m_AttrVect, only : AttrVect_copy => copy use m_AttrVect, only : AttrVect_clean => clean use m_AttrVect, only : lsize use m_Router, only : Router use m_mpif90 use m_die use m_stdio implicit none private ! exceptPUBLIC MEMBER FUNCTIONS:
public :: isend public :: send public :: waitsend public :: irecv public :: recv public :: waitrecv interface isend ; module procedure isend_ ; end interface interface send ; module procedure send_ ; end interface interface waitsend ; module procedure waitsend_ ; end interface interface irecv ; module procedure irecv_ ; end interface interface recv ; module procedure recv_ ; end interface interface waitrecv ; module procedure waitrecv_ ; end interfaceDEFINED PARAMETERS:
integer,parameter :: DefaultTag = 600REVISION HISTORY:
08Nov02 - R. Jacob <jacob@mcs.anl.gov> - make new module by combining
MCT_Send, MCT_Recv and MCT_Recvsum
11Nov02 - R. Jacob <jacob@mcs.anl.gov> - Remove MCT_Recvsum and use
optional argument in recv_ to do the same thing.
23Jul03 - R. Jacob <jacob@mcs.anl.gov> - Move buffers for data and
MPI_Reqest and MPI_Status arrays to Router. Use them.
24Jul03 - R. Jacob <jacob@mcs.anl.gov> - Split send_ into isend_ and
waitsend_. Redefine send_.
22Jan08 - R. Jacob <jacob@mcs.anl.gov> - Handle unordered GSMaps
Send the the data in the AttrVect aV to the component specified in the Router Rout. An error will result if the size of the attribute vector does not match the size parameter stored in the Router.
Requires a corresponding recv_ or irecv_ to be called on the other component.
The optional argument Tag can be used to set the tag value used in the data transfer. DefaultTag will be used otherwise. Tag must be the same in the matching recv_ or irecv_.
N.B.: The AttrVect argument in the corresponding recv_ call is assumed to have exactly the same attributes in exactly the same order as aV.
INTERFACE:
subroutine isend_(aVin, Rout, Tag)USES:
implicit noneINPUT PARAMETERS:
Type(AttrVect),target,intent(in) :: aVin
Type(Router), intent(inout) :: Rout
integer,optional, intent(in) :: Tag
REVISION HISTORY:
07Feb01 - R. Jacob <jacob@mcs.anl.gov> - initial prototype
08Feb01 - R. Jacob <jacob@mcs.anl.gov> - First working code
18May01 - R. Jacob <jacob@mcs.anl.gov> - use MP_Type to determine type in mpi_send
07Jun01 - R. Jacob <jacob@mcs.anl.gov> - remove logic to check "direction" of Router.
remove references to ThisMCTWorld%mylrank
03Aug01 - E. Ong <eong@mcs.anl.gov> - Explicitly specify the starting address in mpi_send.
15Feb02 - R. Jacob <jacob@mcs.anl.gov> - Use MCT_comm
26Mar02 - E. Ong <eong@mcs.anl.gov> - Apply faster copy order
26Sep02 - R. Jacob <jacob@mcs.anl.gov> - Check Av against Router lAvsize
05Nov02 - R. Jacob <jacob@mcs.anl.gov> - Remove iList, rList arguments.
08Nov02 - R. Jacob <jacob@mcs.anl.gov> - MCT_Send is now send_ in m_Transfer
11Nov02 - R. Jacob <jacob@mcs.anl.gov> - Use DefaultTag and add optional Tag argument
25Jul03 - R. Jacob <jacob@mcs.anl.gov> - Split into isend_ and waitsend_
22Jan08 - R. Jacob <jacob@mcs.anl.gov> - Handle unordered GSMaps by permuting before send.
remove special case for sending one segment directly from Av which probably
wasn't safe.
Wait for the data being sent with the Router Rout to complete.
INTERFACE:
subroutine waitsend_(Rout)USES:
implicit noneINPUT PARAMETERS:
Type(Router), intent(inout) :: RoutREVISION HISTORY:
24Jul03 - R. Jacob <jacob@mcs.anl.gov> - First working version is
the wait part of original send_
Send the the data in the AttrVect aV to the component specified in the Router Rout. An error will result if the size of the attribute vector does not match the size parameter stored in the Router.
Requires a corresponding recv_ or irecv_ to be called on the other component.
The optional argument Tag can be used to set the tag value used in the data transfer. DefaultTag will be used otherwise. Tag must be the same in the matching recv_ or irecv_.
N.B.: The AttrVect argument in the corresponding recv call is assumed to have exactly the same attributes in exactly the same order as aV.
INTERFACE:
subroutine send_(aV, Rout, Tag)USES:
implicit noneINPUT PARAMETERS:
Type(AttrVect), intent(in) :: aV
Type(Router), intent(inout) :: Rout
integer,optional, intent(in) :: Tag
REVISION HISTORY:
24Jul03 - R. Jacob <jacob@mcs.anl.gov> - New version uses isend and waitsend
Recieve into the AttrVect aV the data coming from the component specified in the Router Rout. An error will result if the size of the attribute vector does not match the size parameter stored in the Router.
Requires a corresponding send_ or isend_ to be called on the other component.
The optional argument Tag can be used to set the tag value used in the data transfer. DefaultTag will be used otherwise. Tag must be the same in the matching send_ or isend_.
If data for a grid point is coming from more than one process, recv_ will overwrite the duplicate values leaving the last received value in the output aV. If the optional argument Sum is invoked, the output will contain the sum of any duplicate values received for the same grid point.
Will return as soon as MPI_IRECV's are posted. Call waitrecv_ to complete the receive operation.
N.B.: The AttrVect argument in the corresponding send_ call is assumed to have exactly the same attributes in exactly the same order as aV.
INTERFACE:
subroutine irecv_(aV, Rout, Tag, Sum)USES:
implicit noneINPUT/OUTPUT PARAMETERS:
Type(AttrVect), intent(inout) :: aVINPUT PARAMETERS:
Type(Router), intent(inout) :: Rout
integer,optional, intent(in) :: Tag
logical,optional, intent(in) :: Sum
REVISION HISTORY:
07Feb01 - R. Jacob <jacob@mcs.anl.gov> - initial prototype
07Jun01 - R. Jacob <jacob@mcs.anl.gov> - remove logic to
check "direction" of Router. remove references
to ThisMCTWorld%mylrank
03Aug01 - E.T. Ong <eong@mcs.anl.gov> - explicity specify starting
address in MPI_RECV
27Nov01 - E.T. Ong <eong@mcs.anl.gov> - deallocated to prevent
memory leaks
15Feb02 - R. Jacob <jacob@mcs.anl.gov> - Use MCT_comm
26Mar02 - E. Ong <eong@mcs.anl.gov> - Apply faster copy order.
26Sep02 - R. Jacob <jacob@mcs.anl.gov> - Check Av against Router lAvsize
08Nov02 - R. Jacob <jacob@mcs.anl.gov> - MCT_Recv is now recv_ in m_Transfer
11Nov02 - R. Jacob <jacob@mcs.anl.gov> - Add optional Sum argument to
tell recv_ to sum data for the same point received from multiple
processors. Replaces recvsum_ which had replaced MCT_Recvsum.
Use DefaultTag and add optional Tag argument
25Jul03 - R. Jacob <jacob@mcs.anl.gov> - break into irecv_ and waitrecv_
Wait for the data being received with the Router Rout to complete. When done, copy the data into the AttrVect aV.
INTERFACE:
subroutine waitrecv_(aV, Rout, Sum)USES:
implicit noneINPUT/OUTPUT PARAMETERS:
Type(AttrVect), intent(inout) :: aV
Type(Router), intent(inout) :: Rout
INPUT PARAMETERS:
logical,optional, intent(in) :: SumREVISION HISTORY:
25Jul03 - R. Jacob <jacob@mcs.anl.gov> - First working version is the wait
and copy parts from old recv_.
25Jan08 - R. Jacob <jacob@mcs.anl.gov> - Handle unordered GSMaps by
applying permutation to received array.
Recieve into the AttrVect aV the data coming from the component specified in the Router Rout. An error will result if the size of the attribute vector does not match the size parameter stored in the Router.
Requires a corresponding send_ or isend_to be called on the other component.
The optional argument Tag can be used to set the tag value used in the data transfer. DefaultTag will be used otherwise. Tag must be the same in the matching send_
If data for a grid point is coming from more than one process, recv_ will overwrite the duplicate values leaving the last received value in the output aV. If the optional argument Sum is invoked, the output will contain the sum of any duplicate values received for the same grid point.
Will not return until all data has been received.
N.B.: The AttrVect argument in the corresponding send_ call is assumed to have exactly the same attributes in exactly the same order as aV.
INTERFACE:
subroutine recv_(aV, Rout, Tag, Sum)USES:
implicit noneINPUT/OUTPUT PARAMETERS:
Type(AttrVect), intent(inout) :: aVINPUT PARAMETERS:
Type(Router), intent(inout) :: Rout
integer,optional, intent(in) :: Tag
logical,optional, intent(in) :: Sum
REVISION HISTORY:
25Jul03 - R. Jacob <jacob@mcs.anl.gov> - Rewrite using irecv and waitrecv