Talk:build roms

From WikiROMS
Jump to navigationJump to search

Rsignell 17:31, 18 June 2007 (UTC)


Here is an example of using the build_roms.csh script to build the LAKE_SIGNELL test case, one of my favorites!

  1. Make a project directory. On our Opteron cluster, I have one directory where I keep the source code:
    /home/rsignell/models/roms_rutgers/trunk
    and another where I actually do model runs
    /home/rsignell/projects
    So on my system, for a new test, I make a directory called
    /home/rsignell/projects/test1
  2. Checkout the source code using svn (or unpack the source code if you got a tarfile or zipfile somewhere) and copy the build_roms.csh script (which you will find in ROMS/Bin sub-directory) to your project directory.
  3. Edit build_roms.csh to specify:
    MY_ROMS_APPLICATION LAKE_SIGNELL
    MY_ROMS_SRC /home/rsignell/models/roms_rutgers/trunk
    MY_PROJECT_DIR /home/rsignell/projects/test1
    and set which compiler I want to use (e.g. ifort, gfortran, pgi) and what type of executable I want (MPI, OpenMP, or Serial). Even though I use the pgi compiler on our cluster, I actually build MPI code using the mpif90 script, so I set USE_MPIF90 on as well as pgi.
  4. Compile. Run the build_roms.csh script. If you have more than one processor on the machine you are compiling on you can use the -j option to build faster. For example, to use 2 CPUs use:
    ./build_roms.csh -j 2
  5. Set up the input files for the run. ROMS uses several ASCII input files to specify some of the run parameters, and we use the .in extension by convention to indicate these files. For the test cases, these are found in the ROMS/External directory. So to run ROMS from our project directory, we need to copy over the right input files for the LAKE_SIGNELL case. We also want a copy of varinfo.dat, which defines NetCDF metadata parameters.
    cp ~/models/roms_rutgers/trunk/ROMS/External/{*lake_signell*.in,varinfo.dat} ~/projects/test1
    I then need to modify roms_lake_signell.in to point to the local directory to find varinfo.dat, floats_lake_signell.in and sediment_lake_signell.in.
    I can also edit roms_lake_signell.in to specify how many tiles (NtileI, NtileJ) I want to have. If I want to run with Serial or OpenMP, I can specify the tiling however I want, but I want to run on 4 CPUs with MPI, the CPUs and number of tiles has to be the same. I want to run on 4 CPUS with MPI, so I leave the default 2x2 tiling.

    If you are lazy and don't want to make all these edits and just want to try it out, you can getand just edit these two lines (and perhaps the compiler options) in the build_roms.csh script
    MY_ROMS_SRC /home/rsignell/models/roms_rutgers/trunk
    MY_PROJECT_DIR /home/rsignell/projects/test1
  6. Run
    ./romsS < roms_lake_signell.in > & log & (Serial)
    ./romsO < roms_lake_signell.in > & log & (OpenMP)
    mpirun -n 4 -hostfile node_file ./romsM roms_lake_signell.in >& log & (MPI)
  7. Check out the results
    ncview roms_his.nc