Difference between revisions of "Getting Started"

From WikiROMS
Jump to navigationJump to search
Line 48: Line 48:
                   /Src                SWAN model</span>
                   /Src                SWAN model</span>


ROMS uses extensively [[C-preprocessing]] to activate and/or deactivate
ROMS uses [[C-preprocessing]] extensively to activate and/or deactivate
the various numerical and physical algorithm [[Options | options]]. It also uses
the various numerical and physical algorithm [[Options | options]]. It also uses
[[NetCDF]] to manage input and output data streams. It is highly
[[NetCDF]] to manage input and output data streams. It is highly
recommended that first time users learn the basics about NetCDF
recommended that first time users learn the basics of NetCDF
before starting working with ROMS.
before working with ROMS.


==Basic Steps==
==Basic Steps==


* Register at the ROMS website ([http://www.myroms.org www.myroms.org]) to get access to the algorithms and other user privileges. Select an '''username''' and '''password''' which will be used in the future to login and post messages in the ROMS forum, algorithm downloads, and contributing to wikiROMS.
* Register at the ROMS website ([http://www.myroms.org www.myroms.org]) to get access to the algorithms and other user privileges. Select a '''username''' and '''password''' which will be used in the future to login and post messages on the ROMS forum, algorithm downloads, and contributing to wikiROMS.


* Make sure that you have the following required software in your computer before compiling and running an application:
* Make sure that you have the following required software in your computer before attempting to compile and run an application:
** [http://subversion.tigris.org/ Subversion] client to download source
** [http://subversion.tigris.org/ Subversion] client to download source
** Fortran 90 or Fortran 95 compiler
** Fortran 90 or Fortran 95 compiler
Line 64: Line 64:
** [http://www.gnu.org/software/make/ GNU make] version '''3.81''' or higher to compile ROMS
** [http://www.gnu.org/software/make/ GNU make] version '''3.81''' or higher to compile ROMS
** [http://www.perl.org/ Perl] interpreter program
** [http://www.perl.org/ Perl] interpreter program
** [http://www.unidata.ucar.edu/software/netcdf/ NetCDF] library, Fortran 90 interface
** [http://www.unidata.ucar.edu/software/netcdf/ NetCDF] library, with Fortran 90 interface
** Message Passing Interface (MPI) library to run in parallel on a distributed-memory system
** Message Passing Interface (MPI) library to run in parallel on a distributed-memory system


* Use a [[Subversion | Subversion]] client to '''checkout''' the latest version of the ROMS '''trunk'''.
* Use a [[Subversion | Subversion]] client to '''checkout''' the latest version of the ROMS '''trunk'''. It is highly recommended that you checkout the code on the same system that you will be compiling and running the code on to avoid file format issues.


* Compile and link ROMS by typing <div class="box"><span class="red">make</span></div> at the top of the directory structure where the [[makefile]] is located. This [[gmake | make]] will build and compile the default ROMS [[UPWELLING_CASE | upwelling]] application. The [[makefile]] will include a special machine-dependent include file (Linux-pgi.mk, for instance) particular to your operating system and compiler, found in the '''Compilers''' sub-directory. You may need to edit this machine-dependent file so the makefile can find your NetCDF library or set the environmental variables '''NETCDF_INCDIR''' and '''NETCDF_LIBDIR''' with the path of its include and library directories. You can also modify the makefile if you want to, say, compile ROMS to run with the MPI libraries.
* We recommend that you use the included '''[[build Script|build script]]''' to compile and link ROMS. This will set up your build environment and execute the [[gmake|make]] command to build the default ROMS [[UPWELLING_CASE | upwelling]] application. This process allows you to avoid editing the [[makefile]]. Please visit the '''[[build Script|build script]]''' page for more detailed instructions.
** You can type '''make -j N''' to compile ROMS faster where '''N''' is the number of processors.  This will spread the compilation and linking over N-processors.  Often, you can also compile in debug mode ('''FFLAGS = -g''') -- that will typically compile much faster, so you can make sure the code compiles.  However, it will cause the code to run ''much'' more slowly.  Usually, you will want to optimize the code with a compiler flag '''-O'''.  We have found that level 2 optimization ('''FFLAGS = -O2''') is usually good enough, and compiles faster (and introduces fewer bugs) than higher level optimization.
** You can also type <span class="red">make</span> at the top of the directory structure where the [[makefile]] is located but we do not recommend this process because it requires changing the ROMS files which can cause conflicts when you update you ROMS code.
** You can also build ROMS without modifying the makefile or anything else in the source distribution by using the [[build Script]] '''build.sh''' or '''build.bash''' located in the '''ROMS/Bin''' sub-directory.


* To run ROMS in serial, just type: <div class="box"><span class="red">oceanS &lt; ROMS/External/ocean_upwelling.in &gt; & log &</span></div>or to run in parallel (distributed-memory) on two processors: <div class="box"><span class="red">mpirun -np 2 oceanM ROMS/External/ocean_upwelling.in &gt; & log &</span></div>or to run in parrallel (shared-memory) on two processors:<div class="box"><span class="red">setenv OMP_THREAD_NUM 2<br>oceanO < ROMS/External/ocean_upwelling.in > & log &</span></div>Here, the the file <span class="red">ROMS/External/ocean_upwelling.in</span> contains all the input parameters to required by this application. Notice that in distributed-memory, the leading <span class="red">&lt;</span> is omitted so all parallel threads can read and process this input script without any communications in between.
 
{{note}}'''Note:''' To speed compilation, you may want to add the '''-j <n>''' flag to the build command (i.e. '''build.sh -j 4''') where '''<n>''' is the number of processors you wish to compile with. Even single processor machines can benefit from the -j flag with '''<n>&nbsp;=&nbsp;2'''.
 
 
{{note}}'''Note:''' To make sure your application can compile successfully, you might want to set '''USE_DEBUG''' to '''on''' in the [[build Script|build script]] since it will compile faster. Once your application can compile you can unset '''USE_DEBUG''' in order to create an optimized executable. Please visit the '''[[build Script|build script]]''' page for more information
 
 
* To run ROMS in serial, just type: <div class="box"><span class="red">oceanS &lt; ROMS/External/ocean_upwelling.in &gt; & log &</span></div>or to run in parallel (distributed-memory) on two processors: <div class="box"><span class="red">mpirun -np 2 oceanM ROMS/External/ocean_upwelling.in &gt; & log &</span></div>or to run in parrallel (shared-memory) on two processors:<div class="box"><span class="red">setenv OMP_THREAD_NUM 2<br>oceanO < ROMS/External/ocean_upwelling.in > & log &</span></div>Here, the the file <span class="red">ROMS/External/ocean_upwelling.in</span> contains all the input parameters to required by this application. Visit [[ocean.in]] for more information.
 
{{note}}Notice that in distributed-memory, the leading <span class="red">&lt;</span> is omitted so all parallel threads can read and process this input script without any communications in between.

Revision as of 19:14, 7 January 2010

Getting Started

ROMS is a very complex model with many options and capabilities. ROMS is composed of many Fortran files (.F), a few header files (.h), various input script files (.in), a metadata variable definition file (varinfo.dat), and a single makefile. The ROMS algorithms are distributed with the following directory structure:

 trunk/                               Main trunk directory
      /Atmosphere/                    Atmosphere models root directory
                 /COAMPS              COAMPS root directory (empty)
                 /WRF                 WRF root directory (empty)
      /Compilers/                     make configuration files
      /Data/                          Input data root directory
           /ROMS/                     ROMS data root directory
                /CDL                  ROMS NetCDF metadata design
                /Forcing              Input test cases forcing NetCDF files
                /Grid                 Input test cases grid NetCDF files
                /Initial              Input test cases initial conditions NetCDF files
      /Lib/                           External libraries
          /ARPACK                     Arpack eigenvalue problems library
          /MCT                        Modeling Coupling Tool library
      /Master                         Main standalone and coupling programs
      /ROMS/                          ROMS root directory
           /Adjoint                   Adjoint model
                   /Biology           Adjoint biology/ecosystem models
           /Bin                       Executable scripts
           /Drivers                   Computational drivers
           /External                  Standard input scripts
           /Functionals               Analytical expression header files
           /Include                   Test cases configuration header files
           /Modules                   Declaration modules
           /Nonlinear                 Nonlinear model
                     /Biology         Nonlinear biology/ecosystem models
                     /Sediment        Nonlinear sediment transport model
           /Obsolete                  Discontinued files
           /Programs                  Support programs
           /SeaIce                    Sea-ice model (empty)
           /Representer               Representer model
                       /Biology       Representer biology/ecosystem models
           /Tangent                   Tangent linear model
                   /Biology           Tangent linear biology/ecosystem models
           /Utility                   Generic utility files
           License_ROMS.text          Open source license
           Version                    SVN Version information
      /User/                          ROMS User interface root directory
           /External                  User standard input scripts
           /Functionals               User analytical expressions templates
           /Include                   User application header files
      /WAVES/                         Waves models root directory
            /SWAN                     SWAN root directory
                 /External            SWAN input data and standard input files
                 /Src                 SWAN model

ROMS uses C-preprocessing extensively to activate and/or deactivate the various numerical and physical algorithm options. It also uses NetCDF to manage input and output data streams. It is highly recommended that first time users learn the basics of NetCDF before working with ROMS.

Basic Steps

  • Register at the ROMS website (www.myroms.org) to get access to the algorithms and other user privileges. Select a username and password which will be used in the future to login and post messages on the ROMS forum, algorithm downloads, and contributing to wikiROMS.
  • Make sure that you have the following required software in your computer before attempting to compile and run an application:
    • Subversion client to download source
    • Fortran 90 or Fortran 95 compiler
    • cpp program for C-preprocessing ROMS source code.
    • GNU make version 3.81 or higher to compile ROMS
    • Perl interpreter program
    • NetCDF library, with Fortran 90 interface
    • Message Passing Interface (MPI) library to run in parallel on a distributed-memory system
  • Use a Subversion client to checkout the latest version of the ROMS trunk. It is highly recommended that you checkout the code on the same system that you will be compiling and running the code on to avoid file format issues.
  • We recommend that you use the included build script to compile and link ROMS. This will set up your build environment and execute the make command to build the default ROMS upwelling application. This process allows you to avoid editing the makefile. Please visit the build script page for more detailed instructions.
    • You can also type make at the top of the directory structure where the makefile is located but we do not recommend this process because it requires changing the ROMS files which can cause conflicts when you update you ROMS code.


NoteNote: To speed compilation, you may want to add the -j <n> flag to the build command (i.e. build.sh -j 4) where <n> is the number of processors you wish to compile with. Even single processor machines can benefit from the -j flag with <n> = 2.


NoteNote: To make sure your application can compile successfully, you might want to set USE_DEBUG to on in the build script since it will compile faster. Once your application can compile you can unset USE_DEBUG in order to create an optimized executable. Please visit the build script page for more information


  • To run ROMS in serial, just type:
    oceanS < ROMS/External/ocean_upwelling.in > & log &
    or to run in parallel (distributed-memory) on two processors:
    mpirun -np 2 oceanM ROMS/External/ocean_upwelling.in > & log &
    or to run in parrallel (shared-memory) on two processors:
    setenv OMP_THREAD_NUM 2
    oceanO < ROMS/External/ocean_upwelling.in > & log &
    Here, the the file ROMS/External/ocean_upwelling.in contains all the input parameters to required by this application. Visit ocean.in for more information.

NoteNotice that in distributed-memory, the leading < is omitted so all parallel threads can read and process this input script without any communications in between.