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

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

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


Revision 1.3 - (hide annotations) (download)
Fri Sep 28 04:19:27 2001 UTC (22 years, 9 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint44e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint46f_post, checkpoint48e_post, checkpoint50c_pre, checkpoint44f_post, checkpoint46b_post, checkpoint43a-release1mods, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, release1_p13, checkpoint48i_post, checkpoint46l_pre, chkpt44d_post, checkpoint51, checkpoint50, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint50b_pre, checkpoint44e_pre, checkpoint51f_post, release1_b1, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint48b_post, checkpoint43, checkpoint51d_post, checkpoint48c_pre, checkpoint47d_pre, c49_autodiff, release1_chkpt44d_post, checkpoint47a_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint47d_post, icebear5, icebear4, icebear3, icebear2, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint46j_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, ecco_c50_e29, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, ecco_c50_e28, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47j_post, ecco_c50_e33a, branch-exfmods-tag, checkpoint44g_post, branchpoint-genmake2, checkpoint46e_pre, checkpoint48c_post, checkpoint45b_post, checkpoint46b_pre, release1-branch-end, release1_final_v1, checkpoint51b_post, checkpoint51c_post, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint44b_post, ecco_c51_e34, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint50g_post, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, checkpoint46g_post, release1_p12_pre, ecco_c44_e22, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, ecco_c44_e25, checkpoint51i_pre, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, checkpoint46i_post, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, checkpoint50d_pre, checkpoint46e_post, release1_beta1, checkpoint51e_post, checkpoint44b_pre, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51f_pre, chkpt44c_post, checkpoint48g_post, checkpoint47h_post, checkpoint44f_pre, checkpoint51g_post, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint51a_post
Branch point for: c24_e25_ice, branch-exfmods-curt, release1_final, release1-branch, branch-genmake2, release1, ecco-branch, release1_50yr, icebear, release1_coupled
Changes since 1.2: +36 -32 lines
Started to add comments...

1 heimbach 1.1
2     #include "CPP_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 heimbach 1.3 CBOP
61     C !ROUTINE: adread
62     C !INTERFACE:
63 heimbach 1.1 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 heimbach 1.3 C !DESCRIPTION: \bv
76 heimbach 1.1 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 heimbach 1.3 C \ev
89 heimbach 1.1
90 heimbach 1.3 C !USES:
91 heimbach 1.1 implicit none
92    
93     c == global variables ==
94     #include "EEPARAMS.h"
95     #include "SIZE.h"
96     #include "ctrl.h"
97 heimbach 1.2 #include "optim.h"
98 heimbach 1.1
99 heimbach 1.3 C !INPUT/OUTPUT PARAMETERS:
100 heimbach 1.1 c == routine arguments ==
101 heimbach 1.3 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 heimbach 1.1
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 heimbach 1.3 C !LOCAL VARIABLES:
122 heimbach 1.1 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 heimbach 1.3 CEOP
134 heimbach 1.1
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 heimbach 1.3 CBOP
157     C !ROUTINE: adwrite
158     C !INTERFACE:
159 heimbach 1.1 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 heimbach 1.3 C !DESCRIPTION: \bv
172 heimbach 1.1 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 heimbach 1.3 C \ev
186 heimbach 1.1
187 heimbach 1.3 C !USES:
188 heimbach 1.1 implicit none
189    
190     c == global variables ==
191     #include "EEPARAMS.h"
192     #include "SIZE.h"
193     #include "ctrl.h"
194 heimbach 1.2 #include "optim.h"
195 heimbach 1.1
196 heimbach 1.3 C !INPUT/OUTPUT PARAMETERS:
197 heimbach 1.1 c == routine arguments ==
198 heimbach 1.3 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 heimbach 1.1
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 heimbach 1.3 C !LOCAL VARIABLES:
219 heimbach 1.1 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 heimbach 1.3 CEOP
232 heimbach 1.1
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