/[MITgcm]/MITgcm/doc/devel_HOWTO.sgml
ViewVC logotype

Diff of /MITgcm/doc/devel_HOWTO.sgml

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

revision 1.7 by edhill, Tue Apr 6 04:12:00 2004 UTC revision 1.14 by jmc, Fri May 28 01:47:32 2010 UTC
# Line 1  Line 1 
1  <!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V4.1//EN">  <!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
2    <!--
3     $Header$
4     $Name$
5    -->
6    
7  <article id="MITgcm-Development-HOWTO">  <article id="MITgcm-Development-HOWTO">
8    
# Line 22  Line 26 
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>
# Line 37  Line 57 
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>
# Line 56  Line 76 
76        <title>User Manual</title>        <title>User Manual</title>
77    
78        <para>Before jumping into development, please familiarize yourself with        <para>Before jumping into development, please familiarize yourself with
79          the <ulink url="http://mitgcm.org/docs.html"> MITgcm user manual          the <ulink url="http://mitgcm.org/public/docs.html"> MITgcm user manual
80          </ulink>.  This document contains volumes of useful information and is          </ulink>.  This document contains volumes of useful information and is
81          included here by reference.</para>          included here by reference.</para>
82    
# Line 94  Line 114 
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    
# Line 104  Line 125 
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    
# Line 182  Line 202 
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">        url="http://mitgcm.org/viewvc/MITgcm/MITgcm/model/src/forward_step.F?view=graph">
206        ViewCVS-generated tree</ulink>, the MITgcm codebase is split into to two        ViewCVS-generated tree</ulink>, the MITgcm codebase is split into
207        branches or "lines" under which development proceeds.  These two lines are        branches or "lines" under which development proceeds.  The main line
208        referred to as the "MAIN" and "ecco" versions of the code.  While not        of development is referred to as the "MAIN" version of the code.
       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 relatively stable        development branch.  This is done in order to create a relatively stable
213        reference point for both users and developers.  The intent is that once a        reference point for both users and developers.  The intent is that once a
214        relese branch has been created, only bug-fixes will be added to it.        release branch has been created, only bug-fixes will be added to it.
215        Meanwhile, development (which might "break" or otherwise render invalid        Meanwhile, development (which might "break" or otherwise render invalid
216        the documentation, tutorials, and/or examples contained within a release        the documentation, tutorials, and/or examples contained within a release
217        branch) is allowed to continue along the MAIN and ecco lines.</para>        branch) is allowed to continue along the MAIN line.</para>
218        </sect2>
219    
220        <sect2>
221          <title> Developer settings </title>
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>
229            <listitem>
230              <para> You will need an account (loggin access) to the server
231               "mitgcm.org" with the proper group setting (e.g.,
232                group "gcmctrb" to add/modify code into MITgcm_contrib).
233                This kind of account is granted only upon well motivated request.
234                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>      </sect2>
303    
304      <sect2>      <sect2>
305        <title>Tagging</title>        <title>Main code development</title>
306          <para><emphasis>(formerly named "Tagging" ; this section needs an update)
307            </emphasis></para>
308    
309        <para>The intent of tagging is to create "known-good" checkpoints that        <para>The intent of tagging is to create "known-good" checkpoints that
310        developers can use as references.  Traditionally, MITgcm tagging has        developers can use as references.  Traditionally, MITgcm tagging has
# Line 216  Line 320 
320    
321          <listitem>          <listitem>
322            <para>The developer then runs the <ulink            <para>The developer then runs the <ulink
323            url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/verification/testscript">            url="http://mitgcm.org/viewvc/MITgcm/MITgcm/verification/testreport">
324            testscript</ulink> shell script to see if any problems are introduced.            testreport</ulink> shell script to see if any problems are introduced.
325            While not intended to be exhaustive, the test cases within the            While not intended to be exhaustive, the test cases within the
326            verification directory do provide some indication whether gross errors            verification directory do provide some indication whether gross errors
327            have been introduced.            have been introduced.
# Line 232  Line 336 
336              <listitem>              <listitem>
337                <para>adds a "checkpointXY_pre" comment (where X is a checkpoint                <para>adds a "checkpointXY_pre" comment (where X is a checkpoint
338                number and Y is a letter) to the <ulink                number and Y is a letter) to the <ulink
339                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index">                url="http://mitgcm.org/viewvc/MITgcm/MITgcm/doc/tag-index">
340                tag-index</ulink> file and checks it into the CVS                tag-index</ulink> file and checks it into the CVS
341                repository</para>                repository</para>
342              </listitem>              </listitem>
# Line 277  checkpoint50d_pre Line 381  checkpoint50d_pre
381    </sect1>    </sect1>
382    
383    
   <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:NAME@mitgcm.org:/u/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>  
   
384    <sect1 id="coding">    <sect1 id="coding">
385      <title>Coding for MITgcm</title>      <title>Coding for MITgcm</title>
386    
# Line 392  checkpoint50d_pre Line 394  checkpoint50d_pre
394          For MITgcm, the process is similar.  Typical commands are:</para>          For MITgcm, the process is similar.  Typical commands are:</para>
395    
396  <screen>  <screen>
397    $ genmake -mods=../code    $ genmake2 -mods=../code
398    $ make depend    $ make depend
399    $ make    $ make
400  </screen>  </screen>
# Line 403  checkpoint50d_pre Line 405  checkpoint50d_pre
405        <sect3 id="genmake">        <sect3 id="genmake">
406          <title>The <filename>genmake2</> Utility</title>          <title>The <filename>genmake2</> Utility</title>
407    
408          <para><emphasis>Please note that the older <filename>genmake</> is          <para><emphasis>(Note: the older <filename>genmake</>
409              deprecated and will eventually be replaced by <filename>genmake2</>.              has been replaced by <filename>genmake2</>)</emphasis></para>
             This HOWTO only describes the newer tool.</emphasis></para>  
410    
411          <para>The first step in any MITgcm build is to create a Unix-style          <para>The first step in any MITgcm build is to create a Unix-style
412            <filename>Makefile</filename> which will be parsed by            <filename>Makefile</filename> which will be parsed by
# Line 461  checkpoint50d_pre Line 462  checkpoint50d_pre
462              <para>an "options file" as specified by the command-line option              <para>an "options file" as specified by the command-line option
463                <filename>-optfile='FILENAME'</filename></para>                <filename>-optfile='FILENAME'</filename></para>
464            </listitem>            </listitem>
465              <listitem>
466                <para> a <filename>packages.conf</filename> file (in the current
467                  directory or in one of the "MODS" directories, see below)
468                  which contains the specific list of packages to compile
469                </para>
470              </listitem>
471          </orderedlist>          </orderedlist>
472    
473          <para>then checking certain dependency rules (the package dependencies),          <para>then checking certain dependency rules (the package dependencies),
# Line 514  checkpoint50d_pre Line 521  checkpoint50d_pre
521            </varlistentry>            </varlistentry>
522    
523            <varlistentry>            <varlistentry>
             <term><filename>-pdepend=/PATH/FILENAME</></term>  
   
             <listitem>  
               <para>This specifies the dependency file used for packages.  If  
               not specified, the default dependency file is  
               <filename>$ROOTDIR/pkg/pkg_depend</>.  The syntax for this file is  
               parsed on a line-by-line basis where each line containes either a  
               comment ("#") or a simple "PKGNAME1 (+|-)PKGNAME2" pairwise rule  
               where the "+" or "-" symbol specifies a "must be used with" or a  
               "must not be used with" relationship, respectively.  If no rule is  
               specified, then it is assumed that the two packages are compatible  
               and will function either with or without each other.</para>  
             </listitem>  
           </varlistentry>  
   
           <varlistentry>  
             <term><filename>-pdefault=PKG</></term>  
             <term><filename>-pdefault='PKG1 [PKG2 PKG3 ...]'</></term>  
             <listitem>  
               <para>This option specifies the default set of packages  
               to be used.  If not set, the default package list will  
               be read from  
               <filename>$ROOTDIR/pkg/pkg_default</>.</para>  
             </listitem>  
           </varlistentry>  
   
           <varlistentry>  
524              <term><filename>-adof=/path/to/file</></term>              <term><filename>-adof=/path/to/file</></term>
525              <term><filename>-adoptfile=/path/to/file</></term>              <term><filename>-adoptfile=/path/to/file</></term>
526              <listitem>              <listitem>
# Line 568  checkpoint50d_pre Line 548  checkpoint50d_pre
548                  will be overridden by any identically-named sources within the                  will be overridden by any identically-named sources within the
549                  "MODS" directories.  The order of precedence for this                  "MODS" directories.  The order of precedence for this
550                  "name-hiding" is as follows:</para>                  "name-hiding" is as follows:</para>
                 
551                <itemizedlist>                <itemizedlist>
552                  <listitem><para>"MODS" directories (in the order given)                  <listitem><para>"MODS" directories (in the order given)
553                    </para></listitem>                    </para></listitem>
# Line 580  checkpoint50d_pre Line 559  checkpoint50d_pre
559                  <listitem><para>The "standard dirs" (which may have been                  <listitem><para>The "standard dirs" (which may have been
560                      specified by the "-standarddirs" option)</para></listitem>                      specified by the "-standarddirs" option)</para></listitem>
561                </itemizedlist>                </itemizedlist>
562                </listitem>
563              </varlistentry>
564    
565              <varlistentry>
566                <term><filename>-pgroups=/PATH/FILENAME</></term>
567                <listitem>
568                  <para>This option specifies the file where package groups are
569                  defined.  If not set, the package-groups definition will
570                  be read from
571                  <filename>$ROOTDIR/pkg/pkg_groups</>.</para>
572                  <para>
573                  It also contains the default list of packages (defined
574                  as the group <filename>"default_pkg_list"</>) which is used
575                  when no specific package list (file: <filename>packages.conf</>)
576                  is found in current directory or in any "MODS" directory.
577                  </para>
578                </listitem>
579              </varlistentry>
580    
581              <varlistentry>
582                <term><filename>-pdepend=/PATH/FILENAME</></term>
583    
584                <listitem>
585                  <para>This specifies the dependency file used for packages.  If
586                  not specified, the default dependency file is
587                  <filename>$ROOTDIR/pkg/pkg_depend</>.  The syntax for this file is
588                  parsed on a line-by-line basis where each line containes either a
589                  comment ("#") or a simple "PKGNAME1 (+|-)PKGNAME2" pairwise rule
590                  where the "+" or "-" symbol specifies a "must be used with" or a
591                  "must not be used with" relationship, respectively.  If no rule is
592                  specified, then it is assumed that the two packages are compatible
593                  and will function either with or without each other.</para>
594              </listitem>              </listitem>
595            </varlistentry>            </varlistentry>
596    
# Line 606  checkpoint50d_pre Line 616  checkpoint50d_pre
616          <para>In general, it is best to use <filename>genmake2</> on a "clean"          <para>In general, it is best to use <filename>genmake2</> on a "clean"
617            directory that is free of all source (*.[F,f],*.[F,f]90) and header            directory that is free of all source (*.[F,f],*.[F,f]90) and header
618            (*.h,*.inc) files.  Generally, this can be accomplished in an            (*.h,*.inc) files.  Generally, this can be accomplished in an
619            "un-clean" directory by running "make CLEAN" followed by "make            "un-clean" directory by running "make Clean" followed by "make
620            makefile".</para>            makefile".</para>
621    
622        </sect3>        </sect3>
# Line 619  checkpoint50d_pre Line 629  checkpoint50d_pre
629            simulator) executable using:</para>            simulator) executable using:</para>
630    
631  <screen>  <screen>
632    $ make CLEAN    $ make Clean
633    $ make depend    $ make depend
634    $ make    $ make
635  </screen>  </screen>
636    
637          <para>The "make CLEAN" step will remove any stale source files, include          <para>The "make Clean" step will remove any stale source files, include
638            files, and links.  It is strongly recommended for "un-clean"            files, and links.  It is strongly recommended for "un-clean"
639            directories which may contain the (perhaps partial) results of            directories which may contain the (perhaps partial) results of
640            previous builds.  Such "debris" can interfere with the next stage of            previous builds. Such "debris" can interfere with the next stage of
641            the build.</para>            the build.
642              A more agressive cleaning option, "make CLEAN", can be used to also
643              remove the executable and output files from a previous run.</para>
644    
645          <para>The "make depend" step will create a large number of symbolic          <para>The "make depend" step will create a large number of symbolic
646            links from the local directory to the source file locations.  It also            links from the local directory to the source file locations.  It also
# Line 787  checkpoint50d_pre Line 799  checkpoint50d_pre
799                special command option (see "-command" below) to invoke the MPI                special command option (see "-command" below) to invoke the MPI
800                executable.  Examples of PBS scripts using MPI with testreport can be                executable.  Examples of PBS scripts using MPI with testreport can be
801                found in the <ulink                found in the <ulink
802                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/">                url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/">
803                MITgcm-contrib area</ulink></para>                MITgcm-contrib area</ulink></para>
804              </listitem>              </listitem>
805            </varlistentry>            </varlistentry>
# Line 799  checkpoint50d_pre Line 811  checkpoint50d_pre
811                output.txt" is not sufficient.  This option allows a more general                output.txt" is not sufficient.  This option allows a more general
812                command (or shell script) to be invoked.  Examples of PBS scripts                command (or shell script) to be invoked.  Examples of PBS scripts
813                using MPI with testreport can be found in the <ulink                using MPI with testreport can be found in the <ulink
814                url="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/test_scripts/">                url="http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/test_scripts/">
815                MITgcm-contrib area</ulink></para>                MITgcm-contrib area</ulink></para>
816              </listitem>              </listitem>
817            </varlistentry>            </varlistentry>
# Line 826  checkpoint50d_pre Line 838  checkpoint50d_pre
838          the generic fluid dynamical engine.</para>          the generic fluid dynamical engine.</para>
839    
840        <para>The MITgcmUV packaging structure is described below using generic        <para>The MITgcmUV packaging structure is described below using generic
841          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
842          implementing GM/Redi mixing. This code uses the package name</para>          implementing GM/Redi mixing. This code uses the package name</para>
843    
844      </sect2>      </sect2>
# Line 886  o  Each package gets its runtime configu Line 898  o  Each package gets its runtime configu
898     Package runtime config. options are imported     Package runtime config. options are imported
899     into a common block held in a header file     into a common block held in a header file
900     called "${PKG}.h".     called "${PKG}.h".
901       Note: In some packages, the header file "${PKG}.h" is splitted
902       into "${PKG}_PARAMS.h" that contains the package parameters and
903       ${PKG}_VARS.h" for the field arrays.
904    
905  o  The core driver part of the model can check  o  The core driver part of the model can check
906     for runtime enabling or disabling of individual packages     for runtime enabling or disabling of individual packages
# Line 908  CPP Flags Line 923  CPP Flags
923      1. Within the core driver code flags of the form      1. Within the core driver code flags of the form
924         ALLOW_${PKG} are used to include or exclude         ALLOW_${PKG} are used to include or exclude
925         whole packages. The ALLOW_${PKG} flags are included         whole packages. The ALLOW_${PKG} flags are included
926         from a PKG_CPP_OPTIONS block which is currently         from a PACKAGES_CONFIG.h file that is automatically
927           generated by genmake2 (see genmake2 section).
928         held in-line in the CPP_OPTIONS.h header file.         held in-line in the CPP_OPTIONS.h header file.
929         e.g.         e.g.
930    
931         Core model code .....         Core model code .....
932    
933           #include "PACKAGES_CONFIG.h"
934         #include "CPP_OPTIONS.h"         #include "CPP_OPTIONS.h"
935           :           :
936           :           :
# Line 925  CPP Flags Line 942  CPP Flags
942    
943      2. Within an individual package a header file,      2. Within an individual package a header file,
944         "${PKG}_OPTIONS.h", is used to set CPP flags         "${PKG}_OPTIONS.h", is used to set CPP flags
945         specific to that package. It is not recommended         specific to that package. It also includes
946         to include this file in "CPP_OPTIONS.h".         "PACKAGES_CONFIG.h" and "CPP_OPTIONS.h".
947    
948    
949  Package Boot Sequence  Package Boot Sequence
# Line 978  Package Output Line 995  Package Output
995    
996          #ifdef ALLOW_${PKG}          #ifdef ALLOW_${PKG}
997            if ( use${Pkg} )            if ( use${Pkg} )
998       &       CALL ${PKG}_DIAGS( )       &       CALL ${PKG}_OUTPUT( )
999          #endif          #endif
1000    
1001       7. S/R PACKAGES_WRITE_PICKUP()       7. S/R PACKAGES_WRITE_PICKUP()
# Line 994  Description Line 1011  Description
1011        - ${PKG}_READPARMS()        - ${PKG}_READPARMS()
1012      is responsible for reading      is responsible for reading
1013      in the package parameters file data.${pkg}, and storing      in the package parameters file data.${pkg}, and storing
1014      the package parameters in "${PKG}.h".      the package parameters in "${PKG}.h" (or in "${PKG}_PARAMS.h").
1015      -> called from INITIALISE_FIXED in PACKAGES_READPARMS      -> called from INITIALISE_FIXED in PACKAGES_READPARMS
1016    
1017       - ${PKG}_INIT_FIXED()       - ${PKG}_INIT_FIXED()
# Line 1024  Description Line 1041  Description
1041       use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old       use for e.g. ${PKG}_INI_VARS, ${PKG}_INIT_VARIABLES, or the old
1042       form ${PKG}_INIT       form ${PKG}_INIT
1043    
1044       - ${PKG}_DIAGS()       - ${PKG}_OUTPUT( )
1045       is responsible for writing time-average diagnostics to output       is responsible for writing time-average fields to output files
1046       files (but the cumulating step is done within the package main S/R).       (but the cumulating step is done within the package main S/R).
1047       Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR)       Can also contain other diagnostics (.e.g. CALL ${PKG}_MONITOR)
1048       and write snap-shot fields that are hold in common blocks. Other       and write snap-shot fields that are hold in common blocks. Other
1049       temporary fields are directly dump to file where they are available.       temporary fields are directly dump to file where they are available.
1050       NOTE: this part does not yet have a standard form and should be called       NOTE: 1) the S/R old name ${PKG}_DIAGS is used in some packages
1051         from a package dedicated S/R such as PACKAGE_WRITE_DIAGS                but is beeing replaced by ${PKG}_OUTPUT
1052                  to avoid confusion with pkg/diagnostics functionality.
1053               2) the output part is not yet in a standard form and might still
1054                  evolve a lot.
1055      -> called within DO_THE_MODEL_IO      -> called within DO_THE_MODEL_IO
1056    
1057       - ${PKG}_WRITE_PICKUP()       - ${PKG}_WRITE_PICKUP()
# Line 1058  Summary Line 1078  Summary
1078    -----------------------    -----------------------
1079    * ${PKG}_OPTIONS.h     has further package-specific CPP options    * ${PKG}_OPTIONS.h     has further package-specific CPP options
1080    * ${PKG}.h             package-specific common block variables, fields    * ${PKG}.h             package-specific common block variables, fields
1081       or  ${PKG}_PARAMS.h   package-specific common block parameters
1082       and ${PKG}_VARS.h     package-specific common block fields
1083    
1084  - FORTRAN source files  - FORTRAN source files
1085    -----------------------    -----------------------
# Line 1066  Summary Line 1088  Summary
1088    * ${pkg}_check.F        checks package dependencies and consistencies    * ${pkg}_check.F        checks package dependencies and consistencies
1089    * ${pkg}_init_varia.F   initialises package-related fields    * ${pkg}_init_varia.F   initialises package-related fields
1090    * ${pkg}_... .F         package source code    * ${pkg}_... .F         package source code
1091    * ${pkg}_diags.F        write diagnostics to file.    * ${pkg}_output.F       write output to file.
1092    * ${pkg}_write_pickup.F write a package pickup file to restart the model    * ${pkg}_write_pickup.F write a package pickup file to restart the model
1093    
1094      New: Subroutine in one package (pkgA) that only contains code which
1095           is connected to a 2nd package (pkgB) (e.g.: gmredi_diagnostics_init.F)
1096           will be named: pkgA_pkgB_something.F
1097    
1098  - parameter file  - parameter file
1099    -----------------------    -----------------------
1100    * data.${pkg}          parameter file    * data.${pkg}          parameter file
# Line 1077  Summary Line 1103  Summary
1103    </sect1>    </sect1>
1104    
1105    
1106      <sect1 id="documentation">
1107        <title>Editing the Documentation</title>
1108    
1109        <sect2 id="documentation_getting">
1110          <title>Getting the Docs and Code</title>
1111    
1112          <para>The first step towards editing the documentation is to checkout a
1113          copy of code, docs, and build scripts from the CVS server using:</para>
1114    
1115    <screen>
1116      $ export CVS_RSH=ssh
1117      $ export CVSROOT=':ext:NAME@mitgcm.org:/u/gcmpack'
1118      $ mkdir scratch
1119      $ cvs co -P MITgcm manual mitgcm.org
1120    </screen>
1121    
1122          <para>These commands extract the necessary information from the CVS server
1123          and create a temporary (called <filename>scratch</filename>) directory for
1124          the storage of the HTML and other files that will be created.  Please note
1125          that you must either create <filename>scratch</filename> as shown or edit
1126          the various <filename>Makefile</filename>s and scripts used to create the
1127          documentation.</para>
1128        </sect2>
1129    
1130        <sect2>
1131          <title>Editing the Documentation</title>
1132    
1133          <para>The documentation is contained in the <filename>manual</filename>
1134          directory in a raw LaTeX format.  The main document is
1135          <filename>manual.tex</filename> and it uses <command>\input{}</command>s
1136          to include the chapters and subsections.</para>
1137    
1138          <para>Since the same LaTeX source is used to produce PostScript, PDF, and
1139          HTML output, care should be taken to follow certain conventions.  Two of
1140          the most important are the usage of the <command>\filelink{}{}</command>
1141          and <command>\varlink{}{}</command> commands.  Both of these commands have
1142          been defined to simplify the connection between the automatically
1143          generated ("code browser") HTML and the HTML version of the manual
1144          produced by LaTeX2HTML.  They each take two arguments (corresponding to
1145          the contents of the two sets of curly braces) which are the text that the
1146          author wishes to be "wrapped" within the link, and a specially formatted
1147          link thats relative to the <filename>MITgcm</filename> directory within
1148          the CVS tree.</para>
1149    
1150          <para>The result is a command that resembles either</para>
1151          
1152          <orderedlist>
1153            <listitem>
1154              <para>a reference to a variable or subroutine name such as
1155              <command>\varlink{tRef}{tRef}</command>, or </para>
1156            </listitem>
1157    
1158            <listitem>
1159              <para>a reference to a file such as
1160                  <command>\varlink{tRef}{path-to-the-file_name.F}</command>
1161                  where the absolute path to the file is of the form
1162                  <filename>/foo/MITgcm/path/to/the/file_name.F</filename></para>
1163                  <para>(please note how the leading "/foo/MITgcm"
1164                  component of the path is dropped leaving the path
1165                  <emphasis>relative</emphasis> to the head of the code
1166                  directory and each directory separator "/" is turned
1167                  into a "-")</para>
1168            </listitem>
1169          </orderedlist>
1170              
1171    
1172    
1173        </sect2>
1174    
1175        <sect2>
1176          <title>Building the Documentation</title>
1177          
1178          <para>Given the directory structure of <xref
1179          linkend="documentation_getting">, the entire documentation for the web
1180          site can be built using:</para>
1181    
1182    <screen>
1183      $ cd mitgcm.org/devel/buildweb
1184      $ make All
1185    </screen>
1186    
1187          <para>Which builds the PDF from the LaTeX source, creates the HTML output
1188          from the LaTeX source, parses the FORTRAN code base to produce a
1189          hyperlinked HTML version of the source, and then determines the
1190          cross-linking between the various HTML components.</para>
1191    
1192          <para>If there are no errors, the result of the build process (which can
1193          take 30+ minutes on a P4/2.5Ghz) will be contained within a single
1194          directory called <filename>scratch/dev_docs</filename>.  This is a freshly
1195          built version of the entire on-line users manual.  If you have the correct
1196          permissions, it can be directly copied to the web server area:</para>
1197    
1198    <screen>
1199      $ mv scratch/dev_docs /u/u0/httpd/html
1200    </screen>
1201    
1202          <para>and the update is complete.</para>
1203    
1204        </sect2>
1205    
1206      </sect1>
1207    
1208  </article>  </article>
1209    
1210    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22