Although you could just work within the source code distribution
using the Makefile, it's cleaner and will be better for you in the
future if you learn to use the build.sh
script that allows you to
leave the source code directory unmodified, and have all the project
specific stuff in project directories. Here's how it works:
- 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
- Checkout the source code using SVN (or unpack the source code if
you grabbed my tarfile) and copy the build.sh
script (which you will
find in ./ROMS/Bin
subdirectory) to your project directory.
- Edit
build.sh
I 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
.
- 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:
./build.sh -j 2
- Set up the input files for the run
ROMS uses an ASCII input file 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 file for the LAKE_SIGNELL
case. We also want a copy of
varinfo.dat
, which defines NetCDF parameters.
cp ~/models/ROMS/External/{ocean_lake_signell.in,varinfo.dat} ~/projects/test1
- Run.
./oceanS < ocean_lake_signell.in
(Serial)
./oceanO < ocean_lake_signell.in
(OpenMP)
mpirun -n 16 -hostfile node_file ./oceanM lake_signell.in
(MPI)