Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:36:05 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
4c563c2ee9 Chri*0001 CBOP
                0002 C     !ROUTINE: BARRIER.h
                0003 C     !INTERFACE:
                0004 C     include "BARRIER.h"
                0005 C     !DESCRIPTION:
                0006 C     *==========================================================*
                0007 C     | BARRIER.h                                                 
                0008 C     | o Globals used by Fortran barrier routine.                
                0009 C     *==========================================================*
                0010 C     | These variables support a simple Fortran shared memory    
                0011 C     | barrier routine. They do busy waiting, that is the        
                0012 C     | thread that is waiting sits in a tight loop reading       
                0013 C     | some memory location and waiting for all other threads.   
                0014 C     | On some systems this is sometimes a good method to use.   
                0015 C     | On the T3E memory is not shared so the routine should     
                0016 C     | use the T3E "eureka" barriers. On CRAY and NEC there are  
                0017 C     | hardware barriers that are accessed through a compiler    
                0018 C     | directives. Finally proper multi-threading compilers      
                0019 C     | support barrier compile directives - sometimes these      
                0020 C     | are good, sometimes they are lousy.                       
                0021 C     |  The barrier mechanism is used as follows                 
                0022 C     |  1. In the single-threaded part of the code               
2b4c849245 Ed H*0023 C     |     CALL FBAR\_INIT                                        
4c563c2ee9 Chri*0024 C     |     on CRAY, NEC this routine does nothing                
                0025 C     |     on T3E there is no single-threaded code               
                0026 C     |        but there may be barrier initialisation -          
                0027 C     |        need to check.                                     
                0028 C     |  2. When we need to synchronize everybody just            
                0029 C     |     CALL FBAR( myThid )                                   
                0030 C     |     where myThid is myThreadId                            
2b4c849245 Ed H*0031 C     |     on CRAY, NEC FBAR will just do C\$DIR BARRIER          
4c563c2ee9 Chri*0032 C     |     or the like.                                          
                0033 C     |     on T3E FBAR does CALL BARRIER(...) or something       
                0034 C     |     need to check this.                                   
                0035 C     *==========================================================*
                0036 CEOP
924557e60a Chri*0037       COMMON / BARRIER_COMMON / key1,  key2,  key3, 
a6a74ff42f Chri*0038      &                          door1, door2, door3,
5bfeee1bf0 Chri*0039      &                          bCount, masterSet
924557e60a Chri*0040       INTEGER key1(lShare4,MAX_NO_THREADS)
                0041       INTEGER key2(lShare4,MAX_NO_THREADS)
                0042       INTEGER key3(lShare4,MAX_NO_THREADS)
                0043       INTEGER door1
                0044       INTEGER door2
                0045       INTEGER door3
                0046       INTEGER VALID
                0047       PARAMETER ( VALID = 1 )
                0048       INTEGER INVALID
                0049       PARAMETER ( INVALID = 0 )
                0050       INTEGER OPEN
                0051       PARAMETER ( OPEN = 1 )
                0052       INTEGER SHUT
                0053       PARAMETER ( SHUT = 0 )
a6a74ff42f Chri*0054       INTEGER bCount(MAX_NO_THREADS)
5bfeee1bf0 Chri*0055       INTEGER masterSet(MAX_NO_THREADS)