1 |
C $Header: $ |
2 |
|
3 |
SUBROUTINE EXCH_CYCLE_EBL( myThid ) |
4 |
C /==========================================================\ |
5 |
C | SUBROUTINE EXCH_CYCLE_EBL | |
6 |
C | o Cycle exchange buffer level. | |
7 |
C |==========================================================| |
8 |
C | Step the "exchange buffer level" to next value. | |
9 |
C | The buffer level is used to prevent consecutive messages | |
10 |
C | overwriting one another. Because we know that every tile | |
11 |
C | will participate in an exchange we can be sure that every| |
12 |
C | tile will cycle through the buffers with the same | |
13 |
C | sequence. Also we know that a tile cannot start a new | |
14 |
C | exchange before it has completed its end of the previous | |
15 |
C | exchange. Thus by cycling through three buffer levels we | |
16 |
C | can be sure that the buffer we write to will be free. | |
17 |
C | That is by the time we are participating in the third | |
18 |
C | exchange transaction we know that both ends of the first | |
19 |
C | transaction must have completed. | |
20 |
C | Note -- | |
21 |
C | 1. We allow more than three levels below although this | |
22 |
C | is not necessary. | |
23 |
C \==========================================================/ |
24 |
IMPLICIT NONE |
25 |
C == Global data == |
26 |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "EESUPPORT.h" |
29 |
#include "EXCH.h" |
30 |
|
31 |
C == Routine arguments == |
32 |
C myThid - Thread number of this instance of the routine |
33 |
INTEGER myThid |
34 |
|
35 |
C == Local variables == |
36 |
C bi, bj - Loop counters |
37 |
INTEGER bi, bj |
38 |
|
39 |
DO bj=myByLo(myThid),myByHi(myThid) |
40 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
41 |
C-- Use next level exchange buffer in cycle. |
42 |
exchangeBufLevel(1,bi,bj) = exchangeBufLevel(1,bi,bj)+1 |
43 |
IF ( exchangeBufLevel(1,bi,bj) .GT. NUMBER_OF_BUFFER_LEVELS ) |
44 |
& exchangeBufLevel(1,bi,bj) = 1 |
45 |
ENDDO |
46 |
ENDDO |
47 |
|
48 |
RETURN |
49 |
END |