1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/inc/BARRIER.h,v 1.2 1998/04/23 20:59:34 cnh Exp $ |
2 |
C $Name: $ |
3 |
C |
4 |
C /==========================================================\ |
5 |
C | FBAR.h | |
6 |
C | o Globals used by 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 FBAR_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 FBAR( myThid ) | |
28 |
C | where myThid is myThreadId | |
29 |
C | on CRAY, NEC FBAR will just do C$DIR BARRIER | |
30 |
C | or the like. | |
31 |
C | on T3E FBAR does CALL BARRIER(...) or something | |
32 |
C | need to check this. | |
33 |
C \==========================================================/ |
34 |
COMMON / BARRIER_COMMON / key1, key2, key3, |
35 |
& door1, door2, door3 |
36 |
INTEGER key1(lShare4,MAX_NO_THREADS) |
37 |
INTEGER key2(lShare4,MAX_NO_THREADS) |
38 |
INTEGER key3(lShare4,MAX_NO_THREADS) |
39 |
INTEGER door1 |
40 |
INTEGER door2 |
41 |
INTEGER door3 |
42 |
INTEGER VALID |
43 |
PARAMETER ( VALID = 1 ) |
44 |
INTEGER INVALID |
45 |
PARAMETER ( INVALID = 0 ) |
46 |
INTEGER OPEN |
47 |
PARAMETER ( OPEN = 1 ) |
48 |
INTEGER SHUT |
49 |
PARAMETER ( SHUT = 0 ) |