1 |
<!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> |
<!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> |
|
|
|
|
<article id="MITgcm-Development-HOWTO"> |
|
|
|
|
2 |
<!-- |
<!-- |
3 |
Build commands: |
$Header$ |
4 |
db2ps -d ldp.dsl devel_HOWTO.sgml |
$Name$ |
|
db2pdf -d ldp.dsl devel_HOWTO.sgml |
|
|
db2html -d ./ldp.dsl devel_HOWTO.sgml |
|
|
db2html -u -d ./ldp.dsl devel_HOWTO.sgml |
|
5 |
--> |
--> |
6 |
|
|
7 |
|
<article id="MITgcm-Development-HOWTO"> |
8 |
|
|
9 |
<articleinfo> |
<articleinfo> |
10 |
<title>MITgcm Development HOWTO</title> |
<title>MITgcm Development HOWTO</title> |
11 |
|
|
26 |
Initial version. |
Initial version. |
27 |
</revremark> |
</revremark> |
28 |
</revision> |
</revision> |
29 |
|
<revision> |
30 |
|
<revnumber>0.02</revnumber> |
31 |
|
<date>2010-01-21</date> |
32 |
|
<authorinitials>jmc</authorinitials> |
33 |
|
<revremark> |
34 |
|
update links. |
35 |
|
</revremark> |
36 |
|
</revision> |
37 |
|
<revision> |
38 |
|
<revnumber>0.03</revnumber> |
39 |
|
<date>2010-04-25</date> |
40 |
|
<authorinitials>jmc</authorinitials> |
41 |
|
<revremark> |
42 |
|
Add subsection "Developer settings" (under CVS Repository). |
43 |
|
</revremark> |
44 |
|
</revision> |
45 |
</revhistory> |
</revhistory> |
46 |
|
|
47 |
<abstract> |
<abstract> |
57 |
<sect2> |
<sect2> |
58 |
<title>New Versions of This Document</title> <para>You can |
<title>New Versions of This Document</title> <para>You can |
59 |
obtain the latest version of this document <ulink |
obtain the latest version of this document <ulink |
60 |
url="http://mitgcm.org/dev_docs/devel_HOWTO/">online</ulink> in |
url="http://mitgcm.org/public/docs.html">online</ulink> in |
61 |
various formats.</para> |
various formats.</para> |
62 |
</sect2> |
</sect2> |
63 |
<sect2> |
<sect2> |
75 |
<sect2> |
<sect2> |
76 |
<title>User Manual</title> |
<title>User Manual</title> |
77 |
|
|
78 |
<para>Before jumping into |
<para>Before jumping into development, please familiarize yourself with |
79 |
development, please familiarize yourself with the MITgcm user |
the <ulink url="http://mitgcm.org/public/docs.html"> MITgcm user manual |
80 |
manual which is available <ulink |
</ulink>. This document contains volumes of useful information and is |
81 |
url="http://mitgcm.org/">on the main web page</ulink>. This |
included here by reference.</para> |
|
document contains volumes of useful information and is included |
|
|
here by reference.</para> |
|
82 |
|
|
83 |
<para>Also, a "snapshot" or<ulink |
<!-- |
84 |
|
<para>Also, a "snapshot" or <ulink |
85 |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
86 |
the user manual may be available, though this is only put on the |
the user manual may be available, though this is only put on the |
87 |
web for testing purposes.</para> |
web for testing purposes.</para> |
88 |
|
--> |
89 |
</sect2> |
</sect2> |
90 |
|
|
91 |
<sect2> |
<sect2> |
114 |
|
|
115 |
<sect1 id="cvs"> |
<sect1 id="cvs"> |
116 |
<title>CVS Repository</title> |
<title>CVS Repository</title> |
117 |
|
|
118 |
<sect2> |
<sect2> |
119 |
<title>Layout</title> |
<title>Layout</title> |
120 |
|
|
125 |
others. The tree currently resembles:</para> |
others. The tree currently resembles:</para> |
126 |
|
|
127 |
<programlisting>gcmpack/ |
<programlisting>gcmpack/ |
128 |
MITgcm-contrib contributed code |
CVSROOT -hidden- |
|
CS-regrid goes into utils |
|
|
cvspolicy.html -save- |
|
|
CVSROOT -save- |
|
|
development experimental stuff |
|
|
manual -save- |
|
|
misc -?- |
|
129 |
|
|
130 |
MITgcm code |
MITgcm code |
131 |
adjoint fold into genmake |
bin empty |
132 |
bin stub for ecco build |
doc basic developpment documentation |
133 |
compare01 old from 20th century |
eesupp execution environment support code (wrapper) |
134 |
diags timeave f77 in pkgs now |
exe empty |
135 |
doc tags -- connect to real docs? |
jobs runtime shell scripts for |
136 |
eesupp cnh? |
various platforms (not maintained) |
137 |
exe ecco user build |
lsopt line search |
138 |
,- jobs runtime shell scripts for |
model main dynamics (core) |
139 |
| various platforms |
optim line search interface |
140 |
| lsopt line search |
pkg alternate and optional numerics, etc. |
141 |
m| model main dynamics (core) |
tools scripts to build (and test) |
142 |
e| optimization_drivers ? |
utils pre/post processing tools (matlab, ..) |
143 |
r| optim line search interface |
verification standard regression tests + examples |
144 |
g| pkg alternate and optional numerics, etc. |
+ documented examples (tutorials) |
145 |
e|- tools |
tutorial_examples (only in release1 branch) |
|
?| tutorial_examples documented tests |
|
|
| only populated on release1 branch |
|
|
| and not validated during "testscript" |
|
|
'- utils |
|
|
verification std tests |
|
146 |
|
|
147 |
|
MITgcm_contrib contributed code |
148 |
|
|
149 |
mitgcmdoc -> manual -remove- |
acesgrid.org build acesgrid web site |
150 |
|
development experimental stuff |
151 |
|
gfd_lab -?- |
152 |
|
manual source of MITgcm documentation |
153 |
mitgcm.org build web site |
mitgcm.org build web site |
154 |
models -?- |
old_develop old and early development source |
155 |
packages -?- |
misc -?- |
156 |
preprocess -?- |
models -?- |
157 |
tmp -?- |
packages -?- |
158 |
|
preprocess -?- |
159 |
|
pdfs some pdfs |
160 |
|
planetinabottle.org unfinished web site |
161 |
|
www.ecco-group.org build ecco web site ? |
162 |
</programlisting> |
</programlisting> |
163 |
|
|
164 |
|
<!-- |
165 |
<para>Efforts are underway to reduce the complexity.</para> |
<para>Efforts are underway to reduce the complexity.</para> |
166 |
|
--> |
167 |
|
|
168 |
</sect2> |
</sect2> |
169 |
|
|
202 |
<title>Branches</title> |
<title>Branches</title> |
203 |
|
|
204 |
<para>As shown in the online <ulink |
<para>As shown in the online <ulink |
205 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index?graph=1.174">ViewCVS-generated |
url="http://mitgcm.org/viewvc/MITgcm/MITgcm/model/src/forward_step.F?view=graph"> |
206 |
tree</ulink>, the MITgcm codebase is split into to two branches |
ViewCVS-generated tree</ulink>, the MITgcm codebase is split into |
207 |
or "lines" under which development proceeds. These two lines |
branches or "lines" under which development proceeds. The main line |
208 |
are referred to as the "MAIN" and "ecco" versions of the code. |
of development is referred to as the "MAIN" version of the code. |
|
While not identical, the bulk of the MAIN and ecco lines are |
|
|
composed of files from the same codebase. |
|
209 |
</para> |
</para> |
210 |
|
|
211 |
<para>Periodically, a "Release" branch is formed from the "MAIN" |
<para>Periodically, a "Release" branch is formed from the "MAIN" |
212 |
development branch. This is done in order to create a |
development branch. This is done in order to create a relatively stable |
213 |
relatively stable reference point for both users and developers. |
reference point for both users and developers. The intent is that once a |
214 |
The intent is that once a relese branch has been created, only |
release branch has been created, only bug-fixes will be added to it. |
215 |
bug-fixes will be added to it. Meanwhile, development (which |
Meanwhile, development (which might "break" or otherwise render invalid |
216 |
might "break" or otherwise render invalid the documentation, |
the documentation, tutorials, and/or examples contained within a release |
217 |
tutorials, and/or examples contained within a release branch) is |
branch) is allowed to continue along the MAIN line.</para> |
|
allowed to continue along the MAIN and ecco lines.</para> |
|
218 |
</sect2> |
</sect2> |
219 |
|
|
220 |
<sect2> |
<sect2> |
221 |
<title>Tagging</title> |
<title> Developer settings </title> |
|
|
|
|
<para>The intent of tagging is to create "known-good" |
|
|
checkpoints that developers can use as references. |
|
|
Traditionally, MITgcm tagging has maintained the following |
|
|
conventions:</para> |
|
222 |
|
|
223 |
|
<para>CVS is a convenient tool to keep up-to-date a personal copy of the |
224 |
|
MITgcm code (see: <ulink url="http://mitgcm.org/public/using_cvs.html"> |
225 |
|
using CVS </ulink>). The same tool is used by developers to |
226 |
|
incorporate any change into the repository. However, this later |
227 |
|
function requires specific settings, as detailed here after:</para> |
228 |
<orderedlist> |
<orderedlist> |
229 |
<listitem> |
<listitem> |
230 |
<para>Developer checks out code into a local CVS-managed |
<para> You will need an account (loggin access) to the server |
231 |
directory, makes various changes/additions, tests these |
"mitgcm.org" with the proper group setting (e.g., |
232 |
edits, and eventually reaches a point where (s)he is |
group "gcmctrb" to add/modify code into MITgcm_contrib). |
233 |
satisfied that the changes form a new "useful" point in the |
This kind of account is granted only upon well motivated request. |
234 |
evolution of the code.</para> |
The access to the server mitgcm.org is through ssh-key authorization |
235 |
|
which will need to be set properly on both side (on your local machine |
236 |
|
and on your server account). You need to be able to |
237 |
|
to ssh to mitgcm.org (or <filename>ssh MY_USER_NAME@mitgcm.org</filename> |
238 |
|
in case of different user-name on both sides) to proceed further.</para> |
239 |
|
</listitem> |
240 |
|
|
241 |
|
<listitem> |
242 |
|
<para> You need to register to the |
243 |
|
<ulink url="http://mitgcm.org/mailman/listinfo/mitgcm-cvs"> |
244 |
|
mitgcm-cvs </ulink> mailing list. |
245 |
|
This ensures that other developers will receive email notification |
246 |
|
when you make changes; you will also receive as well such email |
247 |
|
when others make changes to the repository. |
248 |
|
</para> |
249 |
|
</listitem> |
250 |
|
|
251 |
|
<listitem> |
252 |
|
<para> It is highly recommended that you register also to the |
253 |
|
<ulink url="http://mitgcm.org/mailman/listinfo/mitgcm-devel"> |
254 |
|
mitgcm-devel </ulink> mailing list (expect a short delay for |
255 |
|
this request to be processed). |
256 |
|
This list is intended for developer discussions. |
257 |
|
</para> |
258 |
|
</listitem> |
259 |
|
|
260 |
|
<listitem> |
261 |
|
<para> The standard anonymous mode (using "cvsanon", as mentionned |
262 |
|
<ulink url="http://mitgcm.org/public/source_code.html"> |
263 |
|
here </ulink>) does not allow check-in ("cvs commit") permission. |
264 |
|
Instead, you will need to set our CVS environment as follow:</para> |
265 |
|
<screen> |
266 |
|
$ export CVS_RSH=ssh |
267 |
|
$ export CVSROOT=':ext:MY_USER_NAME@mitgcm.org:/u/gcmpack' |
268 |
|
</screen> |
269 |
|
<para> After downloading a directory, e.g.: <filename>myCopy</filename>, |
270 |
|
from the CVS repository (e.g., |
271 |
|
<filename>MITgcm_contrib/thisPart</filename>) using the command:</para> |
272 |
|
<screen> |
273 |
|
$ cvs co -P -d myCopy MITgcm_contrib/thisPart |
274 |
|
</screen> |
275 |
|
<para> the type of CVS environment which has been used |
276 |
|
is stored in the file <filename>myCopy/CVS/Root</filename> |
277 |
|
and makes it difficult to re-use, for cvs-commit purpose, |
278 |
|
a cvs local copy (<filename>myCopy</filename>) which was obtained |
279 |
|
using the CVS anonymous mode.</para> |
280 |
|
</listitem> |
281 |
|
|
282 |
|
<listitem> |
283 |
|
<para> At this stage, you should be able to send your modified source |
284 |
|
file (e.g., <filename>src_file</filename>) from your local copy directory |
285 |
|
(<filename>myCopy</filename>) to the CVS repository |
286 |
|
(<filename>MITgcm_contrib/thisPart</filename>) using the command |
287 |
|
"cvs commit":</para> |
288 |
|
<screen> |
289 |
|
$ cd myCopy |
290 |
|
$ cvs -n update (optional; check if new changes have been made) |
291 |
|
$ cvs diff src_file (optional; list your changes) |
292 |
|
$ cvs commit src_file |
293 |
|
</screen> |
294 |
|
<para> It is essential that you provide a short description of the |
295 |
|
changes you made to <filename>src_file</filename> as you check-in |
296 |
|
this file (the "cvs commit" command automatically opens your standard |
297 |
|
editor for this purpose).</para> |
298 |
|
</listitem> |
299 |
|
|
300 |
|
</orderedlist> |
301 |
|
|
302 |
|
</sect2> |
303 |
|
|
304 |
|
<sect2> |
305 |
|
<title>Main code development</title> |
306 |
|
<para>(formerly named "Tagging" ; this section needs an update)</para> |
307 |
|
|
308 |
|
<para>The intent of tagging is to create "known-good" checkpoints that |
309 |
|
developers can use as references. Traditionally, MITgcm tagging has |
310 |
|
maintained the following conventions:</para> |
311 |
|
|
312 |
|
<orderedlist> |
313 |
|
<listitem> |
314 |
|
<para>Developer checks out code into a local CVS-managed directory, |
315 |
|
makes various changes/additions, tests these edits, and eventually |
316 |
|
reaches a point where (s)he is satisfied that the changes form a new |
317 |
|
"useful" point in the evolution of the code.</para> |
318 |
</listitem> |
</listitem> |
319 |
|
|
320 |
<listitem> |
<listitem> |
321 |
<para>The developer then runs the <ulink |
<para>The developer then runs the <ulink |
322 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/verification/testscript">testscript</ulink> |
url="http://mitgcm.org/viewvc/MITgcm/MITgcm/verification/testreport"> |
323 |
shell script to see if any problems are introduced. While |
testreport</ulink> shell script to see if any problems are introduced. |
324 |
not intended to be exhaustive, the test cases within the |
While not intended to be exhaustive, the test cases within the |
325 |
verification directory do provide some indication whether |
verification directory do provide some indication whether gross errors |
326 |
gross errors have been introduced. |
have been introduced. |
327 |
</para> |
</para> |
328 |
</listitem> |
</listitem> |
329 |
|
|
333 |
then:</para> |
then:</para> |
334 |
<orderedlist> |
<orderedlist> |
335 |
<listitem> |
<listitem> |
336 |
<para>adds a "checkpointXY_pre" comment (where X is a |
<para>adds a "checkpointXY_pre" comment (where X is a checkpoint |
337 |
checkpoint number and Y is a letter) to the <ulink |
number and Y is a letter) to the <ulink |
338 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index">tag-index</ulink> |
url="http://mitgcm.org/viewvc/MITgcm/MITgcm/doc/tag-index"> |
339 |
file and checks it into the CVS repository</para> |
tag-index</ulink> file and checks it into the CVS |
340 |
|
repository</para> |
341 |
</listitem> |
</listitem> |
342 |
<listitem> |
<listitem> |
343 |
<para>submits the set of changes to the CVS repository |
<para>submits the set of changes to the CVS repository and adds |
344 |
and adds comments to <filename>tag-index</filename> |
comments to <filename>tag-index</filename> describing what the |
345 |
describing what the changes are along with a matching |
changes are along with a matching "checkpointXY_post" entry</para> |
|
"checkpointXY_post" entry</para> |
|
346 |
</listitem> |
</listitem> |
347 |
</orderedlist> |
</orderedlist> |
348 |
</listitem> |
</listitem> |
349 |
</orderedlist> |
</orderedlist> |
350 |
|
|
351 |
<para>The result of this tagging procedure is a sequence of |
<para>The result of this tagging procedure is a sequence of development |
352 |
development checkpoints with comments which resembles:</para> |
checkpoints with comments which resembles:</para> |
353 |
|
|
354 |
<programlisting> |
<programlisting> |
355 |
checkpoint50e_post |
checkpoint50e_post |
371 |
checkpoint50d_pre |
checkpoint50d_pre |
372 |
</programlisting> |
</programlisting> |
373 |
|
|
374 |
<para>This information can be used to refer to various stages of |
<para>This information can be used to refer to various stages of the code |
375 |
the code development. For example, bugs can be traced to |
development. For example, bugs can be traced to individual sets of CVS |
376 |
individual sets of CVS checkins based upon their first |
checkins based upon their first appearance when comparing the results from |
377 |
appearance when comparing the results from different |
different checkpoints.</para> |
|
checkpoints.</para> |
|
378 |
|
|
379 |
</sect2> |
</sect2> |
380 |
</sect1> |
</sect1> |
381 |
|
|
382 |
|
|
|
<sect1 id="documentation"> |
|
|
<title>Editing the Documentation</title> |
|
|
|
|
|
<sect2 id="documentation_getting"> |
|
|
<title>Getting the Docs and Code</title> |
|
|
|
|
|
<para>The first step towards editing the documentation is to |
|
|
checkout a copy of code, docs, and build scripts from the CVS |
|
|
server using:</para> |
|
|
|
|
|
<screen> |
|
|
$ export CVS_RSH=ssh |
|
|
$ export CVSROOT=':ext:auden.lcs.mit.edu:/u/u3/gcmpack' |
|
|
$ mkdir scratch |
|
|
$ cvs co MITgcm manual mitgcm.org |
|
|
</screen> |
|
|
|
|
|
<para>These commands extract the necessary information from the |
|
|
CVS server and create a temporary (called |
|
|
<filename>scratch</filename>) directory for the storage of the |
|
|
HTML and other files that will be created. Please note that you |
|
|
must either create <filename>scratch</filename> as shown or edit |
|
|
the various <filename>Makefile</filename>s and scripts used to |
|
|
create the documentation.</para> |
|
|
</sect2> |
|
|
|
|
|
<sect2> |
|
|
<title>Editing the Documentation</title> |
|
|
|
|
|
<para>The documentation is contained in the |
|
|
<filename>manual</filename> directory in a raw LaTeX format. |
|
|
The main document is <filename>manual.tex</filename> and it uses |
|
|
<command>\input{}</command>s to include the chapters and |
|
|
subsections.</para> |
|
|
|
|
|
<para>Since the same LaTeX source is used to produce PostScript, |
|
|
PDF, and HTML output, care should be taken to follow certain |
|
|
conventions. Two of the most important are the usage of the |
|
|
<command>\filelink{}{}</command> and |
|
|
<command>\varlink{}{}</command> commands. Both of these |
|
|
commands have been defined to simplify the connection between |
|
|
the automatically generated ("code browser") HTML and the HTML |
|
|
version of the manual produced by LaTeX2HTML. They each take |
|
|
two arguments (corresponding to the contents of the two sets of |
|
|
curly braces) which are the text that the author wishes to be |
|
|
"wrapped" within the link, and a specially formatted link thats |
|
|
relative to the <filename>MITgcm</filename> directory within the |
|
|
CVS tree.</para> |
|
|
|
|
|
<para>The result is a command that resembles either</para> |
|
|
|
|
|
<orderedlist> |
|
|
<listitem> |
|
|
<para>a reference to a variable or subroutine name such as |
|
|
<command>\varlink{tRef}{tRef}</command>, or </para> |
|
|
</listitem> |
|
|
|
|
|
<listitem> |
|
|
<para>a reference to a file such as |
|
|
<command>\varlink{tRef}{path-to-the-file_name.F}</command> |
|
|
where the absolute path to the file is of the form |
|
|
<filename>/foo/MITgcm/path/to/the/file_name.F</filename></para> |
|
|
<para>(please note how the leading "/foo/MITgcm" |
|
|
component of the path is dropped leaving the path |
|
|
<emphasis>relative</emphasis> to the head of the code |
|
|
directory and each directory separator "/" is turned |
|
|
into a "-")</para> |
|
|
</listitem> |
|
|
</orderedlist> |
|
|
|
|
|
|
|
|
|
|
|
</sect2> |
|
|
|
|
|
<sect2> |
|
|
<title>Building the Documentation</title> |
|
|
|
|
|
<para>Given the directory structure of <xref |
|
|
linkend="documentation_getting">, the entire documentation for the web |
|
|
site can be built using:</para> |
|
|
|
|
|
<screen> |
|
|
$ cd mitgcm.org/devel/buildweb |
|
|
$ make All |
|
|
</screen> |
|
|
|
|
|
<para>Which builds the PDF from the LaTeX source, creates the |
|
|
HTML output from the LaTeX source, parses the FORTRAN code base |
|
|
to produce a hyperlinked HTML version of the source, and then |
|
|
determines the cross-linking between the various HTML |
|
|
components.</para> |
|
|
|
|
|
<para>If there are no errors, the result of the build process |
|
|
(which can take 30+ minutes on a P4/2.5Ghz) will be contained |
|
|
within a single directory called |
|
|
<filename>scratch/dev_docs</filename>. This is a freshly built |
|
|
version of the entire on-line users manual. If you have the |
|
|
correct permissions, it can be directly copied to the web server |
|
|
area:</para> |
|
|
|
|
|
<screen> |
|
|
$ mv scratch/dev_docs /u/u0/httpd/html |
|
|
</screen> |
|
|
|
|
|
<para>and the update is complete.</para> |
|
|
|
|
|
</sect2> |
|
|
|
|
|
</sect1> |
|
|
|
|
383 |
<sect1 id="coding"> |
<sect1 id="coding"> |
384 |
<title>Coding for MITgcm</title> |
<title>Coding for MITgcm</title> |
385 |
|
|
393 |
For MITgcm, the process is similar. Typical commands are:</para> |
For MITgcm, the process is similar. Typical commands are:</para> |
394 |
|
|
395 |
<screen> |
<screen> |
396 |
$ genmake -mods=../code |
$ genmake -mods=../code |
397 |
$ make depend |
$ make depend |
398 |
$ make |
$ make |
399 |
</screen> |
</screen> |
400 |
|
|
401 |
<para>The following sections describe the individual steps in the build |
<para>The following sections describe the individual steps in the build |
429 |
simple as:</para> |
simple as:</para> |
430 |
|
|
431 |
<screen> |
<screen> |
432 |
$ genmake2 -mods=../code |
$ genmake2 -mods=../code |
433 |
</screen> |
</screen> |
434 |
|
|
435 |
<para>However, some systems (particularly commercial Unixes that lack a |
<para>However, some systems (particularly commercial Unixes that lack a |
438 |
the following: </para> |
the following: </para> |
439 |
|
|
440 |
<screen> |
<screen> |
441 |
$ /usr/bin/sh genmake2 -make=gmake -mods=../code |
$ /usr/bin/sh genmake2 -make=gmake -mods=../code |
442 |
$ /opt/gnu/bin/bash genmake2 -ieee -make=/usr/local/bin/gmake -mods=../code |
$ /opt/gnu/bin/bash genmake2 -ieee -make=/usr/local/bin/gmake -mods=../code |
443 |
</screen> |
</screen> |
444 |
|
|
445 |
<para>The genmake2 code has been written in a Bourne and BASH (v1) |
<para>The genmake2 code has been written in a Bourne and BASH (v1) |
452 |
|
|
453 |
<orderedlist> |
<orderedlist> |
454 |
<listitem> |
<listitem> |
455 |
<para>a <filename>gm_local</filename> file in the current |
<para>a <filename>gemake_local</filename> file in the current |
456 |
directory</para> |
directory</para> |
457 |
</listitem> |
</listitem> |
458 |
<listitem> |
<listitem> |
472 |
from:</para> |
from:</para> |
473 |
|
|
474 |
<screen> |
<screen> |
475 |
$ genmake2 -help |
$ genmake2 -help |
476 |
</screen> |
</screen> |
477 |
|
|
478 |
<para>The most important options for <filename>genmake2</> are:</para> |
<para>The most important options for <filename>genmake2</> are:</para> |
528 |
specified, then it is assumed that the two packages are compatible |
specified, then it is assumed that the two packages are compatible |
529 |
and will function either with or without each other.</para> |
and will function either with or without each other.</para> |
530 |
</listitem> |
</listitem> |
|
|
|
531 |
</varlistentry> |
</varlistentry> |
532 |
|
|
533 |
<varlistentry> |
<varlistentry> |
542 |
</varlistentry> |
</varlistentry> |
543 |
|
|
544 |
<varlistentry> |
<varlistentry> |
545 |
|
<term><filename>-adof=/path/to/file</></term> |
546 |
|
<term><filename>-adoptfile=/path/to/file</></term> |
547 |
|
<listitem> |
548 |
|
<para>This option specifies the "adjoint" or automatic |
549 |
|
differentiation options file to be used. The file is analogous |
550 |
|
to the "optfile" defined above but it specifies information for |
551 |
|
the AD build process. The default file is located in <filename> |
552 |
|
$ROOTDIR/tools/adjoint_options/adjoint_default </> and it |
553 |
|
defines the "TAF" and "TAMC" compilers. An alternate version is |
554 |
|
also available at <filename> |
555 |
|
$ROOTDIR/tools/adjoint_options/adjoint_staf </> that selects the |
556 |
|
newer "STAF" compiler. As with any compilers, it is helpful to |
557 |
|
have their directories listed in your $PATH environment |
558 |
|
variable.</para> |
559 |
|
</listitem> |
560 |
|
</varlistentry> |
561 |
|
|
562 |
|
<varlistentry> |
563 |
<term><filename>-mods=DIR</></term> |
<term><filename>-mods=DIR</></term> |
564 |
<term><filename>-mods='DIR1 [DIR2 ...]'</></term> |
<term><filename>-mods='DIR1 [DIR2 ...]'</></term> |
565 |
<listitem> |
<listitem> |
613 |
</sect3> |
</sect3> |
614 |
|
|
615 |
<sect3 id="makefile_use"> |
<sect3 id="makefile_use"> |
616 |
<title>Using <filename>Makefile</></title> |
<title>Using the <filename>Makefile</></title> |
617 |
|
|
618 |
<para>Once a <filename>Makefile</> has been created, one can |
<para>Once a <filename>Makefile</> has been created using |
619 |
build an executable using:</para> |
<filename>genmake2</>, one can build a "standard" (forward |
620 |
|
simulator) executable using:</para> |
621 |
|
|
622 |
<screen> |
<screen> |
623 |
$ make CLEAN |
$ make CLEAN |
624 |
$ make depend |
$ make depend |
625 |
$ make |
$ make |
626 |
</screen> |
</screen> |
627 |
|
|
628 |
<para>The "make CLEAN" step will remove any stale source files, include |
<para>The "make CLEAN" step will remove any stale source files, include |
646 |
substitutions) custom definitions such as variable types within the |
substitutions) custom definitions such as variable types within the |
647 |
source files. This additional stage is necessary in order to overcome |
source files. This additional stage is necessary in order to overcome |
648 |
some of the inconsistencies in the sizes of objects (bytes) between |
some of the inconsistencies in the sizes of objects (bytes) between |
649 |
different compilers.</para> |
different compilers. The result of the build process is an executable |
650 |
|
with the name <filename>mitgcmuv</>.</para> |
651 |
|
|
652 |
|
<para>In addition to the forward simulator described above, the |
653 |
|
<filename>Makefile</> also has a number of targets that can be used to |
654 |
|
produce various adjoint and tangent-linear builds for optimization and |
655 |
|
other parameter-sensitivity problems. The additional targets within |
656 |
|
the <filename>Makefile</> are:</para> |
657 |
|
|
658 |
|
<variablelist> |
659 |
|
|
660 |
<para>Please report compilation failures or other problems to |
<varlistentry> |
661 |
<email>MITgcm-support@mitgcm.org</email>.</para> |
<term><filename>make adall</></term> |
662 |
|
<listitem> |
663 |
|
<para>This target produces an <filename>mitgcmuv_ad</> executable |
664 |
|
using the <filename>taf</> or <filename>staf</> adjoint |
665 |
|
compiler. See the <filename>genmake2</> "-adof" option for |
666 |
|
compiler selection.</para> |
667 |
|
</listitem> |
668 |
|
</varlistentry> |
669 |
|
|
670 |
|
<varlistentry> |
671 |
|
<term><filename>make ftlall</></term> |
672 |
|
<listitem> |
673 |
|
<para>Similar to <filename>make adall</> above, this |
674 |
|
produces...</para> |
675 |
|
</listitem> |
676 |
|
</varlistentry> |
677 |
|
|
678 |
|
</variablelist> |
679 |
|
|
680 |
|
<para>Please report any compilation failures or other build problems to |
681 |
|
the <email>MITgcm-support@mitgcm.org</email> list.</para> |
682 |
|
|
683 |
</sect3> |
</sect3> |
684 |
|
|
711 |
line as simple as:</para> |
line as simple as:</para> |
712 |
|
|
713 |
<screen> |
<screen> |
714 |
$ cd verification |
$ cd verification |
715 |
$ ./testreport -ieee |
$ ./testreport -ieee |
716 |
</screen> |
</screen> |
717 |
|
|
718 |
<para>However, some systems (those lacking or wiht a broken "/bin/sh") |
<para>However, some systems (those lacking or wiht a broken "/bin/sh") |
719 |
may require an explicit shell invocation such as:</para> |
may require an explicit shell invocation such as:</para> |
720 |
|
|
721 |
<screen> |
<screen> |
722 |
$ sh ./testreport -ieee -t 'exp0 exp4' |
$ sh ./testreport -ieee -t 'exp0 exp4' |
723 |
$ /some/path/to/bash ./testreport -ieee -t 'ideal_2D_oce lab_sea natl_box' |
$ /some/path/to/bash ./testreport -ieee -t 'ideal_2D_oce lab_sea natl_box' |
724 |
</screen> |
</screen> |
725 |
|
|
726 |
<para>The <filename>testreport</> script accepts a number of |
<para>The <filename>testreport</> script accepts a number of |
788 |
special command option (see "-command" below) to invoke the MPI |
special command option (see "-command" below) to invoke the MPI |
789 |
executable. Examples of PBS scripts using MPI with testreport can be |
executable. Examples of PBS scripts using MPI with testreport can be |
790 |
found in the <ulink |
found in the <ulink |
791 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/"> |
url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/"> |
792 |
MITgcm-contrib area</ulink></para> |
MITgcm-contrib area</ulink></para> |
793 |
</listitem> |
</listitem> |
794 |
</varlistentry> |
</varlistentry> |
800 |
output.txt" is not sufficient. This option allows a more general |
output.txt" is not sufficient. This option allows a more general |
801 |
command (or shell script) to be invoked. Examples of PBS scripts |
command (or shell script) to be invoked. Examples of PBS scripts |
802 |
using MPI with testreport can be found in the <ulink |
using MPI with testreport can be found in the <ulink |
803 |
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/"> |
url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/"> |
804 |
MITgcm-contrib area</ulink></para> |
MITgcm-contrib area</ulink></para> |
805 |
</listitem> |
</listitem> |
806 |
</varlistentry> |
</varlistentry> |
827 |
the generic fluid dynamical engine.</para> |
the generic fluid dynamical engine.</para> |
828 |
|
|
829 |
<para>The MITgcmUV packaging structure is described below using generic |
<para>The MITgcmUV packaging structure is described below using generic |
830 |
package names ${pkg}. A concrete examples of a package is the code for |
package names ${pkg}. A concrete examples of a package is the code for |
831 |
implementing GM/Redi mixing. This code uses the package name</para> |
implementing GM/Redi mixing. This code uses the package name</para> |
832 |
|
|
833 |
</sect2> |
</sect2> |
887 |
Package runtime config. options are imported |
Package runtime config. options are imported |
888 |
into a common block held in a header file |
into a common block held in a header file |
889 |
called "${PKG}.h". |
called "${PKG}.h". |
890 |
|
Note: In some packages, the header file "${PKG}.h" is splitted |
891 |
|
into "${PKG}_PARAMS.h" that contains the package parameters and |
892 |
|
${PKG}_VARS.h" for the field arrays. |
893 |
|
|
894 |
o The core driver part of the model can check |
o The core driver part of the model can check |
895 |
for runtime enabling or disabling of individual packages |
for runtime enabling or disabling of individual packages |
912 |
1. Within the core driver code flags of the form |
1. Within the core driver code flags of the form |
913 |
ALLOW_${PKG} are used to include or exclude |
ALLOW_${PKG} are used to include or exclude |
914 |
whole packages. The ALLOW_${PKG} flags are included |
whole packages. The ALLOW_${PKG} flags are included |
915 |
from a PKG_CPP_OPTIONS block which is currently |
from a PACKAGES_CONFIG.h file that is automatically |
916 |
|
generated by genmake2 (see genmake2 section). |
917 |
held in-line in the CPP_OPTIONS.h header file. |
held in-line in the CPP_OPTIONS.h header file. |
918 |
e.g. |
e.g. |
919 |
|
|
920 |
Core model code ..... |
Core model code ..... |
921 |
|
|
922 |
|
#include "PACKAGES_CONFIG.h" |
923 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
924 |
: |
: |
925 |
: |
: |
931 |
|
|
932 |
2. Within an individual package a header file, |
2. Within an individual package a header file, |
933 |
"${PKG}_OPTIONS.h", is used to set CPP flags |
"${PKG}_OPTIONS.h", is used to set CPP flags |
934 |
specific to that package. It is not recommended |
specific to that package. It also includes |
935 |
to include this file in "CPP_OPTIONS.h". |
"PACKAGES_CONFIG.h" and "CPP_OPTIONS.h". |
936 |
|
|
937 |
|
|
938 |
Package Boot Sequence |
Package Boot Sequence |
954 |
& CALL ${PKG}_READPARMS( retCode ) |
& CALL ${PKG}_READPARMS( retCode ) |
955 |
#endif |
#endif |
956 |
|
|
957 |
2. S/R PACKAGES_CHECK() |
3. S/R PACKAGES_INIT_FIXED() |
958 |
|
: |
959 |
|
#ifdef ALLOW_${PKG} |
960 |
|
if ( use${Pkg} ) |
961 |
|
& CALL ${PKG}_INIT_FIXED( retCode ) |
962 |
|
#endif |
963 |
|
|
964 |
|
4. S/R PACKAGES_CHECK() |
965 |
: |
: |
966 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
967 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
971 |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
972 |
#endif |
#endif |
973 |
|
|
974 |
3. S/R PACKAGES_INIT() |
5. S/R PACKAGES_INIT_VARIABLES() |
975 |
: |
: |
976 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
977 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
978 |
& CALL ${PKG}_INIT( retCode ) |
& CALL ${PKG}_INIT_VARIA( ) |
979 |
#endif |
#endif |
980 |
|
|
981 |
|
Package Output |
982 |
|
============== |
983 |
|
6. S/R DO_THE_MODEL_IO |
984 |
|
|
985 |
|
#ifdef ALLOW_${PKG} |
986 |
|
if ( use${Pkg} ) |
987 |
|
& CALL ${PKG}_OUTPUT( ) |
988 |
|
#endif |
989 |
|
|
990 |
|
7. S/R PACKAGES_WRITE_PICKUP() |
991 |
|
|
992 |
|
#ifdef ALLOW_${PKG} |
993 |
|
if ( use${Pkg} ) |
994 |
|
& CALL ${PKG}_WRITE_PICKUP( ) |
995 |
|
#endif |
996 |
|
|
997 |
Description |
Description |
998 |
=========== |
=========== |
1000 |
- ${PKG}_READPARMS() |
- ${PKG}_READPARMS() |
1001 |
is responsible for reading |
is responsible for reading |
1002 |
in the package parameters file data.${pkg}, and storing |
in the package parameters file data.${pkg}, and storing |
1003 |
the package parameters in "${PKG}.h". |
the package parameters in "${PKG}.h" (or in "${PKG}_PARAMS.h"). |
1004 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_READPARMS |
1005 |
|
|
1006 |
|
- ${PKG}_INIT_FIXED() |
1007 |
|
is responsible for completing the internal setup of a package. |
1008 |
|
-> called from INITIALISE_FIXED in PACKAGES_INIT_FIXED |
1009 |
|
note: 1) some pkg use instead: |
1010 |
|
CALL ${PKG}_INITIALISE ( or the old form CALL ${PKG}_INIT ) |
1011 |
|
2) for simple pkg setup, this part is done inside ${PKG}_READPARMS |
1012 |
|
|
1013 |
- ${PKG}_CHECK() |
- ${PKG}_CHECK() |
1014 |
is responsible for validating |
is responsible for validating |
1017 |
need to check. This is done through header files "${PKG}.h". |
need to check. This is done through header files "${PKG}.h". |
1018 |
It is assumed that parameters owned by other packages |
It is assumed that parameters owned by other packages |
1019 |
will not be reset during ${PKG}_CHECK(). |
will not be reset during ${PKG}_CHECK(). |
1020 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_CHECK |
1021 |
|
|
1022 |
- ${PKG}_INIT() |
- ${PKG}_INIT_VARIA() |
1023 |
is responsible for completing the |
is responsible for fill-in all package variables with an initial value. |
1024 |
internal setup of a package. This routine is called after |
Contains eventually a call to ${PKG}_READ_PICKUP that will read |
1025 |
the core model state has been completely initialised |
from a pickup file the package variables required to restart the model. |
1026 |
but before the core model timestepping starts. |
This routine is called after the core model state has been completely |
1027 |
-> called in INITIALISE_VARIA |
initialised but before the core model timestepping starts. |
1028 |
|
-> called from INITIALISE_VARIA in PACKAGES_INIT_VARIABLES |
1029 |
|
note: the name ${PKG}_INIT_VARIA is not yet standard and some pkg |
1030 |
|
use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old |
1031 |
|
form ${PKG}_INIT |
1032 |
|
|
1033 |
|
- ${PKG}_OUTPUT( ) |
1034 |
|
is responsible for writing time-average fields to output files |
1035 |
|
(but the cumulating step is done within the package main S/R). |
1036 |
|
Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR) |
1037 |
|
and write snap-shot fields that are hold in common blocks. Other |
1038 |
|
temporary fields are directly dump to file where they are available. |
1039 |
|
NOTE: 1) the S/R old name ${PKG}_DIAGS is used in some packages |
1040 |
|
but is beeing replaced by ${PKG}_OUTPUT |
1041 |
|
to avoid confusion with pkg/diagnostics functionality. |
1042 |
|
2) the output part is not yet in a standard form and might still |
1043 |
|
evolve a lot. |
1044 |
|
-> called within DO_THE_MODEL_IO |
1045 |
|
|
1046 |
|
- ${PKG}_WRITE_PICKUP() |
1047 |
|
is responsible for writing a package pickup file when necessary for |
1048 |
|
a restart. (found also the old name: ${PKG}_WRITE_CHECKPOINT ) |
1049 |
|
-> called from FORWARD_STEP and THE_MODEL_MAIN in PACKAGES_WRITE_PICKUP |
1050 |
|
|
1051 |
Summary |
Summary |
1052 |
======= |
======= |
1067 |
----------------------- |
----------------------- |
1068 |
* ${PKG}_OPTIONS.h has further package-specific CPP options |
* ${PKG}_OPTIONS.h has further package-specific CPP options |
1069 |
* ${PKG}.h package-specific common block variables, fields |
* ${PKG}.h package-specific common block variables, fields |
1070 |
|
or ${PKG}_PARAMS.h package-specific common block parameters |
1071 |
|
and ${PKG}_VARS.h package-specific common block fields |
1072 |
|
|
1073 |
- FORTRAN source files |
- FORTRAN source files |
1074 |
----------------------- |
----------------------- |
1075 |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
1076 |
* ${pkg}_check.F checks package dependencies and consistencies |
* ${pkg}_init_fixed.F complete the package setup |
1077 |
* ${pkg}_init.F initialises package-related fields |
* ${pkg}_check.F checks package dependencies and consistencies |
1078 |
* ${pkg}_... .F package source code |
* ${pkg}_init_varia.F initialises package-related fields |
1079 |
|
* ${pkg}_... .F package source code |
1080 |
|
* ${pkg}_output.F write output to file. |
1081 |
|
* ${pkg}_write_pickup.F write a package pickup file to restart the model |
1082 |
|
|
1083 |
|
New: Subroutine in one package (pkgA) that only contains code which |
1084 |
|
is connected to a 2nd package (pkgB) (e.g.: gmredi_diagnostics_init.F) |
1085 |
|
will be named: pkgA_pkgB_something.F |
1086 |
|
|
1087 |
- parameter file |
- parameter file |
1088 |
----------------------- |
----------------------- |
1092 |
</sect1> |
</sect1> |
1093 |
|
|
1094 |
|
|
1095 |
|
<sect1 id="documentation"> |
1096 |
|
<title>Editing the Documentation</title> |
1097 |
|
|
1098 |
|
<sect2 id="documentation_getting"> |
1099 |
|
<title>Getting the Docs and Code</title> |
1100 |
|
|
1101 |
|
<para>The first step towards editing the documentation is to checkout a |
1102 |
|
copy of code, docs, and build scripts from the CVS server using:</para> |
1103 |
|
|
1104 |
|
<screen> |
1105 |
|
$ export CVS_RSH=ssh |
1106 |
|
$ export CVSROOT=':ext:NAME@mitgcm.org:/u/gcmpack' |
1107 |
|
$ mkdir scratch |
1108 |
|
$ cvs co -P MITgcm manual mitgcm.org |
1109 |
|
</screen> |
1110 |
|
|
1111 |
|
<para>These commands extract the necessary information from the CVS server |
1112 |
|
and create a temporary (called <filename>scratch</filename>) directory for |
1113 |
|
the storage of the HTML and other files that will be created. Please note |
1114 |
|
that you must either create <filename>scratch</filename> as shown or edit |
1115 |
|
the various <filename>Makefile</filename>s and scripts used to create the |
1116 |
|
documentation.</para> |
1117 |
|
</sect2> |
1118 |
|
|
1119 |
|
<sect2> |
1120 |
|
<title>Editing the Documentation</title> |
1121 |
|
|
1122 |
|
<para>The documentation is contained in the <filename>manual</filename> |
1123 |
|
directory in a raw LaTeX format. The main document is |
1124 |
|
<filename>manual.tex</filename> and it uses <command>\input{}</command>s |
1125 |
|
to include the chapters and subsections.</para> |
1126 |
|
|
1127 |
|
<para>Since the same LaTeX source is used to produce PostScript, PDF, and |
1128 |
|
HTML output, care should be taken to follow certain conventions. Two of |
1129 |
|
the most important are the usage of the <command>\filelink{}{}</command> |
1130 |
|
and <command>\varlink{}{}</command> commands. Both of these commands have |
1131 |
|
been defined to simplify the connection between the automatically |
1132 |
|
generated ("code browser") HTML and the HTML version of the manual |
1133 |
|
produced by LaTeX2HTML. They each take two arguments (corresponding to |
1134 |
|
the contents of the two sets of curly braces) which are the text that the |
1135 |
|
author wishes to be "wrapped" within the link, and a specially formatted |
1136 |
|
link thats relative to the <filename>MITgcm</filename> directory within |
1137 |
|
the CVS tree.</para> |
1138 |
|
|
1139 |
|
<para>The result is a command that resembles either</para> |
1140 |
|
|
1141 |
|
<orderedlist> |
1142 |
|
<listitem> |
1143 |
|
<para>a reference to a variable or subroutine name such as |
1144 |
|
<command>\varlink{tRef}{tRef}</command>, or </para> |
1145 |
|
</listitem> |
1146 |
|
|
1147 |
|
<listitem> |
1148 |
|
<para>a reference to a file such as |
1149 |
|
<command>\varlink{tRef}{path-to-the-file_name.F}</command> |
1150 |
|
where the absolute path to the file is of the form |
1151 |
|
<filename>/foo/MITgcm/path/to/the/file_name.F</filename></para> |
1152 |
|
<para>(please note how the leading "/foo/MITgcm" |
1153 |
|
component of the path is dropped leaving the path |
1154 |
|
<emphasis>relative</emphasis> to the head of the code |
1155 |
|
directory and each directory separator "/" is turned |
1156 |
|
into a "-")</para> |
1157 |
|
</listitem> |
1158 |
|
</orderedlist> |
1159 |
|
|
1160 |
|
|
1161 |
|
|
1162 |
|
</sect2> |
1163 |
|
|
1164 |
|
<sect2> |
1165 |
|
<title>Building the Documentation</title> |
1166 |
|
|
1167 |
|
<para>Given the directory structure of <xref |
1168 |
|
linkend="documentation_getting">, the entire documentation for the web |
1169 |
|
site can be built using:</para> |
1170 |
|
|
1171 |
|
<screen> |
1172 |
|
$ cd mitgcm.org/devel/buildweb |
1173 |
|
$ make All |
1174 |
|
</screen> |
1175 |
|
|
1176 |
|
<para>Which builds the PDF from the LaTeX source, creates the HTML output |
1177 |
|
from the LaTeX source, parses the FORTRAN code base to produce a |
1178 |
|
hyperlinked HTML version of the source, and then determines the |
1179 |
|
cross-linking between the various HTML components.</para> |
1180 |
|
|
1181 |
|
<para>If there are no errors, the result of the build process (which can |
1182 |
|
take 30+ minutes on a P4/2.5Ghz) will be contained within a single |
1183 |
|
directory called <filename>scratch/dev_docs</filename>. This is a freshly |
1184 |
|
built version of the entire on-line users manual. If you have the correct |
1185 |
|
permissions, it can be directly copied to the web server area:</para> |
1186 |
|
|
1187 |
|
<screen> |
1188 |
|
$ mv scratch/dev_docs /u/u0/httpd/html |
1189 |
|
</screen> |
1190 |
|
|
1191 |
|
<para>and the update is complete.</para> |
1192 |
|
|
1193 |
|
</sect2> |
1194 |
|
|
1195 |
|
</sect1> |
1196 |
|
|
1197 |
</article> |
</article> |
1198 |
|
|
1199 |
|
|