--- MITgcm/pkg/exch2/exch2_recv_rx2.template 2004/04/05 15:27:06 1.2 +++ MITgcm/pkg/exch2/exch2_recv_rx2.template 2008/07/29 20:25:23 1.5 @@ -1,7 +1,8 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/exch2/exch2_recv_rx2.template,v 1.2 2004/04/05 15:27:06 edhill Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/exch2/exch2_recv_rx2.template,v 1.5 2008/07/29 20:25:23 jmc Exp $ C $Name: $ -#include "CPP_OPTIONS.h" +#include "CPP_EEOPTIONS.h" +#include "W2_OPTIONS.h" SUBROUTINE EXCH2_RECV_RX2( I tIlo, tIhi, tiStride, @@ -20,13 +21,11 @@ IMPLICIT NONE -C -#include "W2_OPTIONS.h" +#include "SIZE.h" +#include "EEPARAMS.h" +#include "EESUPPORT.h" #include "W2_EXCH2_TOPOLOGY.h" -#include "EEPARAMS.h" - CHARACTER*(MAX_LEN_MBUF) messageBuffer -C C === Routine arguments === C tIlo, tIhi, tIstride :: index range in I that will be filled in target "array" C tJlo, tJhi, tJstride :: index range in J that will be filled in target "array" @@ -58,14 +57,14 @@ C myTiles :: List of nt tiles that this process owns. C commSetting :: Mode of communication used to exchnage with this neighbor C myThid :: Thread number of this instance of EXCH2_RECV_RX1 -C +C INTEGER tILo, tIHi, tiStride INTEGER tJLo, tJHi, tjStride INTEGER tKLo, tKHi, tkStride INTEGER i1Lo, i1Hi, j1Lo, j1Hi, k1Lo, k1Hi INTEGER i2Lo, i2Hi, j2Lo, j2Hi, k2Lo, k2Hi INTEGER thisTile, nN, thisI - INTEGER e2BufrRecSize + INTEGER e2BufrRecSize INTEGER mnb, nt _RX e2Bufr1_RX( e2BufrRecSize, mnb, nt, 2 ) _RX e2Bufr2_RX( e2BufrRecSize, mnb, nt, 2 ) @@ -83,9 +82,9 @@ C :: isl etc... source local C :: isc etc... source canonical INTEGER itl, jtl, ktl - INTEGER itc, jtc, ktc - INTEGER isc, jsc, ksc - INTEGER isl, jsl, ksl +c INTEGER itc, jtc, ktc +c INTEGER isc, jsc, ksc +c INTEGER isl, jsl, ksl C tt :: Target tile C iBufr1 :: Buffer counter C iBufr2 :: @@ -94,43 +93,45 @@ C mb, nb :: Selects e2Bufr, msgHandle record to use C ir :: INTEGER mb, nb, ir -C oN :: Opposing send record number +C oN :: Opposing send record number INTEGER oN C Loop counters - INTEGER I, nri1, nrj1, nrk1 - INTEGER nri2, nrj2, nrk2 + INTEGER I INTEGER itl1reduce, jtl1reduce INTEGER itl2reduce, jtl2reduce C MPI setup -#include "SIZE.h" -#include "EESUPPORT.h" - INTEGER theTag1, theSize1, theType - INTEGER theTag2, theSize2 - INTEGER sProc, tProc #ifdef ALLOW_USE_MPI + INTEGER nri1, nrj1, nrk1 + INTEGER nri2, nrj2, nrk2 + INTEGER theTag1, theTag2, theType +c INTEGER theSize1, theSize2 + INTEGER sProc, tProc INTEGER mpiStatus(MPI_STATUS_SIZE), mpiRc +#ifdef W2_E2_DEBUG_ON + CHARACTER*(MAX_LEN_MBUF) messageBuffer +#endif #endif tt=exch2_neighbourId(nN, thisTile ) - oN=exch2_opposingSend_record(nN, thisTile ) + oN=exch2_opposingSend(nN, thisTile ) itl1reduce=0 jtl1reduce=0 itl2reduce=0 jtl2reduce=0 - IF ( exch2_pi(1,oN,tt) .EQ. -1 ) itl1reduce=1 - IF ( exch2_pj(1,oN,tt) .EQ. -1 ) itl1reduce=1 - IF ( exch2_pi(2,oN,tt) .EQ. -1 ) jtl2reduce=1 - IF ( exch2_pj(2,oN,tt) .EQ. -1 ) jtl2reduce=1 + IF ( exch2_pij(1,oN,tt) .EQ. -1 ) itl1reduce=1 + IF ( exch2_pij(3,oN,tt) .EQ. -1 ) itl1reduce=1 + IF ( exch2_pij(2,oN,tt) .EQ. -1 ) jtl2reduce=1 + IF ( exch2_pij(4,oN,tt) .EQ. -1 ) jtl2reduce=1 -C Handle receive end data transport according to communication mechanism between +C Handle receive end data transport according to communication mechanism between C source and target tile IF ( commSetting .EQ. 'P' ) THEN C 1 Need to check and spin on data ready assertion for multithreaded mode, for now do nothing i.e. C assume only one thread per process. C 2 Need to set e2Bufr to use put buffer from opposing send. - oN = exch2_opposingSend_record(nN, thisTile ) + oN = exch2_opposingSend(nN, thisTile ) mb = oN ir = 1 DO I=1,nt @@ -225,7 +226,7 @@ ENDDO ENDDO ENDDO - + RETURN END