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