Difference between revisions of "Talk:build roms"

From WikiROMS
Jump to navigationJump to search
m (Text replacement - "ocean_(.*)\.in" to "roms_$1\.in")   (change visibility)
m (Text replacement - "\.in" to ".in")   (change visibility)
Line 7: Line 7:
# Edit <span class="red">build.sh</span> to specify: <div class="box"><span class="red">MY_ROMS_APPLICATION</span>  [[LAKE_SIGNELL]]<br /><span class="red">MY_ROMS_SRC</span>          /home/rsignell/models/roms_rutgers/trunk<br/><span class="red">MY_PROJECT_DIR</span>      /home/rsignell/projects/test1</div>and set which compiler I want to use (e.g. '''pgi''', '''ifort''') 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 <span class="red">USE_MPIF90</span> '''on''' as well as '''pgi'''.
# Edit <span class="red">build.sh</span> to specify: <div class="box"><span class="red">MY_ROMS_APPLICATION</span>  [[LAKE_SIGNELL]]<br /><span class="red">MY_ROMS_SRC</span>          /home/rsignell/models/roms_rutgers/trunk<br/><span class="red">MY_PROJECT_DIR</span>      /home/rsignell/projects/test1</div>and set which compiler I want to use (e.g. '''pgi''', '''ifort''') 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 <span class="red">USE_MPIF90</span> '''on''' as well as '''pgi'''.
# Compile. Run the <span class="red">build.sh</span> 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: <div class="box"><span class="red">./build.sh -j 2</span></div>
# Compile. Run the <span class="red">build.sh</span> 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: <div class="box"><span class="red">./build.sh -j 2</span></div>
# 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 | LAKE_SIGNELL]] case.  We also want a copy of [[varinfo.dat]], which defines NetCDF metadata parameters. <div class="box">'''cp''' <span class="twilightBlue">~/models/roms_rutgers/trunk/ROMS/External/{*lake_signell*.in,varinfo.dat} ~/projects/test1</span></div>I then need to modify <span class="twilightBlue">roms_lake_signell\.in</span> to point to the local directory to find [[varinfo.dat]], <span class="twilightBlue">floats_lake_signell.in</span> and <span class="twilightBlue">sediment_lake_signell.in</span>.<br />I can also edit <span class="twilightBlue">roms_lake_signell\.in</span> 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. <br /><br />If you are lazy and don't want to make all these edits and just want to try it out, you can get<div class="box">http://stellwagen.er.usgs.gov/rps/share/lake_signell.tar.gz</div>and just edit these two lines (and perhaps the compiler options) in the <span class="red">build.sh</span> script<div class="box"><span class="red">MY_ROMS_SRC</span>          /home/rsignell/models/roms_rutgers/trunk<br /><span class="red">MY_PROJECT_DIR</span>      /home/rsignell/projects/test1</div>
# 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 | LAKE_SIGNELL]] case.  We also want a copy of [[varinfo.dat]], which defines NetCDF metadata parameters. <div class="box">'''cp''' <span class="twilightBlue">~/models/roms_rutgers/trunk/ROMS/External/{*lake_signell*.in,varinfo.dat} ~/projects/test1</span></div>I then need to modify <span class="twilightBlue">roms_lake_signell.in</span> to point to the local directory to find [[varinfo.dat]], <span class="twilightBlue">floats_lake_signell.in</span> and <span class="twilightBlue">sediment_lake_signell.in</span>.<br />I can also edit <span class="twilightBlue">roms_lake_signell.in</span> 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. <br /><br />If you are lazy and don't want to make all these edits and just want to try it out, you can get<div class="box">http://stellwagen.er.usgs.gov/rps/share/lake_signell.tar.gz</div>and just edit these two lines (and perhaps the compiler options) in the <span class="red">build.sh</span> script<div class="box"><span class="red">MY_ROMS_SRC</span>          /home/rsignell/models/roms_rutgers/trunk<br /><span class="red">MY_PROJECT_DIR</span>      /home/rsignell/projects/test1</div>
# Run <div class="box">'''./oceanS''' < roms_lake_signell\.in > & log &                              (Serial)<br />'''./oceanO''' < roms_lake_signell\.in > & log &                              (OpenMP)<br />'''mpirun''' -n 4 -hostfile node_file '''./oceanM''' roms_lake_signell\.in & log &  (MPI)</div>
# Run <div class="box">'''./oceanS''' < roms_lake_signell.in > & log &                              (Serial)<br />'''./oceanO''' < roms_lake_signell.in > & log &                              (OpenMP)<br />'''mpirun''' -n 4 -hostfile node_file '''./oceanM''' roms_lake_signell.in & log &  (MPI)</div>
# Check out the results<div class"box">[[ncview]] '''ocean_his.nc'''</div>
# Check out the results<div class"box">[[ncview]] '''ocean_his.nc'''</div>

Revision as of 17:35, 8 January 2021

Rsignell 17:31, 18 June 2007 (UTC)


Here is an example of using the build.sh 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.sh script (which you will find in ROMS/Bin sub-directory) to your project directory.
  3. Edit build.sh 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. pgi, ifort) 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.sh 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.sh -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.sh script
    MY_ROMS_SRC /home/rsignell/models/roms_rutgers/trunk
    MY_PROJECT_DIR /home/rsignell/projects/test1
  6. Run
    ./oceanS < roms_lake_signell.in > & log & (Serial)
    ./oceanO < roms_lake_signell.in > & log & (OpenMP)
    mpirun -n 4 -hostfile node_file ./oceanM roms_lake_signell.in & log & (MPI)
  7. Check out the results
    ncview ocean_his.nc