Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
924557e60a Chri*0001 #include "CPP_EEOPTIONS.h"
4749c74143 Alis*0002 #include "PACKAGES_CONFIG.h"
924557e60a Chri*0003 
a5584ccf48 Jean*0004 CBOP
4c563c2ee9 Chri*0005 C     !ROUTINE: EEBOOT
                0006 
                0007 C     !INTERFACE:
e4a86aa47e Jean*0008       SUBROUTINE EEBOOT( myComm )
924557e60a Chri*0009 
4c563c2ee9 Chri*0010 C     !DESCRIPTION:
                0011 C     *==========================================================*
a5584ccf48 Jean*0012 C     | SUBROUTINE EEBOOT
                0013 C     | o Set up execution "environment", particularly perform
                0014 C     |   steps to initialise parallel processing.
4c563c2ee9 Chri*0015 C     *==========================================================*
a5584ccf48 Jean*0016 C     | Note: This routine can also be compiled with CPP
                0017 C     | directives set so that no multi-processing is initialised
                0018 C     | This is OK and works fine.
4c563c2ee9 Chri*0019 C     *==========================================================*
                0020 
                0021 C     !CALLING SEQUENCE:
                0022 C     eeboot()
                0023 C       |
a5584ccf48 Jean*0024 C       |-- eeboot_minimal() :: Minimal startup. Just enough to
4c563c2ee9 Chri*0025 C       |                       allow basic I/O.
                0026 C       |
                0027 C       |-- eeintro_msg()    :: Write startup greeting.
                0028 C       |
                0029 C       |-- eeset_parms()    :: Set WRAPPER parameters
                0030 C       |
                0031 C       |-- eewrite_eeenv()  :: Print WRAPPER parameter settings
                0032 C       |
                0033 C       |-- ini_procs()      :: Associate processes with grid regions.
                0034 C       |
                0035 C       |-- ini_threading_environment() :: Associate threads with grid regions.
                0036 C       |
a5584ccf48 Jean*0037 C       |-- cpl_register()   :: Pass attributes to the coupler
                0038 C       |
                0039 C       |-- w2_eeboot()      :: Initialise WRAPPER2 execution environment
4c563c2ee9 Chri*0040 
                0041 C     !USES:
78ca572b69 Jean*0042       IMPLICIT NONE
924557e60a Chri*0043 C     == Global variables ==
                0044 #include "SIZE.h"
                0045 #include "EEPARAMS.h"
                0046 #include "EESUPPORT.h"
                0047 
e4a86aa47e Jean*0048 C     !ROUTINE ARGUMENTS
                0049 C     == Routine arguments ==
                0050 C     myComm     :: Communicator that is passed down from
                0051 C                   upper level driver (if there is one).
                0052       INTEGER myComm
                0053 
4c563c2ee9 Chri*0054 C     !LOCAL VARIABLES:
924557e60a Chri*0055 C     == Local variables ==
4c563c2ee9 Chri*0056 C     I :: Loop counter
924557e60a Chri*0057       INTEGER I
bcd4c13bf6 Jean*0058       LOGICAL doReport
4c563c2ee9 Chri*0059 CEOP
924557e60a Chri*0060 
                0061 C--   Set error reporting flags and I/O streams
                0062 C     fatalError is a flag used to indicate that the program
                0063 C                ended abnormally.
                0064 C     errorMessageUnit is the Fortran unit number used for
                0065 C                      writing error messages.
                0066 C     standardMessageUnit is the Fortran unit number used for
                0067 C                          writing textual, informational output.
                0068 C     eeBootError is a flag used to indicate an error in the
                0069 C                "execution environment" startup pahse as opposed
                0070 C                to the simulation pahse of the execution.
a5584ccf48 Jean*0071 C     eeEndError is used to indicate an "execution environment" shutdown
924557e60a Chri*0072 C                error.
                0073 C     thError flag used to allow a thread to report an error.
a5584ccf48 Jean*0074 C             This is only really used during the startup process,
924557e60a Chri*0075 C             although it could be used elsewhere.
                0076 C     allMyEdgesAreSharedMemory flag which says for a particular
                0077 C                               set of blocks the only form of communication
                0078 C                               it does is using shared memory.
a5584ccf48 Jean*0079 C     threadIsRunning used during startup to enable check that all
924557e60a Chri*0080 C                     the threads are running.
                0081       fatalError          = .FALSE.
                0082       eeBootError         = .FALSE.
                0083       eeEndError          = .FALSE.
                0084       DO I=1, MAX_NO_THREADS
                0085        thError(I)                   = .FALSE.
                0086        allMyEdgesAreSharedMemory(I) = .TRUE.
                0087        threadIsRunning(I)           = .FALSE.
                0088        threadIsComplete(I)          = .FALSE.
66dc79a095 Chri*0089        ioErrorCount(I)              = 0
924557e60a Chri*0090       ENDDO
8ef932ee66 Patr*0091       standardMessageUnit = 6
25903815bf Jean*0092 #ifdef HACK_FOR_GMAO_CPL
                0093       scrUnit1            = 31
                0094       scrUnit2            = 32
                0095       eeDataUnit          = 33
                0096       modelDataUnit       = 34
                0097       errorMessageUnit    = 35
7727ad69a9 Dimi*0098       standardMessageUnit = 36
25903815bf Jean*0099 #else
8ef932ee66 Patr*0100       scrUnit1            = 11
                0101       scrUnit2            = 12
                0102       eeDataUnit          = 13
                0103       modelDataUnit       = 14
                0104       errorMessageUnit    = 15
                0105 cph   errorMessageUnit = 0 is not allowed on some platforms, e.g. SP3
25903815bf Jean*0106 #endif
924557e60a Chri*0107 
fae0c8fa99 Jean*0108 C--   Start minimal environment so that we can do I/O to report errors.
924557e60a Chri*0109 C     Notes
                0110 C     =====
                0111 C     o Here we start MPI and setup the I/O environment
fae0c8fa99 Jean*0112 C       that is needed for error reporting.
924557e60a Chri*0113 C     o Under MPI I/O support is very variable until
                0114 C       MPI is started. This makes is hard to trap the case
a5584ccf48 Jean*0115 C       where mpirun is used to start a non-MPI run or
924557e60a Chri*0116 C       we try to start MPI when mpirun was not used.
                0117 C       after it is started.
a5584ccf48 Jean*0118 C jmc: test:
                0119 C     If necessary ( COMPONENT_MODULE defined ) add a 1rst preliminary
ed584e7d0c Jean*0120 C     call to eeset_params (in EEBOOT_MINIMAL) to set useCoupler (needed
                0121 C     very early, and the stardard call eeset_params below comes too late)
                0122 C jmc: This needs to be sorted-out in a cleaner way.
e4a86aa47e Jean*0123       CALL EEBOOT_MINIMAL( myComm )
924557e60a Chri*0124       IF ( eeBootError ) GOTO 999
                0125 
                0126 C--   Now we can write a startup message
                0127       CALL EEINTRO_MSG
                0128 
                0129 C--   Initialise parameters associated with execution environment.
bcd4c13bf6 Jean*0130       doReport = .TRUE.
3777bbd57d Jean*0131       CALL EESET_PARMS ( myProcId, doReport )
924557e60a Chri*0132       IF ( eeBootError ) GOTO 999
                0133 
                0134 C--   Write summary of execution environment configuration for this run
                0135       CALL EEWRITE_EEENV
                0136 
                0137 C--   Now do the rest of the multi-process startup.
                0138 C     o Here we map processes to the model grid.
                0139 C     o Print tables of process-grid mappings.
a5584ccf48 Jean*0140 C     o Do other miscellaneous multi-processing set up steps. For
924557e60a Chri*0141 C       example under MPI we create datatypes for communication
                0142 C       of array edges.
                0143       CALL INI_PROCS
                0144       IF ( eeBootError ) GOTO 999
                0145 
                0146 C--   Initialise variables to support "nThreads" of computation.
                0147 C     o Note the program is still running with a single thread of
                0148 C       execution at this stage.
                0149       CALL INI_THREADING_ENVIRONMENT
                0150       IF ( eeBootError ) GOTO 999
66dc79a095 Chri*0151 
4749c74143 Alis*0152 #ifdef ALLOW_EXCH2
046fd16d1c Andr*0153 C--   Initialise WRAPPER2 execution environment
                0154       CALL W2_EEBOOT
4749c74143 Alis*0155 #endif /* ALLOW_EXCH2 */
046fd16d1c Andr*0156 
7f3f82a0c0 Jean*0157 C--   Pass attributes to the coupler
                0158 #ifdef COMPONENT_MODULE
                0159       IF ( useCoupler ) CALL CPL_REGISTER
                0160 #endif
                0161 
924557e60a Chri*0162   999 CONTINUE
                0163       RETURN
                0164       END