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

Annotation of /MITgcm/eesupp/src/eeboot_minimal.F

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


Revision 1.10 - (hide annotations) (download)
Mon May 12 19:45:17 2003 UTC (21 years, 1 month ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint50c_post, checkpoint52d_pre, checkpoint51o_pre, checkpoint51l_post, checkpoint51, checkpoint52, checkpoint50d_post, checkpoint51f_post, checkpoint51d_post, checkpoint51t_post, checkpoint51n_post, checkpoint51s_post, checkpoint51j_post, checkpoint51n_pre, checkpoint52b_pre, checkpoint51l_pre, checkpoint51q_post, checkpoint51b_pre, checkpoint52b_post, checkpoint52c_post, checkpoint51h_pre, checkpoint50f_post, checkpoint50f_pre, branchpoint-genmake2, checkpoint51r_post, checkpoint51i_post, checkpoint51b_post, checkpoint51c_post, checkpoint50g_post, checkpoint52a_pre, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint50e_post, branch-netcdf, checkpoint50d_pre, checkpoint51e_post, checkpoint51o_post, checkpoint51f_pre, checkpoint52a_post, checkpoint51g_post, ecco_c52_e35, checkpoint51m_post, checkpoint51a_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-genmake2, branch-nonh, tg2-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.9: +4 -2 lines
FORMAT seemed to cause trouble on some platforms.

1 heimbach 1.9 C $Header: /u/gcmpack/MITgcm/eesupp/src/eeboot_minimal.F,v 1.8.6.1 2002/04/04 10:19:15 heimbach Exp $
2 cnh 1.8 C $Name: $
3 cnh 1.1
4     #include "CPP_EEOPTIONS.h"
5    
6 cnh 1.8 CBOP
7     C !ROUTINE: EEBOOT_MINIMAL
8    
9     C !INTERFACE:
10 cnh 1.1 SUBROUTINE EEBOOT_MINIMAL
11 adcroft 1.6 IMPLICIT NONE
12 cnh 1.1
13 cnh 1.8 C !DESCRIPTION:
14     C *==========================================================*
15     C | SUBROUTINE EEBOOT_MINIMAL
16     C | o Set an initial environment that is predictable i.e.
17     C | behaves in a similar way on all machines and stable.
18     C *==========================================================*
19     C | Under MPI this routine calls MPI_INIT to setup the
20     C | mpi environment ( on some systems the code is running as
21     C | a single process prior to MPI_INIT, on others the mpirun
22     C | script has already created multiple processes). Until
23     C | MPI_Init is called it is unclear what state the
24     C | application is in. Once this routine has been run it is
25     C | "safe" to do things like I/O to report erros and to get
26     C | run parameters.
27     C | Note: This routine can also be compiled with CPP
28     C | directives set so that no multi-processing is initialise.
29     C | This is OK and will work fine.
30     C *==========================================================*
31    
32     C !USES:
33     C == Global data ==
34 cnh 1.1 #include "SIZE.h"
35     #include "EEPARAMS.h"
36     #include "EESUPPORT.h"
37    
38 cnh 1.8 C !LOCAL VARIABLES:
39     C == Local variables ==
40     C myThid :: Temp. dummy thread number.
41 cnh 1.1 INTEGER myThid
42     #ifdef ALLOW_USE_MPI
43 cnh 1.8 C mpiRC :: Error code reporting variable used
44     C with MPI.
45     C fNam :: Used to build name of file for standard
46     C output and error output.
47     C msgBuffer :: Used to build messages for printing.
48 cnh 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuffer
49     INTEGER mpiRC
50     CHARACTER*13 fNam
51 heimbach 1.10 INTEGER nptmp
52 cnh 1.1 #endif /* ALLOW_USE_MPI */
53 cnh 1.8 CEOP
54 cnh 1.1
55     C-- Default values set to single processor case
56     numberOfProcs = 1
57     myProcId = 0
58     pidIO = myProcId
59 adcroft 1.6 myProcessStr = '------'
60 cnh 1.4 C Set a dummy value for myThid because we are not multi-threading
61 cnh 1.1 C yet.
62     myThid = 1
63     #ifdef ALLOW_USE_MPI
64     C--
65     C-- MPI style multiple-process initialisation
66     C-- =========================================
67     #ifndef ALWAYS_USE_MPI
68     IF ( usingMPI ) THEN
69     #endif
70     C-- Initialise MPI multi-process parallel environment.
71     C On some systems program forks at this point. Others have already
72     C forked within mpirun - now thats an open standard!
73     CALL MPI_INIT( mpiRC )
74     IF ( mpiRC .NE. MPI_SUCCESS ) THEN
75     eeBootError = .TRUE.
76 adcroft 1.6 WRITE(msgBuffer,'(A,I5)')
77 cnh 1.1 & 'S/R INI_PROCS: MPI_INIT return code',
78     & mpiRC
79     CALL PRINT_ERROR( msgBuffer , myThid)
80     GOTO 999
81     ENDIF
82 adcroft 1.5 C-- MPI has now been initialized but now we need to either
83     C ask for a communicator or pretend that we have:
84     C Pretend that we have asked for a communicator
85     MPI_COMM_MODEL = MPI_COMM_WORLD
86 adcroft 1.6 C Ask coupler interface for a communicator
87     c hook call MITCOMPONENT_init( 'MITgcmUV', MPI_COMM_MODEL )
88 adcroft 1.5
89 cnh 1.1 C-- Get my process number
90 adcroft 1.5 CALL MPI_COMM_RANK( MPI_COMM_MODEL, mpiMyId, mpiRC )
91 cnh 1.1 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
92     eeBootError = .TRUE.
93 adcroft 1.6 WRITE(msgBuffer,'(A,I5)')
94 cnh 1.1 & 'S/R INI_PROCS: MPI_COMM_RANK return code',
95     & mpiRC
96     CALL PRINT_ERROR( msgBuffer , myThid)
97     GOTO 999
98     ENDIF
99     myProcId = mpiMyId
100     WRITE(myProcessStr,'(I4.4)') myProcId
101     mpiPidIo = myProcId
102     pidIO = mpiPidIo
103     IF ( mpiPidIo .EQ. myProcId ) THEN
104     WRITE(fNam,'(A,A)') 'STDERR.', myProcessStr(1:4)
105     OPEN(errorMessageUnit,FILE=fNam,STATUS='unknown')
106     WRITE(fNam,'(A,A)') 'STDOUT.', myProcessStr(1:4)
107     OPEN(standardMessageUnit,FILE=fNam,STATUS='unknown')
108     ENDIF
109    
110     C-- Synchronise all processes
111     C Strictly this is superfluous, but by using it we can guarantee to
112 cnh 1.4 C find out about processes that did not start up.
113 adcroft 1.5 CALL MPI_BARRIER( MPI_COMM_MODEL, mpiRC )
114 cnh 1.1 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
115     eeBootError = .TRUE.
116 adcroft 1.6 WRITE(msgBuffer,'(A,I5)')
117 cnh 1.1 & 'S/R INI_PROCS: MPI_BARRIER return code',
118     & mpiRC
119     CALL PRINT_ERROR( msgBuffer , myThid)
120     GOTO 999
121     ENDIF
122    
123     C-- Get number of MPI processes
124 adcroft 1.5 CALL MPI_COMM_SIZE ( MPI_COMM_MODEL, mpiNProcs, mpiRC )
125 cnh 1.1 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
126     eeBootError = .TRUE.
127 adcroft 1.6 WRITE(msgBuffer,'(A,I5)')
128 cnh 1.1 & 'S/R INI_PROCS: MPI_COMM_SIZE return code',
129     & mpiRC
130     CALL PRINT_ERROR( msgBuffer , myThid)
131     GOTO 999
132     ENDIF
133     numberOfProcs = mpiNProcs
134    
135 cnh 1.4 C-- Can not have more processes than compile time MAX_NO_PROCS
136 cnh 1.1 IF ( numberOfProcs .GT. MAX_NO_PROCS ) THEN
137     eeBootError = .TRUE.
138     WRITE(msgBuffer,'(A)')
139     & 'S/R INI_PROCS: No. of processes too large'
140     CALL PRINT_ERROR( msgBuffer , myThid)
141     GOTO 999
142     ENDIF
143     C-- Under MPI only allow same number of processes as proc.
144     C-- grid size.
145     C Strictly we are allowed more procs. but knowing there
146     C is an exact match makes things easier.
147     IF ( numberOfProcs .NE. nPx*nPy ) THEN
148     eeBootError = .TRUE.
149 heimbach 1.10 nptmp = nPx*nPy
150     WRITE(msgBuffer,'(A,2I5)')
151 heimbach 1.9 & 'S/R INI_PROCS: No. of processes not equal to nPx*nPy',
152 heimbach 1.10 & numberOfProcs, nptmp
153 cnh 1.1 CALL PRINT_ERROR( msgBuffer , myThid)
154     GOTO 999
155     ENDIF
156    
157     #ifndef ALWAYS_USE_MPI
158     ENDIF
159     #endif
160     #endif /* ALLOW_USE_MPI */
161    
162     999 CONTINUE
163    
164     RETURN
165     END
166    

  ViewVC Help
Powered by ViewVC 1.1.22