/[MITgcm]/MITgcm/eesupp/src/check_threads.F
ViewVC logotype

Diff of /MITgcm/eesupp/src/check_threads.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9 by adcroft, Tue May 29 14:01:36 2001 UTC revision 1.10 by cnh, Fri Sep 21 03:54:34 2001 UTC
# Line 4  C $Name$ Line 4  C $Name$
4  #include "CPP_EEOPTIONS.h"  #include "CPP_EEOPTIONS.h"
5  #define HAVE_SYSTEM  #define HAVE_SYSTEM
6    
7  CStartOfInterface  CBOP
8    C     !ROUTINE: CHECK_THREADS
9    
10    C     !INTERFACE:
11        SUBROUTINE CHECK_THREADS( myThid )        SUBROUTINE CHECK_THREADS( myThid )
 C     /==========================================================\  
 C     | SUBROUTINE CHECK_THREADS                                 |  
 C     | o Check that all the threads we need did indeed start.   |  
 C     |==========================================================|  
 C     | This routine is called during the initialisation phase   |  
 C     | to check whether all the threads have started.           |  
 C     | It is invoked by every thread and if any thread finds an |  
 C     | error it should set its error flag.                      |  
 C     | Notes:                                                   |  
 C     |  Different mechanisms may be required on different       |  
 C     | platforms to actually perform the check. For example as  |  
 C     | coded here each thread checks for a semaphore set by the |  
 C     | other threads to see if they are running.                |  
 C     | It is also possible for a system to schedule threads     |  
 C     | sequentially, unless some system call is made to yield   |  
 C     | the process. This routine would detect this situation too|  
 C     | and allow a programmer to modify this routine and the    |  
 C     | barrier code to allow threads to be scheduled more       |  
 C     | appropriately.                                           |  
 C     \==========================================================/  
12        IMPLICIT NONE        IMPLICIT NONE
13    
14  C     === Global data ===  C     !DESCRIPTION:
15    C     *==========================================================
16    C     | SUBROUTINE CHECK_THREADS                                
17    C     | o Check that all the threads we need did indeed start.    
18    C     *==========================================================
19    C     | This routine is called during the initialisation phase    
20    C     | to check whether all the threads have started.            
21    C     | It is invoked by every thread and if any thread finds an  
22    C     | error it should set its error flag.                      
23    C     | Notes:                                                    
24    C     |  Different mechanisms may be required on different        
25    C     | platforms to actually perform the check. For example as  
26    C     | coded here each thread checks for a semaphore set by the  
27    C     | other threads to see if they are running.                
28    C     | It is also possible for a system to schedule threads      
29    C     | sequentially, unless some system call is made to yield    
30    C     | the process. This routine would detect this situation too
31    C     | and allow a programmer to modify this routine and the    
32    C     | barrier code to allow threads to be scheduled more        
33    C     | appropriately.                                            
34    C     *==========================================================
35    
36    C     !USES:
37    C     == Global variables ==
38  #include "SIZE.h"  #include "SIZE.h"
39  #include "EEPARAMS.h"  #include "EEPARAMS.h"
40  #include "EESUPPORT.h"  #include "EESUPPORT.h"
 C     === Routine areguments ===  
 C     myThid - My thread number  
       INTEGER myThid  
41    
42  CEndOfInterface  C     !INPUT PARAMETERS:
43    C     == Routine arguments ==
44    C     myThid :: My thread number
45          INTEGER myThid
46    
47  C     === Local variables ===  C     !LOCAL VARIABLES:
48  C     I - Loop counter  C     == Local variables ==
49  C     numberThreadRunning - Count of number of threads this thread  C     I :: Loop counter
50  C                           thinks are running.  C     numberThreadRunning :: Count of number of threads this thread
51  C     nChecks - Number of times checked for all threads. After so  C                            thinks are running.
52  C               many checks give up and report an error.  C     nChecks   :: Number of times checked for all threads. After so
53    C                  many checks give up and report an error.
54    C     msgBuffer :: Temp. for preparing text messages.
55        INTEGER I        INTEGER I
56        INTEGER numberThreadsRunning        INTEGER numberThreadsRunning
57        INTEGER nChecks        INTEGER nChecks
58        CHARACTER*(MAX_LEN_MBUF) msgBuffer        CHARACTER*(MAX_LEN_MBUF) msgBuffer
59    CEOP
60    
61  C  C
62        threadIsRunning(myThid) = .TRUE.        threadIsRunning(myThid) = .TRUE.
63        nChecks                 = 0        nChecks                 = 0

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22