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
048ce7bdb7 Chri*0001 C
4c563c2ee9 Chri*0002 CBOP
                0003 C     !ROUTINE: BAR2.h
                0004 C     !INTERFACE:
                0005 C     include "BAR2.h"
                0006 C     !DESCRIPTION:
                0007 C     *==========================================================*
                0008 C     | BAR2.h                                                    
                0009 C     | o Globals used by BAR2 Fortran barrier routine.           
                0010 C     |==========================================================*
                0011 C     | These variables support a simple Fortran shared memory    
                0012 C     | barrier routine. They do busy waiting, that is the        
                0013 C     | thread that is waiting sits in a tight loop reading       
                0014 C     | some memory location and waiting for all other threads.   
                0015 C     | On some systems this is sometimes a good method to use.   
                0016 C     | On the T3E memory is not shared so the routine should     
                0017 C     | use the T3E "eureka" barriers. On CRAY and NEC there are  
                0018 C     | hardware barriers that are accessed through a compiler    
                0019 C     | directives. Finally proper multi-threading compilers      
                0020 C     | support barrier compile directives - sometimes these      
                0021 C     | are good, sometimes they are lousy.                       
                0022 C     |  The barrier mechanism is used as follows                 
                0023 C     |  1. In the single-threaded part of the code               
2b4c849245 Ed H*0024 C     |     CALL BAR2\_INIT                                        
4c563c2ee9 Chri*0025 C     |     on CRAY, NEC this routine does nothing                
                0026 C     |     on T3E there is no single-threaded code               
                0027 C     |        but there may be barrier initialisation -          
                0028 C     |        need to check.                                     
                0029 C     |  2. When we need to synchronize everybody just            
                0030 C     |     CALL BAR2( myThid )                                   
                0031 C     |     where myThid is myThreadId                            
2b4c849245 Ed H*0032 C     |     on CRAY, NEC FBAR will just do C\$DIR BARRIER          
4c563c2ee9 Chri*0033 C     |     or CALL BARRIER or the like.                          
                0034 C     |     on T3E FBAR does CALL BARRIER(...) or something       
                0035 C     |     need to check this.                                   
                0036 C     *==========================================================*
                0037 CEOP
048ce7bdb7 Chri*0038       COMMON /BAR2_BUFFER_I/
                0039      &  BAR2_level,
                0040      &  BAR2_barrierCount, 
                0041      &  BAR2_spinsCount, BAR2_spinsMax, BAR2_spinsMin
                0042       INTEGER BAR2_level(cacheLineSize/4,MAX_NO_THREADS)
                0043       INTEGER BAR2_barrierCount(cacheLineSize/4,MAX_NO_THREADS)
                0044       INTEGER BAR2_spinsCount(cacheLineSize/4,MAX_NO_THREADS)
                0045       INTEGER BAR2_spinsMax(cacheLineSize/4,MAX_NO_THREADS)
                0046       INTEGER BAR2_spinsMin(cacheLineSize/4,MAX_NO_THREADS)
                0047 
                0048       COMMON /BAR2_L/ bar2CollectStatistics
                0049       LOGICAL bar2CollectStatistics