| 1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/inc/BAR2.h,v 1.2 2001/02/04 14:38:41 cnh Exp $ |
| 2 |
C $Name: $ |
| 3 |
C |
| 4 |
CBOP |
| 5 |
C !ROUTINE: BAR2.h |
| 6 |
C !INTERFACE: |
| 7 |
C include "BAR2.h" |
| 8 |
C !DESCRIPTION: |
| 9 |
C *==========================================================* |
| 10 |
C | BAR2.h |
| 11 |
C | o Globals used by BAR2 Fortran barrier routine. |
| 12 |
C |==========================================================* |
| 13 |
C | These variables support a simple Fortran shared memory |
| 14 |
C | barrier routine. They do busy waiting, that is the |
| 15 |
C | thread that is waiting sits in a tight loop reading |
| 16 |
C | some memory location and waiting for all other threads. |
| 17 |
C | On some systems this is sometimes a good method to use. |
| 18 |
C | On the T3E memory is not shared so the routine should |
| 19 |
C | use the T3E "eureka" barriers. On CRAY and NEC there are |
| 20 |
C | hardware barriers that are accessed through a compiler |
| 21 |
C | directives. Finally proper multi-threading compilers |
| 22 |
C | support barrier compile directives - sometimes these |
| 23 |
C | are good, sometimes they are lousy. |
| 24 |
C | The barrier mechanism is used as follows |
| 25 |
C | 1. In the single-threaded part of the code |
| 26 |
C | CALL BAR2_INIT |
| 27 |
C | on CRAY, NEC this routine does nothing |
| 28 |
C | on T3E there is no single-threaded code |
| 29 |
C | but there may be barrier initialisation - |
| 30 |
C | need to check. |
| 31 |
C | 2. When we need to synchronize everybody just |
| 32 |
C | CALL BAR2( myThid ) |
| 33 |
C | where myThid is myThreadId |
| 34 |
C | on CRAY, NEC FBAR will just do C$DIR BARRIER |
| 35 |
C | or CALL BARRIER or the like. |
| 36 |
C | on T3E FBAR does CALL BARRIER(...) or something |
| 37 |
C | need to check this. |
| 38 |
C *==========================================================* |
| 39 |
CEOP |
| 40 |
COMMON /BAR2_BUFFER_I/ |
| 41 |
& BAR2_level, |
| 42 |
& BAR2_barrierCount, |
| 43 |
& BAR2_spinsCount, BAR2_spinsMax, BAR2_spinsMin |
| 44 |
INTEGER BAR2_level(cacheLineSize/4,MAX_NO_THREADS) |
| 45 |
INTEGER BAR2_barrierCount(cacheLineSize/4,MAX_NO_THREADS) |
| 46 |
INTEGER BAR2_spinsCount(cacheLineSize/4,MAX_NO_THREADS) |
| 47 |
INTEGER BAR2_spinsMax(cacheLineSize/4,MAX_NO_THREADS) |
| 48 |
INTEGER BAR2_spinsMin(cacheLineSize/4,MAX_NO_THREADS) |
| 49 |
|
| 50 |
COMMON /BAR2_L/ bar2CollectStatistics |
| 51 |
LOGICAL bar2CollectStatistics |