/[MITgcm]/MITgcm/model/src/ini_model_io.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_model_io.F

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


Revision 1.33 - (show annotations) (download)
Mon May 25 02:51:43 2009 UTC (15 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint61o, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q
Changes since 1.32: +3 -2 lines
print Warning for globalFiles only if not using SingleCpuIO.

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_model_io.F,v 1.32 2009/05/22 00:18:48 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: INI_MODEL_IO
9
10 C !INTERFACE:
11 SUBROUTINE INI_MODEL_IO( myThid )
12
13 C !DESCRIPTION:
14 C Pass specific setup data for mdsio/rw.
15
16 C !USES:
17 IMPLICIT NONE
18 #include "SIZE.h"
19 #include "EEPARAMS.h"
20 #include "EESUPPORT.h"
21 #include "PARAMS.h"
22 #include "RESTART.h"
23 #ifdef ALLOW_EXCH2
24 # include "W2_EXCH2_SIZE.h"
25 # include "W2_EXCH2_TOPOLOGY.h"
26 # include "W2_EXCH2_PARAMS.h"
27 #endif /* ALLOW_EXCH2 */
28 #include "EEBUFF_SCPU.h"
29
30 C !INPUT/OUTPUT PARAMETERS:
31 C myThid :: my Thread Id number
32 INTEGER myThid
33
34 C !FUNCTIONS
35 INTEGER ILNBLNK
36 EXTERNAL ILNBLNK
37
38 C !LOCAL VARIABLES:
39 C msgBuf :: Informational/error meesage buffer
40 CHARACTER*(MAX_LEN_MBUF) msgBuf
41 CHARACTER*(MAX_LEN_FNAM) namBuf
42 INTEGER i, iL, pIL
43 LOGICAL useGlobalBuff
44 #ifdef ALLOW_EXCH2
45 INTEGER xySize
46 #endif /* ALLOW_EXCH2 */
47 #ifdef ALLOW_USE_MPI
48 INTEGER iG,jG,np
49 #endif /* ALLOW_USE_MPI */
50 CEOP
51
52 C- Safety check:
53 IF ( nPx*nPy.NE.1 .AND. globalFiles
54 & .AND. .NOT.useSingleCpuIO ) THEN
55 _BEGIN_MASTER( myThid )
56 c WRITE(msgBuf,'(2A)')
57 c & 'INI_MODEL_IO: globalFiles=TRUE is not safe',
58 c & ' in Multi-processors (MPI) run'
59 c CALL PRINT_ERROR( msgBuf , myThid)
60 c WRITE(msgBuf,'(2A)')
61 c & 'INI_MODEL_IO: use instead "useSingleCpuIO=.TRUE."'
62 c CALL PRINT_ERROR( msgBuf , myThid)
63 c STOP 'ABNORMAL END: S/R INI_MODEL_IO'
64 C------
65 C GlobalFiles option with Multi-processors execution (with MPI) is not
66 C safe: dependending on the platform & compiler, it may produce:
67 C - incomplete output files (wrong size)
68 C - wrong isolated values in some output files
69 C - missing tiles (all zeros) in some output files.
70 C A safe alternative is to set "useSingleCpuIO=.TRUE." in file "data",
71 C namelist PARAM01 (and to keep the default value of globalFiles=FALSE)
72 C or if you are really sure that the globalFile works well on our platform
73 C & compiler, comment out the above "stop"
74 C-----
75 WRITE(msgBuf,'(2A)')
76 & '** WARNING ** INI_MODEL_IO: globalFiles=TRUE is not safe',
77 & ' in Multi-processors (MPI) run'
78 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
79 & SQUEEZE_RIGHT , myThid)
80 WRITE(msgBuf,'(2A)') '** WARNING ** INI_MODEL_IO:',
81 & ' use instead "useSingleCpuIO=.TRUE."'
82 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
83 & SQUEEZE_RIGHT , myThid)
84 _END_MASTER( myThid )
85 ENDIF
86
87 C- Check size of IO buffers:
88 useGlobalBuff = useSingleCpuIO
89 #ifdef CG2D_SINGLECPU_SUM
90 useGlobalBuff = .TRUE.
91 #endif /* CG2D_SINGLECPU_SUM */
92 #ifdef ALLOW_EXCH2
93 IF ( useGlobalBuff ) THEN
94 xySize = exch2_global_Nx*exch2_global_Ny
95 #ifndef CG2D_SINGLECPU_SUM
96 IF ( .NOT.W2_useE2ioLayOut ) xySize = Nx*Ny
97 #endif /* ndef CG2D_SINGLECPU_SUM */
98 IF ( xySize.GT.W2_ioBufferSize ) THEN
99 WRITE(msgBuf,'(A,2(I10,A))')
100 & 'W2_ioBufferSize=', W2_ioBufferSize,
101 & ' <', xySize, ' = Size of Global 2-D map'
102 CALL PRINT_ERROR( msgBuf, myThid )
103 WRITE(msgBuf,'(2A)')
104 & 'INI_MODEL_IO: increase W2_ioBufferSize',
105 & ' in "W2_EXCH2_SIZE.h" + recompile'
106 CALL PRINT_ERROR( msgBuf, myThid )
107 STOP 'ABNORMAL END: S/R INI_MODEL_IO (buffer size)'
108 ENDIF
109 ENDIF
110 #endif /* ALLOW_EXCH2 */
111 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
112
113 C- Only Master-thread updates IO-parameter in Common blocks:
114 _BEGIN_MASTER( myThid )
115
116 C- Initialise AB starting level
117 C notes: those could be modified when reading a pickup that does
118 C correspond to what is actually needed.
119 tempStartAB = nIter0
120 saltStartAB = nIter0
121 mom_StartAB = nIter0
122 nHydStartAB = nIter0
123 IF ( startFromPickupAB2 ) tempStartAB = MIN( nIter0 , 1 )
124 saltStartAB = tempStartAB
125 mom_StartAB = tempStartAB
126
127 C- Initialise Alternating pickup-suffix
128 nCheckLev = 1
129 checkPtSuff(1) = 'ckptA'
130 checkPtSuff(2) = 'ckptB'
131
132 C- Flags specific to RW and MDSIO
133
134 C- now we make local directories with myProcessStr appended
135 IF ( mdsioLocalDir .NE. ' ' ) THEN
136 iL = ILNBLNK( mdsioLocalDir )
137 WRITE(namBuf,'(3A)')
138 & ' mkdir -p ', mdsioLocalDir(1:iL),myProcessStr(1:4)
139 pIL = 1 + ILNBLNK( namBuf )
140 WRITE(standardMessageUnit,'(3A)')
141 & '==> SYSTEM CALL (from INI_MODEL_IO): >',namBuf(1:pIL),'<'
142 CALL SYSTEM( namBuf(1:pIL) )
143 namBuf(1:iL) = mdsioLocalDir(1:iL)
144 WRITE(mdsioLocalDir,'(3A)') namBuf(1:iL),myProcessStr(1:4),'/'
145 ENDIF
146
147 C- Initialise MFLDS variables in common block
148 CALL READ_MFLDS_INIT( myThid )
149
150 C Set globalFiles flag for READ_WRITE_FLD package
151 CALL SET_WRITE_GLOBAL_FLD( globalFiles )
152 C Set globalFiles flag for READ_WRITE_REC package
153 CALL SET_WRITE_GLOBAL_REC( globalFiles )
154 C Set globalFiles flag for READ_WRITE_PICKUP
155 CALL SET_WRITE_GLOBAL_PICKUP( globalFiles )
156
157 _END_MASTER( myThid )
158 C- Everyone else must wait for the IO-parameters to be set
159 _BARRIER
160
161 C- Global IO-buffers initialisation
162 IF ( useGlobalBuff ) THEN
163 _BEGIN_MASTER( myThid )
164 DO i=1,xyBuffer_size
165 xy_buffer_r8(i) = 0. _d 0
166 xy_buffer_r4(i) = 0.
167 ENDDO
168 _END_MASTER( myThid )
169 ENDIF
170
171 C- MNC model-io initialisation
172
173 #ifdef ALLOW_MNC
174 IF (useMNC) THEN
175
176 C Write units/set precision/etc for I/O of variables/arrays
177 C belonging to the core dynamical model
178 CALL INI_MNC_VARS( myThid )
179
180 #ifdef ALLOW_AUTODIFF
181 CALL AUTODIFF_INI_MODEL_IO( myThid )
182 #endif
183
184 ENDIF
185 #endif /* ALLOW_MNC */
186
187 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
188
189 RETURN
190 END

  ViewVC Help
Powered by ViewVC 1.1.22