/[MITgcm]/MITgcm/pkg/autodiff/adread_adwrite.F
ViewVC logotype

Contents of /MITgcm/pkg/autodiff/adread_adwrite.F

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


Revision 1.4 - (show annotations) (download)
Thu Oct 9 04:19:19 2003 UTC (20 years, 11 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint57m_post, checkpoint52l_pre, hrcube4, hrcube5, checkpoint57g_pre, checkpoint57s_post, checkpoint57b_post, checkpoint52d_pre, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint52j_pre, checkpoint51o_pre, checkpoint54d_post, checkpoint54e_post, checkpoint51l_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint52l_post, checkpoint52k_post, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint53, checkpoint52, checkpoint52f_post, checkpoint57n_post, checkpoint57z_post, checkpoint54f_post, checkpoint51t_post, checkpoint51n_post, checkpoint55i_post, checkpoint57l_post, checkpoint52i_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint57t_post, checkpoint55c_post, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint53d_post, checkpoint57a_post, checkpoint57h_pre, checkpoint52b_pre, checkpoint54b_post, checkpoint57h_post, checkpoint51l_pre, checkpoint52m_post, checkpoint57y_pre, checkpoint55g_post, checkpoint51q_post, checkpoint52b_post, checkpoint52c_post, checkpoint57c_post, checkpoint52f_pre, checkpoint55d_post, checkpoint54a_pre, checkpoint53c_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint55j_post, checkpoint54a_post, checkpoint55h_post, checkpoint51r_post, checkpoint51i_post, checkpoint57e_post, checkpoint55b_post, checkpoint53a_post, checkpoint55f_post, checkpoint52d_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint52a_pre, checkpoint52i_post, checkpoint52h_pre, checkpoint56a_post, checkpoint53f_post, checkpoint57h_done, checkpoint52j_post, checkpoint57j_post, checkpoint57f_pre, branch-netcdf, checkpoint52n_post, checkpoint53b_pre, checkpoint56c_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint51o_post, checkpoint57k_post, checkpoint53b_post, checkpoint52a_post, checkpoint57w_post, ecco_c52_e35, checkpoint57x_post, checkpoint51m_post, checkpoint53d_pre, checkpoint55e_post, checkpoint54c_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-nonh, tg2-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.3: +1 -1 lines
 o first check-in for the "branch-genmake2" merge
 o verification suite as run on shelley (gcc 3.2.2):

Wed Oct  8 23:42:29 EDT 2003
                T           S           U           V
G D M    c        m  s        m  s        m  s        m  s
E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d
2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .

OPTFILE=NONE

Y Y Y Y 13 16 16 16  0 16 16 16 16 16 16 16 16 13 12  0  0 pass  adjustment.128x64x1
Y Y Y Y 16 16 16 16  0 16 16 16 16 16 16  0  0 16 16  0  0 pass  adjustment.cs-32x32x1
Y Y Y Y 16 16 16 16  0 16 16 16 16 16 16 22  0 16 16 22  0 pass  adjust_nlfs.cs-32x32x1
Y Y Y Y -- 13 13 16 16 13 13 13 13 16 16 16 16 16 16 16 16 N/O   advect_cs
Y Y Y Y -- 22 16 16 16 16 16 16 13 16 16 16 16 16 16 16 16 N/O   advect_xy
Y Y Y Y -- 13 16 13 16 16 16 16 16 16 16 22 16 16 16 16 16 N/O   advect_xz
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 pass  aim.5l_cs
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 16 16 16 16 16 13 16 pass  aim.5l_Equatorial_Channel
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 13 16 16 13 13 16 pass  aim.5l_LatLon
Y Y Y Y 13 16 16 16 16 16 16 16 16 16 13 12 13 13 16 13 16 pass  exp0
Y Y Y Y 14 16 16 16 16 16 16 16 22 16 16 16 13 16 16 22 16 pass  exp1
Y Y Y Y 13 13 16 13 16 16 16 16 16 13 13 16 16 13 13 13 13 pass  exp2
Y Y Y Y 16 16 16 16 16 16 16 16 22 16 16 16 16 16 16 16 16 pass  exp4
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 22 16 16 16 22 16 pass  exp5
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 pass  front_relax
Y Y Y Y 14 16 16 13 13 16 16 13 13 16 13 13 16 12 13 13 16 pass  global_ocean.90x40x15
Y Y Y Y 10 16 16 13 13 16 13 16 16 13 13 13 13 16 16 13 16 FAIL  global_ocean.cs32x15
Y Y Y Y  6 11 12 13 13 12 13 16 13  9  9  9  9 10  9  9 11 FAIL  global_ocean_pressure
Y Y Y Y 14 16 16 13 16 16 16 13 13 13 13 13 16 12 16 13 16 pass  global_with_exf
Y Y Y Y 14 16 16 16 16 16 16 16 16 11 13 22 13 16 16  9 16 pass  hs94.128x64x5
Y Y Y Y 13 16 16 16 16 16 16 16 16 11 16 16 16 13 16 22 13 pass  hs94.1x64x5
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 16 13 13 16 16 22 13 pass  hs94.cs-32x32x5
Y Y Y Y 10 10 16 13 13 16 16 16 22 16 13 13 13 13 13 22 13 FAIL  ideal_2D_oce
Y Y Y Y  8 16 16 16 16 16 16 16 16 13 13  8 16 16 16 16 16 FAIL  internal_wave
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 13 22 13 13 13 22 16 pass  inverted_barometer
Y Y Y Y 12 16 16 16 16 16 16 16 16 16 13 12 13 13 13 13 13 FAIL  lab_sea
Y Y Y Y 11 16 16 16 16 16 16 16 13 13 13 12 13 16 13 12 13 FAIL  natl_box
Y Y Y Y 16 16 16 16 16 16 16 16 22 16 16 16 16 16 16 16 16 pass  plume_on_slope
Y Y Y Y 13 16 16 16 16 13 16 16 16 16 16 16 16 13 16 16 16 pass  solid-body.cs-32x32x1

1
2 #include "AUTODIFF_OPTIONS.h"
3
4 c ==================================================================
5 c
6 c ad_read_write.F: routines to handle the I/O of the TAMC generated
7 c code. All files are direct access files.
8 c Routines:
9 c
10 c o adread - Read data from file.
11 c o adwrite - Write data to file.
12 c
13 c
14 c The following input veriables are used throughout in the argument
15 c lists:
16 c
17 c name - character
18 c On entry, name is the extended tape name.
19 c len - integer
20 c On entry, len is the number of characters in name.
21 c tid - integer
22 c On entry, tid identifies the tape.
23 c vid - integer
24 c On entry, vid identifies the variable to be stored on
25 c the tape.
26 c var - real array of dimension length
27 c On entry, var contains the values to be stored.
28 c var must not be changed.
29 c size - integer
30 c On entry, size is the size in bytes of the type of
31 c variable var.
32 c length - integer
33 c On entry, length is the dimension of the variable
34 c stored on the tape.
35 c irec - integer
36 c On entry, irec is the record number to be written.
37 c mythid - integer
38 c On entry, mythid is the number of the thread or
39 c instance of the program.
40 c myiter - integer
41 c On entry, myiter is the current iteration step during
42 c the integration.
43 c
44 c For further details on this see the TAMC Users Manual, Appendix B,
45 c User defined Storage Subroutines.
46 c
47 c TAMC does not provide the two leading arguments mythid and myiter
48 c when compiling the MITgcmUV code. Instead the is a sed script avail-
49 c able that does change the TAMC-generated adjoint code.
50 c
51 c Only the master thread is allowed to write data and only gobal
52 c model arrays are allowed to be written be the subsequent routines.
53 c Tiled data are to be stored in common blocks. This implies that at
54 c least a two level checkpointing for the adjoint code has to be
55 c available.
56 c
57 c ==================================================================
58
59
60 CBOP
61 C !ROUTINE: adread
62 C !INTERFACE:
63 subroutine adread(
64 I mythid,
65 I name,
66 I len,
67 I tid,
68 I vid,
69 O var,
70 I size,
71 I length,
72 I irec
73 & )
74
75 C !DESCRIPTION: \bv
76 c ==================================================================
77 c SUBROUTINE adread
78 c ==================================================================
79 c o Read direct access file.
80 c A call to this routine implies an open-read-close sequence
81 c since it uses the MITgcmUV i/o routine MDSREADVECTOR. Only
82 c the master thread reads the data. Otherwise each thread would
83 c read from file.
84 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
85 c ==================================================================
86 c SUBROUTINE adread
87 c ==================================================================
88 C \ev
89
90 C !USES:
91 implicit none
92
93 c == global variables ==
94 #include "EEPARAMS.h"
95 #include "SIZE.h"
96 #include "ctrl.h"
97 #include "optim.h"
98
99 C !INPUT/OUTPUT PARAMETERS:
100 c == routine arguments ==
101 c name - extended tape name.
102 c len - number of characters in name.
103 c tid - tape identifier.
104 c vid - identifies the variable to be stored on tape.
105 c var - values to be stored.
106 c size - size in bytes of the type of variable var.
107 c length - dimension of the variable stored on the tape.
108 c mythid - number of the thread or instance of the program.
109 c irec - record number to be written.
110
111 integer mythid
112 character*(*) name
113 integer len
114 integer tid
115 integer vid
116 integer size
117 integer length
118 integer irec
119 _RL var(length)
120
121 C !LOCAL VARIABLES:
122 c == local variables ==
123 character*(7) itername
124 character*(80) fname
125 integer il
126 integer bx,by
127
128 c == functions ==
129 integer ilnblnk
130 external ilnblnk
131
132 c == end of interface ==
133 CEOP
134
135 write(fname(1:80),'(a)') ' '
136 write(itername,'(a,i4.4)') '.it',optimcycle
137
138 il = ilnblnk( name )
139
140 write(fname(1:il+7),'(a,a)') name(1:il),itername
141
142 _BEGIN_MASTER( mythid )
143 by = myByLo(myThid)
144 bx = myBxLo(myThid)
145 call mdsreadvector( fname, size*8, 'RL',
146 & length, var, bx, by, irec, mythid )
147 _END_MASTER( mythid )
148
149 c Everyone must wait for the read operation to be completed.
150 _BARRIER
151
152 return
153 end
154
155
156 CBOP
157 C !ROUTINE: adwrite
158 C !INTERFACE:
159 subroutine adwrite(
160 I mythid,
161 I name,
162 I len,
163 I tid,
164 I vid,
165 I var,
166 I size,
167 I length,
168 I irec
169 & )
170
171 C !DESCRIPTION: \bv
172 c ==================================================================
173 c SUBROUTINE adwrite
174 c ==================================================================
175 c o Write to direct access file.
176 c A call to this routine implies an open-read-close sequence
177 c since it uses the MITgcmUV i/o routine MDSREADVECTOR. Only
178 c the master thread writes the data. Otherwise each thread would
179 c write to file. This would result in an excessive waste of
180 c disk space.
181 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
182 c ==================================================================
183 c SUBROUTINE adwrite
184 c ==================================================================
185 C \ev
186
187 C !USES:
188 implicit none
189
190 c == global variables ==
191 #include "EEPARAMS.h"
192 #include "SIZE.h"
193 #include "ctrl.h"
194 #include "optim.h"
195
196 C !INPUT/OUTPUT PARAMETERS:
197 c == routine arguments ==
198 c name - extended tape name.
199 c len - number of characters in name.
200 c tid - tape identifier.
201 c vid - identifies the variable to be stored on tape.
202 c var - values to be stored.
203 c size - size in bytes of the type of variable var.
204 c length - dimension of the variable stored on the tape.
205 c mythid - number of the thread or instance of the program.
206 c irec - record number to be written.
207
208 integer mythid
209 character*(*) name
210 integer len
211 integer tid
212 integer vid
213 integer size
214 integer length
215 integer irec
216 _RL var(length)
217
218 C !LOCAL VARIABLES:
219 c == local variables ==
220 character*(7) itername
221 character*(80) fname
222 integer il
223 integer bx,by
224 logical globalfile
225
226 c == functions ==
227 integer ilnblnk
228 external ilnblnk
229
230 c == end of interface ==
231 CEOP
232
233 globalfile = .false.
234 il = ilnblnk( name )
235 write(fname(1:80),'(a)') ' '
236
237 write(itername,'(a,i4.4)') '.it',optimcycle
238
239 write(fname(1:il+7),'(a,a)') name(1:il),itername
240
241 _BEGIN_MASTER( mythid )
242 by = myByLo(myThid)
243 bx = myBxLo(myThid)
244 call mdswritevector( fname, size*8, globalfile, 'RL',
245 & length, var, bx, by, irec, 0, mythid )
246 _END_MASTER( mythid )
247
248 c Everyone must wait for the write operation to be completed.
249 _BARRIER
250
251 return
252 end

  ViewVC Help
Powered by ViewVC 1.1.22