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