Warning, /pkg/exch2/exch2_send_rx2.template is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit b9dadda2 on 2020-07-28 16:49:33 UTC
7dde890654 Jean*0001 #include "CPP_EEOPTIONS.h"
0002 #include "W2_OPTIONS.h"
046fd16d1c Andr*0003
ed81d0a43c Jean*0004 CBOP 0
0005 C !ROUTINE: EXCH2_SEND_RX2
0006
0007 C !INTERFACE:
046fd16d1c Andr*0008 SUBROUTINE EXCH2_SEND_RX2 (
ed81d0a43c Jean*0009 I thisTile, nN,
10972e8712 Jean*0010 I e2BufrRecSize,
ed81d0a43c Jean*0011 I iBufr1, iBufr2,
0012 I e2Bufr1_RX, e2Bufr2_RX,
0013 O e2_msgHandle,
0014 I commSetting, myThid )
0015
0016 C !DESCRIPTION:
0017 C Two components vector field Exchange:
0018 C Send buffer to the target Process.
0019 C Buffer has been previously filled with interior data point
0020 C corresponding to the target-neighbour-edge overlap region.
0021
0022 C !USES:
046fd16d1c Andr*0023 IMPLICIT NONE
0024
7dde890654 Jean*0025 #include "SIZE.h"
0026 #include "EEPARAMS.h"
0027 #include "EESUPPORT.h"
90219e5912 Jean*0028 #include "W2_EXCH2_SIZE.h"
046fd16d1c Andr*0029 #include "W2_EXCH2_TOPOLOGY.h"
0030
ed81d0a43c Jean*0031 C !INPUT/OUTPUT PARAMETERS:
046fd16d1c Andr*0032 C === Routine arguments ===
ed81d0a43c Jean*0033 C thisTile :: sending tile Id. number
0034 C nN :: Neighbour entry that we are processing
0035 C e2BufrRecSize :: Number of elements in each entry of e2Bufr1_RX
d6ea3164dc Jean*0036 C iBufr1 :: number of buffer-1 elements to transfer
0037 C iBufr2 :: number of buffer-2 elements to transfer
ed81d0a43c Jean*0038 C e2Bufr1_RX :: Data transport buffer array. This array is used in one of
0039 C e2Bufr2_RX :: two ways. For PUT communication the entry in the buffer
0040 C :: associated with the source for this receive (determined
0041 C :: from the opposing_send index) is read.
0042 C :: For MSG communication the entry in the buffer associated
0043 C :: with this neighbor of this tile is used as a receive
0044 C :: location for loading a linear stream of bytes.
0045 C e2_msgHandles :: Synchronization and coordination data structure used to
0046 C :: coordinate access to e2Bufr1_RX or to regulate message
0047 C :: buffering. In PUT communication sender will increment
0048 C :: handle entry once data is ready in buffer. Receiver will
0049 C :: decrement handle once data is consumed from buffer.
d6ea3164dc Jean*0050 C :: For MPI MSG communication MPI_Wait uses handle to check
ed81d0a43c Jean*0051 C :: Isend has cleared. This is done in routine after receives.
0052 C commSetting :: Mode of communication used to exchange with this neighbor
0053 C myThid :: my Thread Id. number
0054
046fd16d1c Andr*0055 INTEGER thisTile, nN
9b79698769 Jean*0056 INTEGER e2BufrRecSize
ed81d0a43c Jean*0057 INTEGER iBufr1, iBufr2
046fd16d1c Andr*0058 _RX e2Bufr1_RX( e2BufrRecSize )
0059 _RX e2Bufr2_RX( e2BufrRecSize )
ed81d0a43c Jean*0060 INTEGER e2_msgHandle(2)
046fd16d1c Andr*0061 CHARACTER commSetting
ed81d0a43c Jean*0062 INTEGER myThid
0063 CEOP
046fd16d1c Andr*0064
ed81d0a43c Jean*0065 #ifdef ALLOW_USE_MPI
0066 C !LOCAL VARIABLES:
046fd16d1c Andr*0067 C == Local variables ==
ed81d0a43c Jean*0068 C tgT :: Target tile
0069 INTEGER tgT
046fd16d1c Andr*0070
0071 C MPI setup
0072 INTEGER theTag1, theTag2, theType, theHandle1, theHandle2
0073 INTEGER sProc, tProc, mpiRc
0074 #ifdef W2_E2_DEBUG_ON
ed81d0a43c Jean*0075 CHARACTER*(MAX_LEN_MBUF) msgBuf
0076 #endif
046fd16d1c Andr*0077
ed81d0a43c Jean*0078 tgT = exch2_neighbourId(nN, thisTile )
046fd16d1c Andr*0079
ed81d0a43c Jean*0080 C Do data transport depending on communication mechanism between
0081 C source and target tile
0082 IF ( commSetting .EQ. 'M' ) THEN
046fd16d1c Andr*0083 C Setup MPI stuff here
90219e5912 Jean*0084 theTag1 = (thisTile-1)*W2_maxNeighbours*2 + nN-1
0085 theTag2 = (thisTile-1)*W2_maxNeighbours*2
0086 & + W2_maxNeighbours + nN-1
0b153c4cea Jean*0087 tProc = W2_tileProc(tgT)-1
0088 sProc = W2_tileProc(thisTile)-1
92307680ae Jean*0089 theType = _MPI_TYPE_RX
046fd16d1c Andr*0090 #ifdef W2_E2_DEBUG_ON
b9dadda204 Mart*0091 WRITE(msgBuf,'(A,I8,A,I8,A)')
ed81d0a43c Jean*0092 & ' SEND FROM TILE=', thisTile, ' (proc =',sProc,')'
0093 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0094 I SQUEEZE_RIGHT, myThid)
b9dadda204 Mart*0095 WRITE(msgBuf,'(A,I8,A,I8,A)')
0096 & ' TO TILE=', tgT, ' (proc =',tProc,')'
ed81d0a43c Jean*0097 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0098 I SQUEEZE_RIGHT, myThid)
0099 WRITE(msgBuf,'(A,I10)') ' TAG1=', theTag1
0100 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0101 I SQUEEZE_RIGHT, myThid)
b9dadda204 Mart*0102 WRITE(msgBuf,'(A,I8)') ' NEL1=', iBufr1
ed81d0a43c Jean*0103 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0104 I SQUEEZE_RIGHT, myThid)
0105 WRITE(msgBuf,'(A,I10)') ' TAG2=', theTag2
0106 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0107 I SQUEEZE_RIGHT, myThid)
b9dadda204 Mart*0108 WRITE(msgBuf,'(A,I8)') ' NEL2=', iBufr2
ed81d0a43c Jean*0109 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0110 I SQUEEZE_RIGHT, myThid)
046fd16d1c Andr*0111 #endif /* W2_E2_DEBUG_ON */
0112 CALL MPI_Isend( e2Bufr1_RX, iBufr1, theType,
9b79698769 Jean*0113 I tProc, theTag1, MPI_COMM_MODEL,
046fd16d1c Andr*0114 O theHandle1, mpiRc )
0115 CALL MPI_Isend( e2Bufr2_RX, iBufr2, theType,
9b79698769 Jean*0116 I tProc, theTag2, MPI_COMM_MODEL,
046fd16d1c Andr*0117 O theHandle2, mpiRc )
0118 C Store MPI_Wait token in messageHandle.
ed81d0a43c Jean*0119 e2_msgHandle(1) = theHandle1
0120 e2_msgHandle(2) = theHandle2
046fd16d1c Andr*0121 ENDIF
ed81d0a43c Jean*0122 #endif /* ALLOW_USE_MPI */
9b79698769 Jean*0123
046fd16d1c Andr*0124 RETURN
0125 END
2ad152b417 Ed H*0126
0127 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
0128
0129 CEH3 ;;; Local Variables: ***
0130 CEH3 ;;; mode:fortran ***
0131 CEH3 ;;; End: ***