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

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

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


Revision 1.8 - (show annotations) (download)
Fri Sep 21 03:54:34 2001 UTC (22 years, 8 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint44e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint46f_post, checkpoint48e_post, checkpoint44f_post, checkpoint46b_post, checkpoint43a-release1mods, release1_p13, checkpoint48i_post, checkpoint46l_pre, chkpt44d_post, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint44e_pre, release1_b1, checkpoint48b_post, checkpoint43, checkpoint48c_pre, checkpoint47d_pre, release1_chkpt44d_post, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, release1_p11, checkpoint47d_post, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint46j_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47j_post, branch-exfmods-tag, checkpoint44g_post, checkpoint46e_pre, checkpoint48c_post, checkpoint45b_post, checkpoint46b_pre, release1-branch-end, release1_final_v1, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint44b_post, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint45c_post, checkpoint44h_post, checkpoint46g_post, release1_p12_pre, checkpoint47f_post, chkpt44a_pre, checkpoint46i_post, ecco_c44_e20, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, checkpoint46e_post, release1_beta1, checkpoint44b_pre, checkpoint42, checkpoint41, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, chkpt44c_post, checkpoint48g_post, checkpoint47h_post, checkpoint44f_pre, checkpoint46d_post, release1-branch_branchpoint
Branch point for: branch-exfmods-curt, release1_final, release1-branch, release1, ecco-branch, release1_50yr, release1_coupled
Changes since 1.7: +36 -29 lines
Starting to bring comments up to date and format comments
for document extraction of "prototypes".

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/eeboot_minimal.F,v 1.7 2001/02/04 14:38:42 cnh Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5
6 CBOP
7 C !ROUTINE: EEBOOT_MINIMAL
8
9 C !INTERFACE:
10 SUBROUTINE EEBOOT_MINIMAL
11 IMPLICIT NONE
12
13 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 #include "SIZE.h"
35 #include "EEPARAMS.h"
36 #include "EESUPPORT.h"
37
38 C !LOCAL VARIABLES:
39 C == Local variables ==
40 C myThid :: Temp. dummy thread number.
41 INTEGER myThid
42 #ifdef ALLOW_USE_MPI
43 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 CHARACTER*(MAX_LEN_MBUF) msgBuffer
49 INTEGER mpiRC
50 CHARACTER*13 fNam
51 #endif /* ALLOW_USE_MPI */
52 CEOP
53
54 C-- Default values set to single processor case
55 numberOfProcs = 1
56 myProcId = 0
57 pidIO = myProcId
58 myProcessStr = '------'
59 C Set a dummy value for myThid because we are not multi-threading
60 C yet.
61 myThid = 1
62 #ifdef ALLOW_USE_MPI
63 C--
64 C-- MPI style multiple-process initialisation
65 C-- =========================================
66 #ifndef ALWAYS_USE_MPI
67 IF ( usingMPI ) THEN
68 #endif
69 C-- Initialise MPI multi-process parallel environment.
70 C On some systems program forks at this point. Others have already
71 C forked within mpirun - now thats an open standard!
72 CALL MPI_INIT( mpiRC )
73 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
74 eeBootError = .TRUE.
75 WRITE(msgBuffer,'(A,I5)')
76 & 'S/R INI_PROCS: MPI_INIT return code',
77 & mpiRC
78 CALL PRINT_ERROR( msgBuffer , myThid)
79 GOTO 999
80 ENDIF
81 C-- MPI has now been initialized but now we need to either
82 C ask for a communicator or pretend that we have:
83 C Pretend that we have asked for a communicator
84 MPI_COMM_MODEL = MPI_COMM_WORLD
85 C Ask coupler interface for a communicator
86 c hook call MITCOMPONENT_init( 'MITgcmUV', MPI_COMM_MODEL )
87
88 C-- Get my process number
89 CALL MPI_COMM_RANK( MPI_COMM_MODEL, mpiMyId, mpiRC )
90 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
91 eeBootError = .TRUE.
92 WRITE(msgBuffer,'(A,I5)')
93 & 'S/R INI_PROCS: MPI_COMM_RANK return code',
94 & mpiRC
95 CALL PRINT_ERROR( msgBuffer , myThid)
96 GOTO 999
97 ENDIF
98 myProcId = mpiMyId
99 WRITE(myProcessStr,'(I4.4)') myProcId
100 mpiPidIo = myProcId
101 pidIO = mpiPidIo
102 IF ( mpiPidIo .EQ. myProcId ) THEN
103 WRITE(fNam,'(A,A)') 'STDERR.', myProcessStr(1:4)
104 OPEN(errorMessageUnit,FILE=fNam,STATUS='unknown')
105 WRITE(fNam,'(A,A)') 'STDOUT.', myProcessStr(1:4)
106 OPEN(standardMessageUnit,FILE=fNam,STATUS='unknown')
107 ENDIF
108
109 C-- Synchronise all processes
110 C Strictly this is superfluous, but by using it we can guarantee to
111 C find out about processes that did not start up.
112 CALL MPI_BARRIER( MPI_COMM_MODEL, mpiRC )
113 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
114 eeBootError = .TRUE.
115 WRITE(msgBuffer,'(A,I5)')
116 & 'S/R INI_PROCS: MPI_BARRIER return code',
117 & mpiRC
118 CALL PRINT_ERROR( msgBuffer , myThid)
119 GOTO 999
120 ENDIF
121
122 C-- Get number of MPI processes
123 CALL MPI_COMM_SIZE ( MPI_COMM_MODEL, mpiNProcs, mpiRC )
124 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
125 eeBootError = .TRUE.
126 WRITE(msgBuffer,'(A,I5)')
127 & 'S/R INI_PROCS: MPI_COMM_SIZE return code',
128 & mpiRC
129 CALL PRINT_ERROR( msgBuffer , myThid)
130 GOTO 999
131 ENDIF
132 numberOfProcs = mpiNProcs
133
134 C-- Can not have more processes than compile time MAX_NO_PROCS
135 IF ( numberOfProcs .GT. MAX_NO_PROCS ) THEN
136 eeBootError = .TRUE.
137 WRITE(msgBuffer,'(A)')
138 & 'S/R INI_PROCS: No. of processes too large'
139 CALL PRINT_ERROR( msgBuffer , myThid)
140 GOTO 999
141 ENDIF
142 C-- Under MPI only allow same number of processes as proc.
143 C-- grid size.
144 C Strictly we are allowed more procs. but knowing there
145 C is an exact match makes things easier.
146 IF ( numberOfProcs .NE. nPx*nPy ) THEN
147 eeBootError = .TRUE.
148 WRITE(msgBuffer,'(A)')
149 & 'S/R INI_PROCS: No. of processes not equal to nPx*nPy'
150 CALL PRINT_ERROR( msgBuffer , myThid)
151 GOTO 999
152 ENDIF
153
154 #ifndef ALWAYS_USE_MPI
155 ENDIF
156 #endif
157 #endif /* ALLOW_USE_MPI */
158
159 999 CONTINUE
160
161 RETURN
162 END
163

  ViewVC Help
Powered by ViewVC 1.1.22