3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
|
6 |
CBOP |
CBOP |
7 |
C !ROUTINE: W2_PRINT_COMM_SEQUENCE |
C !ROUTINE: W2_PRINT_COMM_SEQUENCE |
8 |
|
|
9 |
C !INTERFACE: |
C !INTERFACE: |
12 |
|
|
13 |
C !DESCRIPTION: |
C !DESCRIPTION: |
14 |
C *==========================================================* |
C *==========================================================* |
15 |
C | SUBROUTINE W2_PRINT_COMM_SEQUENCE |
C | SUBROUTINE W2_PRINT_COMM_SEQUENCE |
16 |
C | o Write communication sequence for a given WRAPPER2 |
C | o Write communication sequence for a given WRAPPER2 |
17 |
C | toplogy |
C | toplogy |
18 |
C *==========================================================* |
C *==========================================================* |
19 |
#include "SIZE.h" |
#include "SIZE.h" |
32 |
INTEGER I, N, targetTile, myThid, targetProc, sourceProc |
INTEGER I, N, targetTile, myThid, targetProc, sourceProc |
33 |
INTEGER iStride, jStride |
INTEGER iStride, jStride |
34 |
INTEGER pi(2), pj(2), oi, oj, tN |
INTEGER pi(2), pj(2), oi, oj, tN |
35 |
|
INTEGER itb, jtb, isb, jsb |
36 |
|
|
37 |
myThid = 1 |
myThid = 1 |
38 |
|
|
54 |
pj(2) =exch2_pj(2,N,myTileId) |
pj(2) =exch2_pj(2,N,myTileId) |
55 |
oi =exch2_oi(N,myTileId) |
oi =exch2_oi(N,myTileId) |
56 |
oj =exch2_oj(N,myTileId) |
oj =exch2_oj(N,myTileId) |
57 |
IF ( targetIlo .EQ. targetIhi .AND. targetIlo .EQ. 0 ) THEN |
CALL EXCH2_GET_SEND_BOUNDS( |
58 |
C Sending to a west edge |
I 'T ', OLx, |
59 |
targetIlo=1-OLx |
O iStride, jStride, |
60 |
targetIhi=0 |
U targetIlo, targetIhi, targetJlo, targetJhi ) |
61 |
istride=1 |
|
62 |
IF ( targetJlo .LE. targetJhi ) THEN |
itb = exch2_tbasex(targetTile) |
63 |
targetJlo=targetJlo-OLx+1 |
jtb = exch2_tbasey(targetTile) |
64 |
targetJhi=targetJhi+OLx-1 |
isb = exch2_tbasex(myTileId) |
65 |
jstride=1 |
jsb = exch2_tbasey(myTileId) |
66 |
ELSE |
sourceIlo=pi(1)*(targetIlo+itb)+pi(2)*(targetJlo+jtb)+oi-isb |
67 |
targetJlo=targetJlo+OLx-1 |
sourceJlo=pj(1)*(targetIlo+itb)+pj(2)*(targetJlo+jtb)+oj-jsb |
68 |
targetJhi=targetJhi-OLx+1 |
sourceIhi=pi(1)*(targetIhi+itb)+pi(2)*(targetJhi+jtb)+oi-isb |
69 |
jstride=-1 |
sourceJhi=pj(1)*(targetIhi+itb)+pj(2)*(targetJhi+jtb)+oj-jsb |
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetIlo .EQ. targetIhi .AND. targetIlo .GT. 1 ) THEN |
|
|
C Sending to an east edge |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
IF ( targetJlo .LE. targetJhi ) THEN |
|
|
targetJlo=targetJlo-OLx+1 |
|
|
targetJhi=targetJhi+OLx-1 |
|
|
jstride=1 |
|
|
ELSE |
|
|
targetJlo=targetJlo+OLx-1 |
|
|
targetJhi=targetJhi-OLx+1 |
|
|
jstride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetJlo .EQ. targetJhi .AND. targetJlo .EQ. 0 ) THEN |
|
|
C Sending to a south edge |
|
|
targetJlo=1-OLx |
|
|
targetJhi=0 |
|
|
jstride=1 |
|
|
IF ( targetIlo .LE. targetIhi ) THEN |
|
|
targetIlo=targetIlo-OLx+1 |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
ELSE |
|
|
targetIlo=targetIlo+OLx-1 |
|
|
targetIhi=targetIhi-OLx+1 |
|
|
istride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetJlo .EQ. targetJhi .AND. targetJlo .GT. 1 ) THEN |
|
|
C Sending to an north edge |
|
|
targetJhi=targetJhi+OLx-1 |
|
|
jstride=1 |
|
|
IF ( targetIlo .LE. targetIhi ) THEN |
|
|
targetIlo=targetIlo-OLx+1 |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
ELSE |
|
|
targetIlo=targetIlo+OLx-1 |
|
|
targetIhi=targetIhi-OLx+1 |
|
|
istride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
sourceIlo=pi(1)*targetIlo+pi(2)*targetJlo+oi |
|
|
sourceJlo=pj(1)*targetIlo+pj(2)*targetJlo+oj |
|
|
sourceIhi=pi(1)*targetIhi+pi(2)*targetJhi+oi |
|
|
sourceJhi=pj(1)*targetIhi+pj(2)*targetJhi+oj |
|
70 |
C Tile XX sends to points i=ilo:ihi,j=jlo:jhi in tile YY |
C Tile XX sends to points i=ilo:ihi,j=jlo:jhi in tile YY |
71 |
WRITE(msgBuffer, |
WRITE(msgBuffer,'(A,I6,A,I4,A,4(A,I4))') |
72 |
& '(A,I4,A,I4,A,A,I4,A,I4,A,I4,A,I4)') |
& 'Tile', myTileId,' (pr=',sourceProc,')', |
73 |
& 'Tile ',myTileId |
& ' sends pts i=',sourceIlo,':',sourceIhi, |
74 |
& ,'(proc =',sourceProc,')', |
& ', j=',sourceJlo,':',sourceJhi |
|
& ' sends points i=',sourceIlo, |
|
|
& ':',sourceIhi, |
|
|
& ', j=',sourceJlo, |
|
|
& ':',sourceJhi |
|
75 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
76 |
& SQUEEZE_RIGHT,myThid) |
& SQUEEZE_RIGHT,myThid) |
77 |
WRITE(msgBuffer, |
WRITE(msgBuffer,'(4(A,I4),A,I6,A,I4,A)') |
78 |
& '(A,I4,A,I4,A,I4,A,I4,A,I4,A,I4,A)') |
& ' to pts i=',targetIlo,':',targetIhi, |
79 |
& ' to points i=',targetIlo, |
& ', j=',targetJlo,':',targetJhi, |
80 |
& ':',targetIhi, |
& ' in tile ',targetTile,' (pr=',targetProc,')' |
|
& ', j=',targetJlo, |
|
|
& ':',targetJhi, |
|
|
& ' in tile ',targetTile, |
|
|
& '(proc =',targetProc,')' |
|
81 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
82 |
& SQUEEZE_RIGHT,myThid) |
& SQUEEZE_RIGHT,myThid) |
83 |
ENDDO |
ENDDO |
98 |
targetIhi =exch2_ithi_c(tN,targetTile) |
targetIhi =exch2_ithi_c(tN,targetTile) |
99 |
targetJlo =exch2_jtlo_c(tN,targetTile) |
targetJlo =exch2_jtlo_c(tN,targetTile) |
100 |
targetJhi =exch2_jthi_c(tN,targetTile) |
targetJhi =exch2_jthi_c(tN,targetTile) |
101 |
IF ( targetIlo .EQ. targetIhi .AND. targetIlo .EQ. 0 ) THEN |
CALL EXCH2_GET_REC_BOUNDS( |
102 |
C Sending to a west edge |
I 'T ', OLx, |
103 |
targetIlo=1-OLx |
O iStride, jStride, |
104 |
targetIhi=0 |
U targetIlo, targetIhi, targetJlo, targetJhi ) |
|
istride=1 |
|
|
IF ( targetJlo .LE. targetJhi ) THEN |
|
|
targetJlo=targetJlo-OLx+1 |
|
|
targetJhi=targetJhi+OLx-1 |
|
|
jstride=1 |
|
|
ELSE |
|
|
targetJlo=targetJlo+OLx-1 |
|
|
targetJhi=targetJhi-OLx+1 |
|
|
jstride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetIlo .EQ. targetIhi .AND. targetIlo .GT. 1 ) THEN |
|
|
C Sending to an east edge |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
IF ( targetJlo .LE. targetJhi ) THEN |
|
|
targetJlo=targetJlo-OLx+1 |
|
|
targetJhi=targetJhi+OLx-1 |
|
|
jstride=1 |
|
|
ELSE |
|
|
targetJlo=targetJlo+OLx-1 |
|
|
targetJhi=targetJhi-OLx+1 |
|
|
jstride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetJlo .EQ. targetJhi .AND. targetJlo .EQ. 0 ) THEN |
|
|
C Sending to a south edge |
|
|
targetJlo=1-OLx |
|
|
targetJhi=0 |
|
|
jstride=1 |
|
|
IF ( targetIlo .LE. targetIhi ) THEN |
|
|
targetIlo=targetIlo-OLx+1 |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
ELSE |
|
|
targetIlo=targetIlo+OLx-1 |
|
|
targetIhi=targetIhi-OLx+1 |
|
|
istride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
|
IF ( targetJlo .EQ. targetJhi .AND. targetJlo .GT. 1 ) THEN |
|
|
C Sending to an north edge |
|
|
targetJhi=targetJhi+OLx-1 |
|
|
jstride=1 |
|
|
IF ( targetIlo .LE. targetIhi ) THEN |
|
|
targetIlo=targetIlo-OLx+1 |
|
|
targetIhi=targetIhi+OLx-1 |
|
|
istride=1 |
|
|
ELSE |
|
|
targetIlo=targetIlo+OLx-1 |
|
|
targetIhi=targetIhi-OLx+1 |
|
|
istride=-1 |
|
|
ENDIF |
|
|
ENDIF |
|
105 |
C Tile XX receives points i=ilo:ihi,j=jlo:jhi in tile YY |
C Tile XX receives points i=ilo:ihi,j=jlo:jhi in tile YY |
106 |
WRITE(msgBuffer, |
WRITE(msgBuffer,'(A,I6,A,I4,A,4(A,I4),A,I6,A,I4,A)') |
107 |
& '(A,I4,A,I4,A,A,I4,A,I4,A,I4,A,I4,A,I4,A,I4,A)') |
& 'Tile', myTileId,' (pr=',sourceProc,')', |
108 |
& 'Tile ',myTileId |
& ' recv pts i=',targetIlo,':',targetIhi, |
109 |
& ,'(proc =',targetProc,')', |
& ', j=',targetJlo, ':',targetJhi, |
110 |
& 'recv to points i=',targetIlo, |
& ' from tile',targetTile,' (pr=',targetProc,')' |
|
& ':',targetIhi, |
|
|
& ', j=',targetJlo, |
|
|
& ':',targetJhi, |
|
|
& 'from tile',targetTile, |
|
|
& '(proc =',targetProc,')' |
|
111 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
112 |
& SQUEEZE_RIGHT,myThid) |
& SQUEEZE_RIGHT,myThid) |
113 |
ENDDO |
ENDDO |