2 |
|
|
3 |
<article id="MITgcm-Development-HOWTO"> |
<article id="MITgcm-Development-HOWTO"> |
4 |
|
|
|
<!-- |
|
|
Build commands: |
|
|
db2ps -d ldp.dsl devel_HOWTO.sgml |
|
|
db2pdf -d ldp.dsl devel_HOWTO.sgml |
|
|
db2html -d ./ldp.dsl devel_HOWTO.sgml |
|
|
db2html -u -d ./ldp.dsl devel_HOWTO.sgml |
|
|
--> |
|
|
|
|
5 |
<articleinfo> |
<articleinfo> |
6 |
<title>MITgcm Development HOWTO</title> |
<title>MITgcm Development HOWTO</title> |
7 |
|
|
55 |
<sect2> |
<sect2> |
56 |
<title>User Manual</title> |
<title>User Manual</title> |
57 |
|
|
58 |
<para>Before jumping into |
<para>Before jumping into development, please familiarize yourself with |
59 |
development, please familiarize yourself with the MITgcm user |
the <ulink url="http://mitgcm.org/docs.html"> MITgcm user manual |
60 |
manual which is available <ulink |
</ulink>. This document contains volumes of useful information and is |
61 |
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> |
|
62 |
|
|
63 |
<para>Also, a "snapshot" or<ulink |
<!-- |
64 |
|
<para>Also, a "snapshot" or <ulink |
65 |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
url="http://mitgcm.org/dev_docs/">development version</ulink> of |
66 |
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 |
67 |
web for testing purposes.</para> |
web for testing purposes.</para> |
68 |
|
--> |
69 |
</sect2> |
</sect2> |
70 |
|
|
71 |
<sect2> |
<sect2> |
120 |
doc tags -- connect to real docs? |
doc tags -- connect to real docs? |
121 |
eesupp cnh? |
eesupp cnh? |
122 |
exe ecco user build |
exe ecco user build |
123 |
*- jobs runtime shell scripts for |
,- jobs runtime shell scripts for |
124 |
| various platforms |
| various platforms |
125 |
| lsopt line search |
| lsopt line search |
126 |
m| model main dynamics (core) |
m| model main dynamics (core) |
127 |
e| optimization_drivers ? |
e| optimization_drivers ? |
128 |
r| optim line search interface |
r| optim line search interface |
129 |
g| pkg alternate and optional numerics, etc. |
g| pkg alternate and optional numerics, etc. |
130 |
e*- tools |
e|- tools |
131 |
?| tutorial_examples documented tests |
?| tutorial_examples documented tests |
132 |
| only populated on release1 branch |
| only populated on release1 branch |
133 |
| and not validated during "testscript" |
| and not validated during "testscript" |
134 |
*- utils |
'- utils |
135 |
verification std tests |
verification std tests |
136 |
|
|
137 |
|
|
292 |
server using:</para> |
server using:</para> |
293 |
|
|
294 |
<screen> |
<screen> |
295 |
$ export CVS_RSH=ssh |
$ export CVS_RSH=ssh |
296 |
$ export CVSROOT=':ext:auden.lcs.mit.edu:/u/u3/gcmpack' |
$ export CVSROOT=':ext:auden.lcs.mit.edu:/u/u3/gcmpack' |
297 |
$ mkdir scratch |
$ mkdir scratch |
298 |
$ cvs co MITgcm manual mitgcm.org |
$ cvs co MITgcm manual mitgcm.org |
299 |
</screen> |
</screen> |
300 |
|
|
301 |
<para>These commands extract the necessary information from the |
<para>These commands extract the necessary information from the |
308 |
</sect2> |
</sect2> |
309 |
|
|
310 |
<sect2> |
<sect2> |
311 |
<title>Editing</title> |
<title>Editing the Documentation</title> |
312 |
|
|
313 |
<para>The documentation is contained in the |
<para>The documentation is contained in the |
314 |
<filename>manual</filename> directory in a raw LaTeX format. |
<filename>manual</filename> directory in a raw LaTeX format. |
356 |
</sect2> |
</sect2> |
357 |
|
|
358 |
<sect2> |
<sect2> |
359 |
<title>Building</title> <para>Given the directory structure of |
<title>Building the Documentation</title> |
360 |
<xref linkend="documentation_getting">, the entire documentation |
|
361 |
for the web site can be built using:</para> |
<para>Given the directory structure of <xref |
362 |
|
linkend="documentation_getting">, the entire documentation for the web |
363 |
|
site can be built using:</para> |
364 |
|
|
365 |
<screen> |
<screen> |
366 |
$ cd mitgcm.org/devel/buildweb |
$ cd mitgcm.org/devel/buildweb |
367 |
$ make All |
$ make All |
368 |
</screen> |
</screen> |
369 |
|
|
370 |
<para>Which builds the PDF from the LaTeX source, creates the |
<para>Which builds the PDF from the LaTeX source, creates the |
382 |
area:</para> |
area:</para> |
383 |
|
|
384 |
<screen> |
<screen> |
385 |
$ mv scratch/dev_docs /u/u0/httpd/html |
$ mv scratch/dev_docs /u/u0/httpd/html |
386 |
</screen> |
</screen> |
387 |
|
|
388 |
<para>and the update is complete.</para> |
<para>and the update is complete.</para> |
397 |
<sect2 id="build_tools"> |
<sect2 id="build_tools"> |
398 |
<title>Build Tools</title> |
<title>Build Tools</title> |
399 |
|
|
400 |
<para>Many Open Source projects use the "GNU Autotools" to help |
<para>Many Open Source projects use the "GNU Autotools" to help streamline |
401 |
streamline the build process for various Unix and Unix-like |
the build process for various Unix and Unix-like architectures. For a |
402 |
architectures. For a user, the result is the common "configure" |
user, the result is the common "configure" (that is, |
403 |
(that is, "<filename>./configure && make && make |
"<filename>./configure && make && make install</filename>") commands. |
404 |
install</filename>") commands. For MITgcm, the process is |
For MITgcm, the process is similar. Typical commands are:</para> |
|
similar. Typical commands are:</para> |
|
405 |
|
|
406 |
<screen> |
<screen> |
407 |
$ genmake -mods=../code |
$ genmake -mods=../code |
408 |
$ make depend |
$ make depend |
409 |
$ make |
$ make |
410 |
</screen> |
</screen> |
411 |
|
|
412 |
<para>The following sections describe the individual steps in |
<para>The following sections describe the individual steps in the build |
413 |
the build process.</para> |
process.</para> |
414 |
|
|
415 |
<sect3 id="genmake"> |
<sect3 id="genmake"> |
416 |
<title>The <filename>genmake2</> Utility</title> |
<title>The <filename>genmake2</> Utility</title> |
417 |
|
|
418 |
<para><emphasis>Please note that the older |
<para><emphasis>Please note that the older <filename>genmake</> is |
419 |
<filename>genmake</> is deprecated and will eventually |
deprecated and will eventually be replaced by <filename>genmake2</>. |
420 |
be replaced by <filename>genmake2</>. This HOWTO only |
This HOWTO only describes the newer tool.</emphasis></para> |
421 |
describes the newer tool.</emphasis></para> |
|
422 |
|
<para>The first step in any MITgcm build is to create a Unix-style |
423 |
<para>The first step in any MITgcm build is to create a |
<filename>Makefile</filename> which will be parsed by |
424 |
Unix-style <filename>Makefile</filename> which will be parsed |
<filename>make</filename> to specify how to compile the MITgcm source |
425 |
by <filename>make</filename> to specify how to compile the |
files. For more detailed descriptions of what the make tools are and |
426 |
MITgcm source files. For more detailed descriptions of what |
how they are used, please see:</para> |
|
the make tools are and how they are used, please see:</para> |
|
427 |
|
|
428 |
<itemizedlist> |
<itemizedlist> |
429 |
<listitem> |
<listitem> |
430 |
<para><ulink url="http://www.gnu.org/software/make/make.html">http://www.gnu.org/software/make/make.html</></para> |
<para><ulink url="http://www.gnu.org/software/make/make.html"> |
431 |
|
http://www.gnu.org/software/make/make.html</></para> |
432 |
</listitem> |
</listitem> |
433 |
<listitem> |
<listitem> |
434 |
<para><ulink url="http://www.oreilly.com/catalog/make2/">http://www.oreilly.com/catalog/make2/</></para> |
<para><ulink url="http://www.oreilly.com/catalog/make2/"> |
435 |
|
http://www.oreilly.com/catalog/make2/</></para> |
436 |
</listitem> |
</listitem> |
437 |
</itemizedlist> |
</itemizedlist> |
438 |
|
|
439 |
<para>Due to the poor handling of soft-links and other bugs |
<para>Genmake can often be invoked successfully with a command line as |
440 |
common with the <filename>make</filename> versions provided by |
simple as:</para> |
441 |
commercial Unix vendors, GNU <filename>make</filename> |
|
442 |
(sometimes called <filename>gmake</filename>) should be |
<screen> |
443 |
preferred.</para> |
$ genmake2 -mods=../code |
444 |
|
</screen> |
445 |
<para>As the name implies, <filename>genmake2</filename> |
|
446 |
generates a <filename>Makefile</filename>. It does so by |
<para>However, some systems (particularly commercial Unixes that lack a |
447 |
first parsing the information supplied from the following |
more modern "/bin/sh" implementation or that have shells installed in |
448 |
sources</para> |
odd locations) may require an explicit shell invocation such as one of |
449 |
|
the following: </para> |
450 |
|
|
451 |
|
<screen> |
452 |
|
$ /usr/bin/sh genmake2 -make=gmake -mods=../code |
453 |
|
$ /opt/gnu/bin/bash genmake2 -ieee -make=/usr/local/bin/gmake -mods=../code |
454 |
|
</screen> |
455 |
|
|
456 |
|
<para>The genmake2 code has been written in a Bourne and BASH (v1) |
457 |
|
compatible syntax so it should work with most "sh" and all recent "bash" |
458 |
|
implementations.</para> |
459 |
|
|
460 |
|
<para>As the name implies, <filename>genmake2</filename> generates a |
461 |
|
<filename>Makefile</filename>. It does so by first parsing the |
462 |
|
information supplied from the following sources</para> |
463 |
|
|
464 |
<orderedlist> |
<orderedlist> |
465 |
<listitem> |
<listitem> |
466 |
<para>a <filename>gm_local</filename> file in the current |
<para>a <filename>gemake_local</filename> file in the current |
467 |
directory</para> |
directory</para> |
468 |
</listitem> |
</listitem> |
469 |
<listitem> |
<listitem> |
470 |
<para>directly from command-line options</para> |
<para>directly from command-line options</para> |
471 |
</listitem> |
</listitem> |
472 |
<listitem> |
<listitem> |
473 |
<para>an "options file" as specified by the command-line |
<para>an "options file" as specified by the command-line option |
474 |
option <filename>-optfile='FILENAME'</filename></para> |
<filename>-optfile='FILENAME'</filename></para> |
475 |
</listitem> |
</listitem> |
476 |
</orderedlist> |
</orderedlist> |
477 |
|
|
478 |
<para>then checking certain dependency rules (the package |
<para>then checking certain dependency rules (the package dependencies), |
479 |
dependencies), and then writing a |
and finally writing a <filename>Makefile</filename> based upon the |
480 |
<filename>Makefile</filename> based upon the source code that |
source code that it finds. For convenience within various Unix |
481 |
it finds. For convenience with the various Unix shells, |
shells, <filename>genmake2</> supports both "long"- and "short"-style |
482 |
<filename>genmake2</> supports both "long"- and "shor"-style |
options. A complete list of the available options can be obtained |
483 |
options. A complete list of the available options can be |
from:</para> |
|
obtained from:</para> |
|
484 |
|
|
485 |
<screen> |
<screen> |
486 |
$ genmake2 -help |
$ genmake2 -help |
487 |
</screen> |
</screen> |
488 |
|
|
489 |
<para>The most important options for <filename>genmake2</> |
<para>The most important options for <filename>genmake2</> are:</para> |
|
are:</para> |
|
490 |
|
|
491 |
<variablelist> |
<variablelist> |
492 |
|
|
493 |
<varlistentry> |
<varlistentry> |
494 |
<term><filename>--optfile=/PATH/FILENAME</></term> |
<term><filename>--optfile=/PATH/FILENAME</></term> |
495 |
|
|
496 |
<listitem> |
<listitem> |
497 |
<para>This specifies the "options file" that should be |
<para>This specifies the "options file" that should be used for a |
498 |
used for a particular build. The options file is a |
particular build. The options file is a convenient and |
499 |
convenient and machine-indepenent way of specifying |
machine-indepenent way of specifying parameters such as the |
500 |
parameters such as the FORTRAN compiler |
FORTRAN compiler (<filename>FC=</>), FORTRAN compiler |
501 |
(<filename>FC=</>), FORTRAN compiler optimization flags |
optimization flags (<filename>FFLAGS=</>), and the locations of |
502 |
(<filename>FFLAGS=</>), and the locations of various |
various platform- and/or machine-specific tools |
503 |
platform- and/or machine-specific tools |
(eg. <filename>MAKEDEPEND=</>). As with <filename>genmake2</>, |
504 |
(eg. <filename>MAKEDEPEND=</>). As with |
all options files should be written to be compatible with |
505 |
<filename>genmake2</>, all options files should be |
Bourne--shell ("sh" or "BASH v1") syntax. Examples of various |
506 |
written a BASH v1-compatible syntax. Examples of |
options files can be found in |
507 |
various options files can be found in |
<filename>$ROOTDIR/tools/build_options</>.</para> |
508 |
<filename>$ROOTDIR/tools/build_options</>. Everyone is |
|
509 |
encouraged to submit their options files to the MITgcm |
<para>If no "optfile" is specified (either through the command lin |
510 |
project for inclusion (please send to |
or the environment variable), genmake2 will try to make a |
511 |
<email>MITgcm-support@mitgcm.org</email>). We are |
reasonable guess from the list provided in |
512 |
particularly grateful for options files tested on new or |
<filename>$ROOTDIR/tools/build_options</>. The method used for |
513 |
unique platforms!</para> |
making this guess is to first determine the combination of |
514 |
|
operating system and hardware (eg. "linux_ia32") and then find a |
515 |
|
working Fortran compiler within the user's path. When these |
516 |
|
three items have been identified, genmake2 will try to find an |
517 |
|
optfile that has a matching name. </para> |
518 |
|
|
519 |
|
<para>Everyone is encouraged to submit their options files to the |
520 |
|
MITgcm project for inclusion (please send to |
521 |
|
<email>MITgcm-support@mitgcm.org</email>). We are particularly |
522 |
|
grateful for options files tested on new or unique |
523 |
|
platforms!</para> |
524 |
</listitem> |
</listitem> |
525 |
|
|
526 |
</varlistentry> |
</varlistentry> |
527 |
|
|
528 |
<varlistentry> |
<varlistentry> |
529 |
<term><filename>-pdepend=/PATH/FILENAME</></term> |
<term><filename>-pdepend=/PATH/FILENAME</></term> |
530 |
|
|
531 |
<listitem> |
<listitem> |
532 |
<para>This specifies the dependency file used for |
<para>This specifies the dependency file used for packages. If |
533 |
packages. If not specified, the default dependency file |
not specified, the default dependency file is |
534 |
is <filename>$ROOTDIR/pkg/pkg_depend</>. The syntax for |
<filename>$ROOTDIR/pkg/pkg_depend</>. The syntax for this file is |
535 |
this file is parsed on a line-by-line basis where each |
parsed on a line-by-line basis where each line containes either a |
536 |
line containes either a comment ("#") or a simple |
comment ("#") or a simple "PKGNAME1 (+|-)PKGNAME2" pairwise rule |
537 |
"PKGNAME1 (+|-)PKGNAME2" pairwise rule where the "+" or |
where the "+" or "-" symbol specifies a "must be used with" or a |
538 |
"-" symbol specifies a "must be used with" or a "must |
"must not be used with" relationship, respectively. If no rule is |
539 |
not be used with" relationship, respectively. If no |
specified, then it is assumed that the two packages are compatible |
540 |
rule is specified, then it is assumed that the two |
and will function either with or without each other.</para> |
|
packages are compatible and will function either with or |
|
|
without each other.</para> |
|
541 |
</listitem> |
</listitem> |
542 |
</varlistentry> |
</varlistentry> |
543 |
|
|
553 |
</varlistentry> |
</varlistentry> |
554 |
|
|
555 |
<varlistentry> |
<varlistentry> |
556 |
<term><filename></>-mods=DIR</term> |
<term><filename>-adof=/path/to/file</></term> |
557 |
<term><filename></>-mods='DIR1 [DIR2 ...]'</term> |
<term><filename>-adoptfile=/path/to/file</></term> |
558 |
<listitem> |
<listitem> |
559 |
<para>This option specifies a list of directories |
<para>This option specifies the "adjoint" or automatic |
560 |
containing "modifications". These are files that may |
differentiation options file to be used. The file is analogous |
561 |
(or may not) exist in the main MITgcm source tree but |
to the "optfile" defined above but it specifies information for |
562 |
will be overridden by any identically-named sources |
the AD build process. The default file is located in <filename> |
563 |
within the "MODS" directories.</para> |
$ROOTDIR/tools/adjoint_options/adjoint_default </> and it |
564 |
|
defines the "TAF" and "TAMC" compilers. An alternate version is |
565 |
|
also available at <filename> |
566 |
|
$ROOTDIR/tools/adjoint_options/adjoint_staf </> that selects the |
567 |
|
newer "STAF" compiler. As with any compilers, it is helpful to |
568 |
|
have their directories listed in your $PATH environment |
569 |
|
variable.</para> |
570 |
|
</listitem> |
571 |
|
</varlistentry> |
572 |
|
|
573 |
|
<varlistentry> |
574 |
|
<term><filename>-mods=DIR</></term> |
575 |
|
<term><filename>-mods='DIR1 [DIR2 ...]'</></term> |
576 |
|
<listitem> |
577 |
|
<para>This option specifies a list of directories containing |
578 |
|
"modifications". These directories contain files with names |
579 |
|
that may (or may not) exist in the main MITgcm source tree but |
580 |
|
will be overridden by any identically-named sources within the |
581 |
|
"MODS" directories. The order of precedence for this |
582 |
|
"name-hiding" is as follows:</para> |
583 |
|
|
584 |
|
<itemizedlist> |
585 |
|
<listitem><para>"MODS" directories (in the order given) |
586 |
|
</para></listitem> |
587 |
|
<listitem><para>Packages either explicitly specified or |
588 |
|
provided by default (in the order given)</para></listitem> |
589 |
|
<listitem><para>Packages included due to package dependencies |
590 |
|
(in the order that that package dependencies are |
591 |
|
parsed)</para></listitem> |
592 |
|
<listitem><para>The "standard dirs" (which may have been |
593 |
|
specified by the "-standarddirs" option)</para></listitem> |
594 |
|
</itemizedlist> |
595 |
|
|
596 |
|
</listitem> |
597 |
|
</varlistentry> |
598 |
|
|
599 |
|
<varlistentry> |
600 |
|
<term><filename>-make=/path/to/gmake</></term> |
601 |
|
<listitem> |
602 |
|
<para>Due to the poor handling of soft-links and other bugs common |
603 |
|
with the <filename>make</> versions provided by commercial Unix |
604 |
|
vendors, GNU <filename>make</filename> (sometimes called |
605 |
|
<filename>gmake</filename>) should be preferred. This option |
606 |
|
provides a means for specifying the make program to be |
607 |
|
used.</para> |
608 |
</listitem> |
</listitem> |
609 |
</varlistentry> |
</varlistentry> |
610 |
|
|
611 |
</variablelist> |
</variablelist> |
612 |
|
|
613 |
<para>A successful run of <filename>genmake2</> will produce |
<para>A successful run of <filename>genmake2</> will produce a |
614 |
both a <filename>Makefile</> and a locally modified copy of |
<filename>Makefile</>, a <filename>PACKAGES_CONFIG.h</> file, and |
615 |
the specified <filename>CPP_OPTIONS.h</> file. The local copy |
various convenience files used for the automatic differentiation |
616 |
of <filename>CPP_OPTIONS.h</> will contain a list of |
process.</para> |
617 |
<filename>genmake2</>-created #DEFINE and #UNDEF statements |
|
618 |
that reflect the list of packages that will be compiled into |
<para>In general, it is best to use <filename>genmake2</> on a "clean" |
619 |
the code (either directly through enable/disable/defaults |
directory that is free of all source (*.[F,f],*.[F,f]90) and header |
620 |
options or indirectly through dependencies).</para> |
(*.h,*.inc) files. Generally, this can be accomplished in an |
621 |
|
"un-clean" directory by running "make CLEAN" followed by "make |
622 |
<para>In general, it is best to use <filename>genmake2</> on a |
makefile".</para> |
|
"clean" directory that is free of all source |
|
|
(*.[F,f],*.[F,f]90) and header (*.h,*.inc) files. Generally, |
|
|
this can be accomplished in an "un-clean" directory by running |
|
|
"make CLEAN" followed by "make makefile".</para> |
|
623 |
|
|
624 |
</sect3> |
</sect3> |
625 |
|
|
626 |
<sect3 id="makefile_use"> |
<sect3 id="makefile_use"> |
627 |
<title>Using <filename>Makefile</></title> |
<title>Using the <filename>Makefile</></title> |
628 |
|
|
629 |
<para>Once a <filename>Makefile</> has been created, one can |
<para>Once a <filename>Makefile</> has been created using |
630 |
build the executable using:</para> |
<filename>genmake2</>, one can build a "standard" (forward |
631 |
|
simulator) executable using:</para> |
632 |
|
|
633 |
<screen> |
<screen> |
634 |
$ make CLEAN |
$ make CLEAN |
635 |
$ make depend |
$ make depend |
636 |
$ make |
$ make |
637 |
</screen> |
</screen> |
638 |
|
|
639 |
<para>The "make CLEAN" step will remove any local source |
<para>The "make CLEAN" step will remove any stale source files, include |
640 |
files, include files, and links. It is strongly recommended |
files, and links. It is strongly recommended for "un-clean" |
641 |
for "un-clean" directories which may contain the (partial?) |
directories which may contain the (perhaps partial) results of |
642 |
results of previous builds. Such "debris" can interfere with |
previous builds. Such "debris" can interfere with the next stage of |
643 |
the next stage of the build.</para> |
the build.</para> |
644 |
|
|
645 |
<para>The "make depend" step will create a large number of |
<para>The "make depend" step will create a large number of symbolic |
646 |
symbolic links from the local directory to the source file |
links from the local directory to the source file locations. It also |
647 |
locations. It also parses these files and creates an |
parses these files and creates an extensive list of dependencies |
648 |
extensive list of dependencies within the |
within the <filename>Makefile</> itself. The links that exist at this |
649 |
<filename>Makefile</> itself. The links that exist at this |
stage are mostly "large F" files (*.F and *.F90) that need to be |
650 |
stage are mostly "large F" files (*.F and *.F90) that need to |
processed by a C preprocessor ("CPP"). Since "make depend" edits the |
651 |
be processed by a C preprocessor ("CPP"). |
<filename>Makefile</>, it is important not to skip this step!</para> |
652 |
</para> |
|
653 |
|
<para>The final "make" invokes the C preprocessor to produce the "little |
654 |
<para>The final "make" invokes the C preprocessor to produce |
f" files (*.f and *.f90) and then compiles them to object code using |
655 |
the "little f" files (*.f and *.f90) and then compiles them to |
the specified FORTRAN compiler and options. An intermediate script is |
656 |
object code using the specified FORTRAN compiler and options. |
often used during this stage to further process (usually, make simple |
657 |
An intermediate script is often used during this stage to |
substitutions) custom definitions such as variable types within the |
658 |
further process (usually, make simple substitutions) custom |
source files. This additional stage is necessary in order to overcome |
659 |
definitions such as variable types within the source files. |
some of the inconsistencies in the sizes of objects (bytes) between |
660 |
This additional stage is necessary in order to overcome some |
different compilers. The result of the build process is an executable |
661 |
of the inconsistencies in the sizes of objects (bytes) between |
with the name <filename>mitgcmuv</>.</para> |
662 |
different compilers.</para> |
|
663 |
|
<para>In addition to the forward simulator described above, the |
664 |
|
<filename>Makefile</> also has a number of targets that can be used to |
665 |
|
produce various adjoint and tangent-linear builds for optimization and |
666 |
|
other parameter-sensitivity problems. The additional targets within |
667 |
|
the <filename>Makefile</> are:</para> |
668 |
|
|
669 |
|
<variablelist> |
670 |
|
|
671 |
|
<varlistentry> |
672 |
|
<term><filename>make adall</></term> |
673 |
|
<listitem> |
674 |
|
<para>This target produces an <filename>mitgcmuv_ad</> executable |
675 |
|
using the <filename>taf</> or <filename>staf</> adjoint |
676 |
|
compiler. See the <filename>genmake2</> "-adof" option for |
677 |
|
compiler selection.</para> |
678 |
|
</listitem> |
679 |
|
</varlistentry> |
680 |
|
|
681 |
|
<varlistentry> |
682 |
|
<term><filename>make ftlall</></term> |
683 |
|
<listitem> |
684 |
|
<para>Similar to <filename>make adall</> above, this |
685 |
|
produces...</para> |
686 |
|
</listitem> |
687 |
|
</varlistentry> |
688 |
|
|
689 |
|
</variablelist> |
690 |
|
|
691 |
<para>Please report compilation failures or other problems to |
<para>Please report any compilation failures or other build problems to |
692 |
<email>MITgcm-support@mitgcm.org</email>.</para> |
the <email>MITgcm-support@mitgcm.org</email> list.</para> |
693 |
|
|
694 |
</sect3> |
</sect3> |
695 |
|
|
698 |
<sect2 id="verification"> |
<sect2 id="verification"> |
699 |
<title>The Verification Suite</title> |
<title>The Verification Suite</title> |
700 |
|
|
701 |
<para>The MITgcm CVS tree (within the |
<para>The MITgcm CVS tree (within the <filename>$ROOTDIR/verification/</> |
702 |
<filename>$ROOTDIR/verification/</> directory) includes more |
directory) includes more than a dozen examples intended for regression |
703 |
than a dozen examples intended for regression testing. Each one |
testing. Each one of these example directories contains "known-good" |
704 |
of these example directories contains "known-good" output files |
output files along with all the input (including both code and data |
705 |
along with all the input (including both code and data files) |
files) required for their re-calculation. These example directories are |
706 |
required for their re-calculation. These example directories |
further broken down into sets of subdirectories |
707 |
are further broken down into sets of subdirectories |
(eg. <filename>/input</>, <filename>/code</>) intended to expedite the |
708 |
(eg. <filename>/input</>, <filename>/code</>) intended to |
testing process.</para> |
|
expedite the testing process.</para> |
|
709 |
|
|
710 |
<sect3 id="testreport"> |
<sect3 id="testreport"> |
711 |
<title>The <filename>testreport</> Utility</title> |
<title>The <filename>testreport</> Utility</title> |
712 |
|
|
713 |
<para>Also included in <filename>$ROOTDIR/verification/</> are |
<para>Also included in <filename>$ROOTDIR/verification/</> are shell |
714 |
shell scripts for automated testing. The newest script (which |
scripts for automated testing. The newest script (which was written |
715 |
was written to work with <filename>genmake2</>) is called |
to work with <filename>genmake2</>) is called <filename>testreport</>. |
716 |
<filename>testreport</>. Ths script can be used to build the |
This script can be used to build different versions of the MITgcm |
717 |
different versions of the MITgcm code, run the various |
code, run the various examples, compare the output, and (if specified) |
718 |
examples, compare the output, and (if specified) email the |
email the results of each one of these tests to a central |
719 |
results of each one of these tests to a central |
repository.</para> |
720 |
repository.</para> |
|
721 |
|
<para>On some systems, the testreport script can be run with a command |
722 |
|
line as simple as:</para> |
723 |
|
|
724 |
|
<screen> |
725 |
|
$ cd verification |
726 |
|
$ ./testreport -ieee |
727 |
|
</screen> |
728 |
|
|
729 |
|
<para>However, some systems (those lacking or wiht a broken "/bin/sh") |
730 |
|
may require an explicit shell invocation such as:</para> |
731 |
|
|
732 |
|
<screen> |
733 |
|
$ sh ./testreport -ieee -t 'exp0 exp4' |
734 |
|
$ /some/path/to/bash ./testreport -ieee -t 'ideal_2D_oce lab_sea natl_box' |
735 |
|
</screen> |
736 |
|
|
737 |
<para>The <filename>testreport</> script accepts a number of |
<para>The <filename>testreport</> script accepts a number of |
738 |
command-line options which can be listed using the |
command-line options which can be listed using the <filename>-help</> |
739 |
<filename>-help</> option. The most important ones are:</para> |
option. The most important ones are:</para> |
740 |
|
|
741 |
<variablelist> |
<variablelist> |
742 |
|
|
743 |
<varlistentry> |
<varlistentry> |
744 |
|
<term><filename>-ieee</></term> |
745 |
|
<listitem> |
746 |
|
<para>If allowed by the compiler (as defined in the "optfile"), |
747 |
|
use IEEE arithmetic. This option, along with the GCC compiler, |
748 |
|
is how the standard results were produced.</para> |
749 |
|
</listitem> |
750 |
|
</varlistentry> |
751 |
|
|
752 |
|
<varlistentry> |
753 |
<term><filename>-tdir TESTDIR</></term> |
<term><filename>-tdir TESTDIR</></term> |
754 |
<term><filename>-tdir 'TDIR1 TDIR2 [...]'</></term> |
<term><filename>-tdir 'TDIR1 TDIR2 [...]'</></term> |
755 |
<listitem> |
<listitem> |
756 |
<para>This option specifies the test directory or list |
<para>This option specifies the test directory or list of test |
757 |
of test directories that should be used. Each of these |
directories that should be used. Each of these entries should |
758 |
entries should exactly (note: they're case sensitive!) |
exactly (note: they are case sensitive!) match the names of |
759 |
match the names of directries in |
directries in <filename>$ROOTDIR/verification/</>. If this |
760 |
<filename>$ROOTDIR/verification/</>. If this option is |
option is omitted, then all directories that are properly |
761 |
omitted, then all directories that are properly |
formatted (that is, containing an <filename>input</> |
762 |
formatted (that is, containing an <filename>input</> |
sub-directory and a <filename>results/output.txt</> file) will |
763 |
sub-directory and example output) will be used.</para> |
be used.</para> |
764 |
</listitem> |
</listitem> |
765 |
</varlistentry> |
</varlistentry> |
766 |
|
|
768 |
<term><filename>-optfile=/PATH/FILENAME</></term> |
<term><filename>-optfile=/PATH/FILENAME</></term> |
769 |
<term><filename>-optfile '/PATH/F1 [/PATH/F2 ...]'</></term> |
<term><filename>-optfile '/PATH/F1 [/PATH/F2 ...]'</></term> |
770 |
<listitem> |
<listitem> |
771 |
<para>This specifies a list of "options files" that will |
<para>This specifies a list of "options files" that will be passed |
772 |
be passed to <filename>genmake2</>. If multiple options |
to <filename>genmake2</>. If multiple options files are used |
773 |
files are used (say, to test different compilers or |
(say, to test different compilers or different sets of options |
774 |
different sets of options for the same compiler), then |
for the same compiler), then each options file will be used with |
775 |
each options file will be used with each of the test |
each of the test directories.</para> |
|
directories.</para> |
|
776 |
</listitem> |
</listitem> |
777 |
</varlistentry> |
</varlistentry> |
778 |
|
|
781 |
<term><filename>-addr 'EMAIL1 EMAIL2 [...]'</></term> |
<term><filename>-addr 'EMAIL1 EMAIL2 [...]'</></term> |
782 |
<listitem> |
<listitem> |
783 |
<para>Send the results (namely, <filename>output.txt</>, |
<para>Send the results (namely, <filename>output.txt</>, |
784 |
<filename>gm_local</>, <filename>gm_state</>, and |
<filename>genmake_local</>, <filename>genmake_state</>, and |
785 |
<filename>Makefile</>) to the specified email addresses. |
<filename>Makefile</>) to the specified email addresses. The |
786 |
The results are gzipped, placed in a tar file, MIME |
results are gzipped, placed in a tar file, MIME encoded, and |
787 |
encoded, and sent to an @mitgcm.org address. If no |
sent to the specified address. If no email addresses are |
788 |
email addresses are specified, no mail is sent.</para> |
specified, no mail is sent.</para> |
789 |
|
</listitem> |
790 |
|
</varlistentry> |
791 |
|
|
792 |
|
<varlistentry> |
793 |
|
<term><filename>-mpi</></term> |
794 |
|
<listitem> |
795 |
|
<para>If the necessary files |
796 |
|
(<filename>TESTDIR/code/CPP_EEOPTIONS.h_mpi</> and |
797 |
|
<filename>TESTDIR/code/SIZE.h_mpi</>) exist, then use them for an |
798 |
|
MPI--enabled run. Note that the use of MPI typically requires a |
799 |
|
special command option (see "-command" below) to invoke the MPI |
800 |
|
executable. Examples of PBS scripts using MPI with testreport can be |
801 |
|
found in the <ulink |
802 |
|
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/"> |
803 |
|
MITgcm-contrib area</ulink></para> |
804 |
|
</listitem> |
805 |
|
</varlistentry> |
806 |
|
|
807 |
|
<varlistentry> |
808 |
|
<term><filename>-command='some command to run'</></term> |
809 |
|
<listitem> |
810 |
|
<para>For some tests, particularly MPI runs, the default "make |
811 |
|
output.txt" is not sufficient. This option allows a more general |
812 |
|
command (or shell script) to be invoked. Examples of PBS scripts |
813 |
|
using MPI with testreport can be found in the <ulink |
814 |
|
url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/"> |
815 |
|
MITgcm-contrib area</ulink></para> |
816 |
</listitem> |
</listitem> |
817 |
</varlistentry> |
</varlistentry> |
818 |
|
|
819 |
</variablelist> |
</variablelist> |
820 |
|
|
821 |
<para>The <filename>testreport</> script will write progress |
<para>The <filename>testreport</> script will write progress to the |
822 |
to the screen (stdout) as it runs. In addition, it will |
screen (stdout) as it runs. In addition, it will create a |
823 |
create a <filename>summary.txt</> file that contains a brief |
<filename>tr_out.txt</> file that contains a brief comparison of the |
824 |
comparison of the current output with the "known-good" |
current output with the "known-good" output.</para> |
|
output.</para> |
|
825 |
|
|
826 |
</sect3> |
</sect3> |
827 |
|
|
828 |
</sect2> |
</sect2> |
829 |
|
|
830 |
|
|
831 |
<sect2 id="packages"> |
<sect2 id="packages"> |
832 |
<title>Creating MITgcm Packages</title> |
<title>Creating MITgcm Packages</title> |
833 |
|
|
834 |
<para>Optional parts of code have been separated from the MITgcmUV |
<para>Optional parts of code have been separated from the MITgcmUV core |
835 |
core driver code and organised into packages. The packaging |
driver code and organised into packages. The packaging structure |
836 |
structure provides a mechanism for maintaining suites of code, |
provides a mechanism for maintaining suites of code, specific to |
837 |
specific to particular classes of problems, in a way that is |
particular classes of problems, in a way that is cleanly separated from |
838 |
cleanly separated from the generic fluid dynamical |
the generic fluid dynamical engine.</para> |
839 |
engine.</para> |
|
840 |
|
<para>The MITgcmUV packaging structure is described below using generic |
841 |
<para>The MITgcmUV packaging structure is described below using |
package names ${pkg}. A concrete examples of a package is the code for |
842 |
generic package names ${pkg}. A concrete examples of a package |
implementing GM/Redi mixing. This code uses the package name</para> |
|
is the code for implementing GM/Redi mixing. This code uses the |
|
|
package name</para> |
|
843 |
|
|
844 |
</sect2> |
</sect2> |
845 |
|
|
960 |
& CALL ${PKG}_READPARMS( retCode ) |
& CALL ${PKG}_READPARMS( retCode ) |
961 |
#endif |
#endif |
962 |
|
|
963 |
2. S/R PACKAGES_CHECK() |
3. S/R PACKAGES_INIT_FIXED() |
964 |
|
: |
965 |
|
#ifdef ALLOW_${PKG} |
966 |
|
if ( use${Pkg} ) |
967 |
|
& CALL ${PKG}_INIT_FIXED( retCode ) |
968 |
|
#endif |
969 |
|
|
970 |
|
4. S/R PACKAGES_CHECK() |
971 |
: |
: |
972 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
973 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
977 |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
& CALL PACKAGES_CHECK_ERROR('${PKG}') |
978 |
#endif |
#endif |
979 |
|
|
980 |
3. S/R PACKAGES_INIT() |
5. S/R PACKAGES_INIT_VARIABLES() |
981 |
: |
: |
982 |
#ifdef ALLOW_${PKG} |
#ifdef ALLOW_${PKG} |
983 |
if ( use${Pkg} ) |
if ( use${Pkg} ) |
984 |
& CALL ${PKG}_INIT( retCode ) |
& CALL ${PKG}_INIT_VARIA( ) |
985 |
|
#endif |
986 |
|
|
987 |
|
Package Output |
988 |
|
============== |
989 |
|
6. S/R DO_THE_MODEL_IO |
990 |
|
|
991 |
|
#ifdef ALLOW_${PKG} |
992 |
|
if ( use${Pkg} ) |
993 |
|
& CALL ${PKG}_DIAGS( ) |
994 |
#endif |
#endif |
995 |
|
|
996 |
|
7. S/R PACKAGES_WRITE_PICKUP() |
997 |
|
|
998 |
|
#ifdef ALLOW_${PKG} |
999 |
|
if ( use${Pkg} ) |
1000 |
|
& CALL ${PKG}_WRITE_PICKUP( ) |
1001 |
|
#endif |
1002 |
|
|
1003 |
Description |
Description |
1004 |
=========== |
=========== |
1007 |
is responsible for reading |
is responsible for reading |
1008 |
in the package parameters file data.${pkg}, and storing |
in the package parameters file data.${pkg}, and storing |
1009 |
the package parameters in "${PKG}.h". |
the package parameters in "${PKG}.h". |
1010 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_READPARMS |
1011 |
|
|
1012 |
|
- ${PKG}_INIT_FIXED() |
1013 |
|
is responsible for completing the internal setup of a package. |
1014 |
|
-> called from INITIALISE_FIXED in PACKAGES_INIT_FIXED |
1015 |
|
note: 1) some pkg use instead: |
1016 |
|
CALL ${PKG}_INITIALISE ( or the old form CALL ${PKG}_INIT ) |
1017 |
|
2) for simple pkg setup, this part is done inside ${PKG}_READPARMS |
1018 |
|
|
1019 |
- ${PKG}_CHECK() |
- ${PKG}_CHECK() |
1020 |
is responsible for validating |
is responsible for validating |
1023 |
need to check. This is done through header files "${PKG}.h". |
need to check. This is done through header files "${PKG}.h". |
1024 |
It is assumed that parameters owned by other packages |
It is assumed that parameters owned by other packages |
1025 |
will not be reset during ${PKG}_CHECK(). |
will not be reset during ${PKG}_CHECK(). |
1026 |
-> called in INITIALISE_FIXED |
-> called from INITIALISE_FIXED in PACKAGES_CHECK |
1027 |
|
|
1028 |
- ${PKG}_INIT() |
- ${PKG}_INIT_VARIA() |
1029 |
is responsible for completing the |
is responsible for fill-in all package variables with an initial value. |
1030 |
internal setup of a package. This routine is called after |
Contains eventually a call to ${PKG}_READ_PICKUP that will read |
1031 |
the core model state has been completely initialised |
from a pickup file the package variables required to restart the model. |
1032 |
but before the core model timestepping starts. |
This routine is called after the core model state has been completely |
1033 |
-> called in INITIALISE_VARIA |
initialised but before the core model timestepping starts. |
1034 |
|
-> called from INITIALISE_VARIA in PACKAGES_INIT_VARIABLES |
1035 |
|
note: the name ${PKG}_INIT_VARIA is not yet standard and some pkg |
1036 |
|
use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old |
1037 |
|
form ${PKG}_INIT |
1038 |
|
|
1039 |
|
- ${PKG}_DIAGS() |
1040 |
|
is responsible for writing time-average diagnostics to output |
1041 |
|
files (but the cumulating step is done within the package main S/R). |
1042 |
|
Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR) |
1043 |
|
and write snap-shot fields that are hold in common blocks. Other |
1044 |
|
temporary fields are directly dump to file where they are available. |
1045 |
|
NOTE: this part does not yet have a standard form and should be called |
1046 |
|
from a package dedicated S/R such as PACKAGE_WRITE_DIAGS |
1047 |
|
-> called within DO_THE_MODEL_IO |
1048 |
|
|
1049 |
|
- ${PKG}_WRITE_PICKUP() |
1050 |
|
is responsible for writing a package pickup file when necessary for |
1051 |
|
a restart. (found also the old name: ${PKG}_WRITE_CHECKPOINT ) |
1052 |
|
-> called from FORWARD_STEP and THE_MODEL_MAIN in PACKAGES_WRITE_PICKUP |
1053 |
|
|
1054 |
Summary |
Summary |
1055 |
======= |
======= |
1073 |
|
|
1074 |
- FORTRAN source files |
- FORTRAN source files |
1075 |
----------------------- |
----------------------- |
1076 |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
* ${pkg}_readparms.F reads parameters from file data.${pkg} |
1077 |
* ${pkg}_check.F checks package dependencies and consistencies |
* ${pkg}_init_fixed.F complete the package setup |
1078 |
* ${pkg}_init.F initialises package-related fields |
* ${pkg}_check.F checks package dependencies and consistencies |
1079 |
* ${pkg}_... .F package source code |
* ${pkg}_init_varia.F initialises package-related fields |
1080 |
|
* ${pkg}_... .F package source code |
1081 |
|
* ${pkg}_diags.F write diagnostics to file. |
1082 |
|
* ${pkg}_write_pickup.F write a package pickup file to restart the model |
1083 |
|
|
1084 |
- parameter file |
- parameter file |
1085 |
----------------------- |
----------------------- |