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

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

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


Revision 1.1 - (show annotations) (download)
Wed May 5 18:32:35 1999 UTC (25 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint22, checkpoint24, checkpoint25, checkpoint23, checkpoint21
Implemented new I/O package (mdsio.F). This package does parallel
I/O in much the same way as dfile.F used to except it uses "direct
access" rather than (f77) unformatted sequential access.

Problems with dfile.F package included:
  o unnecessary memory use (each process had two global sized buffers)
  o inability to read the files it had written without post-processing
  o "tiled" files were tiled by process/thread rather than actual tiles
  o created huge numbers of files with no alternatives

Features of the mdsio.F package:
  o direct-access binary writes
  o no excessive memory use
  o ability to read/write from multiple record files
  o "tiled" files are based on "WRAPPER" tiles so that the number
    and content of files is independent of the number of threads
    and/or processes
  o option to create single "global" files rather than "tiled" files
  o ability to read both "global" and "tiled" files
    [Caveat: the tiling of files must match the model tiles]
  o checkpoints now use a single file per model section
    ie.  one file for the hydrostatic model core, one file
    for the non-hydrostatic extensions and one file for the C-D
    extensions
  o the mid-level I/O routines now is broken into more source files
    read_write_fld.F supplies basic I/O routines with the same interface
                     as the original I/O package
    read_write_rec.F supplies I/O routines which allow multiple records
    write_state.F    writes the model state
    checkpoint.F     supplies the read/write checkpoint routines

All the example input data has had to be modified to be direct-access.
Otherwise only routines that used I/O have been affected and not
all of those have been due to the continuity of arguments in
the read_write_fld.F routines.

What needs to be done?  We have to create a suite of conversion
utilities for users with old-style data. Also supply the option
for using old-style I/O, not just for die-hards but for reading
data too extensive to be converted. And more...

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/read_write.F,v 1.16 1999/03/22 15:54:04 adcroft Exp $
2 #include "CPP_OPTIONS.h"
3
4 C-- File read_write_rec.F: Routines to handle mid-level I/O interface.
5 C-- Contents
6 C-- o SET_WRITE_GLOBAL_REC
7 C-- o READ_REC_XY_RS
8 C-- o READ_REC_XY_RL
9 C-- o READ_REC_XYZ_RS
10 C-- o READ_REC_XYZ_RL
11 C-- o WRITE_REC_XY_RS
12 C-- o WRITE_REC_XY_RL
13 C-- o WRITE_REC_XYZ_RS
14 C-- o WRITE_REC_XYZ_RL
15
16 SUBROUTINE SET_WRITE_GLOBAL_REC ( flag )
17 IMPLICIT NONE
18 C SET_WRITE_GLOBAL_FLD( flag ) sets an internal logical state to
19 C indicate whether files written by subsequent call to the
20 C READ_WRITE_FLD package should create "global" or "tiled" files.
21 C flag = .TRUE. indicates "global" files
22 C flag = .FALSE. indicates "tiled" files
23 C
24 C Arguments
25 LOGICAL flag
26 C Common
27 COMMON /RD_WR_REC/ globalFile
28 LOGICAL globalFile
29 C
30 globalFile=flag
31 C
32 RETURN
33 END
34
35 SUBROUTINE READ_REC_XY_RS( fName,field,iRec,myIter,myThid)
36 C READ_REC_XY_RS is a "front-end" interface to the low-level I/O
37 C routines. It assumes single record files.
38 IMPLICIT NONE
39 C Global
40 #include "SIZE.h"
41 #include "EEPARAMS.h"
42 #include "PARAMS.h"
43 C Arguments
44 CHARACTER*(*) fName
45 _RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
46 INTEGER iRec
47 INTEGER myIter
48 INTEGER myThid
49 C Functions
50 INTEGER ILNBLNK
51 C Local
52 CHARACTER*(2) fType
53 INTEGER nNz
54 INTEGER IL
55 CHARACTER*(80) fullName
56 C
57 C IF (myIter.GE.0) THEN
58 C IL=ILNBLNK( fName )
59 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
60 C ELSE
61 fullName=fName
62 C ENDIF
63 C
64 fType='RS'
65 nNz=1
66 CALL MDSREADFIELD( fullName, readBinaryPrec, fType,
67 & nNz, field, irec, myThid )
68 C
69 RETURN
70 END
71
72 SUBROUTINE READ_REC_XY_RL( fName,field,iRec,myIter,myThid)
73 C READ_REC_XY_RL is a "front-end" interface to the low-level I/O
74 C routines. It assumes single record files.
75 IMPLICIT NONE
76 C Global
77 #include "SIZE.h"
78 #include "EEPARAMS.h"
79 #include "PARAMS.h"
80 C Arguments
81 CHARACTER*(*) fName
82 _RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
83 INTEGER iRec
84 INTEGER myIter
85 INTEGER myThid
86 C Functions
87 INTEGER ILNBLNK
88 C Local
89 CHARACTER*(2) fType
90 INTEGER nNz
91 INTEGER IL
92 CHARACTER*(80) fullName
93 C
94 C IF (myIter.GE.0) THEN
95 C IL=ILNBLNK( fName )
96 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
97 C ELSE
98 fullName=fName
99 C ENDIF
100 C
101 fType='RL'
102 nNz=1
103 CALL MDSREADFIELD( fullName, readBinaryPrec, fType,
104 & nNz, field, irec, myThid )
105 C
106 RETURN
107 END
108
109 SUBROUTINE READ_REC_XYZ_RS( fName,field,iRec,myIter,myThid)
110 C READ_REC_XYZ_RS is a "front-end" interface to the low-level I/O
111 C routines. It assumes single record files.
112 IMPLICIT NONE
113 C Global
114 #include "SIZE.h"
115 #include "EEPARAMS.h"
116 #include "PARAMS.h"
117 C Arguments
118 CHARACTER*(*) fName
119 _RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
120 INTEGER iRec
121 INTEGER myIter
122 INTEGER myThid
123 C Functions
124 INTEGER ILNBLNK
125 C Local
126 CHARACTER*(2) fType
127 INTEGER nNz
128 INTEGER IL
129 CHARACTER*(80) fullName
130 C
131 C IF (myIter.GE.0) THEN
132 C IL=ILNBLNK( fName )
133 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
134 C ELSE
135 fullName=fName
136 C ENDIF
137 C
138 fType='RS'
139 nNz=Nr
140 CALL MDSREADFIELD( fullName, readBinaryPrec, fType,
141 & nNz, field, irec, myThid )
142 C
143 RETURN
144 END
145
146 SUBROUTINE READ_REC_XYZ_RL( fName,field,iRec,myIter,myThid)
147 C READ_REC_XYZ_RL is a "front-end" interface to the low-level I/O
148 C routines. It assumes single record files.
149 IMPLICIT NONE
150 C Global
151 #include "SIZE.h"
152 #include "EEPARAMS.h"
153 #include "PARAMS.h"
154 C Arguments
155 CHARACTER*(*) fName
156 _RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
157 INTEGER iRec
158 INTEGER myIter
159 INTEGER myThid
160 C Functions
161 INTEGER ILNBLNK
162 C Local
163 CHARACTER*(2) fType
164 INTEGER nNz
165 INTEGER IL
166 CHARACTER*(80) fullName
167 C
168 C IF (myIter.GE.0) THEN
169 C IL=ILNBLNK( fName )
170 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
171 C ELSE
172 fullName=fName
173 C ENDIF
174 C
175 fType='RL'
176 nNz=Nr
177 CALL MDSREADFIELD( fullName, readBinaryPrec, fType,
178 & nNz, field, irec, myThid )
179 C
180 RETURN
181 END
182
183 SUBROUTINE WRITE_REC_XY_RS( fName,field,iRec,myIter,myThid)
184 C WRITE_REC_XY_RS is a "front-end" interface to the low-level I/O
185 C routines. It assumes single record files.
186 IMPLICIT NONE
187 C Global
188 #include "SIZE.h"
189 #include "EEPARAMS.h"
190 #include "PARAMS.h"
191 C Arguments
192 CHARACTER*(*) fName
193 _RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
194 INTEGER iRec
195 INTEGER myIter
196 INTEGER myThid
197 C Functions
198 INTEGER ILNBLNK
199 C Common
200 COMMON /RD_WR_REC/ globalFile
201 LOGICAL globalFile
202 C Local
203 CHARACTER*(2) fType
204 INTEGER nNz
205 INTEGER IL
206 CHARACTER*(80) fullName
207 C
208 C IF (myIter.GE.0) THEN
209 C IL=ILNBLNK( fName )
210 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
211 C ELSE
212 fullName=fName
213 C ENDIF
214 C
215 fType='RS'
216 nNz=1
217 globalFile=.FALSE.
218 CALL MDSWRITEFIELD( fullName, writeBinaryPrec, globalFile,
219 & fType, nNz, field, irec, myIter, myThid )
220 C
221 RETURN
222 END
223
224 SUBROUTINE WRITE_REC_XY_RL( fName,field,iRec,myIter,myThid)
225 C WRITE_REC_XY_RL is a "front-end" interface to the low-level I/O
226 C routines. It assumes single record files.
227 IMPLICIT NONE
228 C Global
229 #include "SIZE.h"
230 #include "EEPARAMS.h"
231 #include "PARAMS.h"
232 C Arguments
233 CHARACTER*(*) fName
234 _RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
235 INTEGER iRec
236 INTEGER myIter
237 INTEGER myThid
238 C Functions
239 INTEGER ILNBLNK
240 C Common
241 COMMON /RD_WR_REC/ globalFile
242 LOGICAL globalFile
243 C Local
244 CHARACTER*(2) fType
245 INTEGER nNz
246 INTEGER IL
247 CHARACTER*(80) fullName
248 C
249 C IF (myIter.GE.0) THEN
250 C IL=ILNBLNK( fName )
251 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
252 C ELSE
253 fullName=fName
254 C ENDIF
255 C
256 fType='RL'
257 nNz=1
258 globalFile=.FALSE.
259 CALL MDSWRITEFIELD( fullName, writeBinaryPrec, globalFile,
260 & fType, nNz, field, irec, myIter, myThid )
261 C
262 RETURN
263 END
264
265 SUBROUTINE WRITE_REC_XYZ_RS( fName,field,iRec,myIter,myThid)
266 C WRITE_REC_XYZ_RS is a "front-end" interface to the low-level I/O
267 C routines. It assumes single record files.
268 IMPLICIT NONE
269 C Global
270 #include "SIZE.h"
271 #include "EEPARAMS.h"
272 #include "PARAMS.h"
273 C Arguments
274 CHARACTER*(*) fName
275 _RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
276 INTEGER iRec
277 INTEGER myIter
278 INTEGER myThid
279 C Functions
280 INTEGER ILNBLNK
281 C Common
282 COMMON /RD_WR_REC/ globalFile
283 LOGICAL globalFile
284 C Local
285 CHARACTER*(2) fType
286 INTEGER nNz
287 INTEGER IL
288 CHARACTER*(80) fullName
289 C
290 C IF (myIter.GE.0) THEN
291 C IL=ILNBLNK( fName )
292 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
293 C ELSE
294 fullName=fName
295 C ENDIF
296 C
297 fType='RS'
298 nNz=Nr
299 globalFile=.FALSE.
300 CALL MDSWRITEFIELD( fullName, writeBinaryPrec, globalFile,
301 & fType, nNz, field, irec, myIter, myThid )
302 C
303 RETURN
304 END
305
306 SUBROUTINE WRITE_REC_XYZ_RL( fName,field,iRec,myIter,myThid)
307 C WRITE_REC_XYZ_RL is a "front-end" interface to the low-level I/O
308 C routines. It assumes single record files.
309 IMPLICIT NONE
310 C Global
311 #include "SIZE.h"
312 #include "EEPARAMS.h"
313 #include "PARAMS.h"
314 C Arguments
315 CHARACTER*(*) fName
316 _RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
317 INTEGER iRec
318 INTEGER myIter
319 INTEGER myThid
320 C Functions
321 INTEGER ILNBLNK
322 C Common
323 COMMON /RD_WR_REC/ globalFile
324 LOGICAL globalFile
325 C Local
326 CHARACTER*(2) fType
327 INTEGER nNz
328 INTEGER IL
329 CHARACTER*(80) fullName
330 C
331 C IF (myIter.GE.0) THEN
332 C IL=ILNBLNK( fName )
333 C WRITE(fullName(1:80),'(2a,i10.10)') fName(1:IL),'.',myIter
334 C ELSE
335 fullName=fName
336 C ENDIF
337 C
338 fType='RL'
339 nNz=Nr
340 globalFile=.FALSE.
341 CALL MDSWRITEFIELD( fullName, writeBinaryPrec, globalFile,
342 & fType, nNz, field, irec, myIter, myThid )
343 C
344 RETURN
345 END

  ViewVC Help
Powered by ViewVC 1.1.22