1 |
cnh |
1.1 |
C $Id$ |
2 |
|
|
C |
3 |
|
|
C /==========================================================\ |
4 |
|
|
C | FBAR.h | |
5 |
|
|
C | o Globals used by Fortran barrier routine. | |
6 |
|
|
C |==========================================================| |
7 |
|
|
C | These variables support a simple Fortran shared memory | |
8 |
|
|
C | barrier routine. They do busy waiting, that is the | |
9 |
|
|
C | thread that is waiting sits in a tight loop reading | |
10 |
|
|
C | some memory location and waiting for all other threads. | |
11 |
|
|
C | On some systems this is sometimes a good method to use. | |
12 |
|
|
C | On the T3E memory is not shared so the routine should | |
13 |
|
|
C | use the T3E "eureka" barriers. On CRAY and NEC there are | |
14 |
|
|
C | hardware barriers that are accessed through a compiler | |
15 |
|
|
C | directives. Finally proper multi-threading compilers | |
16 |
|
|
C | support barrier compile directives - sometimes these | |
17 |
|
|
C | are good, sometimes they are lousy. | |
18 |
|
|
C | The barrier mechanism is used as follows | |
19 |
|
|
C | 1. In the single-threaded part of the code | |
20 |
|
|
C | CALL FBAR_INIT | |
21 |
|
|
C | on CRAY, NEC this routine does nothing | |
22 |
|
|
C | on T3E there is no single-threaded code | |
23 |
|
|
C | but there may be barrier initialisation - | |
24 |
|
|
C | need to check. | |
25 |
|
|
C | 2. When we need to synchronize everybody just | |
26 |
|
|
C | CALL FBAR( myThid ) | |
27 |
|
|
C | where myThid is myThreadId | |
28 |
|
|
C | on CRAY, NEC FBAR will just do C$DIR BARRIER | |
29 |
|
|
C | or the like. | |
30 |
|
|
C | on T3E FBAR does CALL BARRIER(...) or something | |
31 |
|
|
C | need to check this. | |
32 |
|
|
C \==========================================================/ |
33 |
|
|
COMMON / BARRIER_COMMON / key1, key2, key3, |
34 |
|
|
& door1, door2, door3 |
35 |
|
|
INTEGER key1(lShare4,MAX_NO_THREADS) |
36 |
|
|
INTEGER key2(lShare4,MAX_NO_THREADS) |
37 |
|
|
INTEGER key3(lShare4,MAX_NO_THREADS) |
38 |
|
|
INTEGER door1 |
39 |
|
|
INTEGER door2 |
40 |
|
|
INTEGER door3 |
41 |
|
|
INTEGER VALID |
42 |
|
|
PARAMETER ( VALID = 1 ) |
43 |
|
|
INTEGER INVALID |
44 |
|
|
PARAMETER ( INVALID = 0 ) |
45 |
|
|
INTEGER OPEN |
46 |
|
|
PARAMETER ( OPEN = 1 ) |
47 |
|
|
INTEGER SHUT |
48 |
|
|
PARAMETER ( SHUT = 0 ) |