Home Contact Us Site Map  
 
       
    next up previous contents
Next: 3.4.2 Using genmake2 Up: 3.4 Building MITgcm Previous: 3.4 Building MITgcm   Contents

Subsections

3.4.1 Building/compiling the code elsewhere

In the example above (section 3.4) we built the executable in the input directory of the experiment for convenience. You can also configure and compile the code in other locations, for example on a scratch disk with out having to copy the entire source tree. The only requirement to do so is you have genmake2 in your path or you know the absolute path to genmake2.

The following sections outline some possible methods of organizing your source and data.

3.4.1.1 Building from the ../code directory

This is just as simple as building in the input/ directory:

% cd verification/exp2/code
% ../../../tools/genmake2
% make depend
% make
However, to run the model the executable (mitgcmuv) and input files must be in the same place. If you only have one calculation to make:
% cd ../input
% cp ../code/mitgcmuv ./
% ./mitgcmuv > output.txt
or if you will be making multiple runs with the same executable:
% cd ../
% cp -r input run1
% cp code/mitgcmuv run1
% cd run1
% ./mitgcmuv > output.txt

3.4.1.2 Building from a new directory

Since the input directory contains input files it is often more useful to keep input pristine and build in a new directory within verification/exp2/:

% cd verification/exp2
% mkdir build
% cd build
% ../../../tools/genmake2 -mods=../code
% make depend
% make
This builds the code exactly as before but this time you need to copy either the executable or the input files or both in order to run the model. For example,
% cp ../input/* ./
% ./mitgcmuv > output.txt
or if you tend to make multiple runs with the same executable then running in a new directory each time might be more appropriate:
% cd ../
% mkdir run1
% cp build/mitgcmuv run1/
% cp input/* run1/
% cd run1
% ./mitgcmuv > output.txt

3.4.1.3 Building on a scratch disk

Model object files and output data can use up large amounts of disk space so it is often the case that you will be operating on a large scratch disk. Assuming the model source is in  /MITgcm then the following commands will build the model in /scratch/exp2-run1:

% cd /scratch/exp2-run1
% ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \
  -mods=~/MITgcm/verification/exp2/code
% make depend
% make
To run the model here, you'll need the input files:
% cp ~/MITgcm/verification/exp2/input/* ./
% ./mitgcmuv > output.txt

As before, you could build in one directory and make multiple runs of the one experiment:

% cd /scratch/exp2
% mkdir build
% cd build
% ~/MITgcm/tools/genmake2 -rootdir=~/MITgcm \
  -mods=~/MITgcm/verification/exp2/code
% make depend
% make
% cd ../
% cp -r ~/MITgcm/verification/exp2/input run2
% cd run2
% ./mitgcmuv > output.txt


next up previous contents
Next: 3.4.2 Using genmake2 Up: 3.4 Building MITgcm Previous: 3.4 Building MITgcm   Contents
mitgcm-support@mitgcm.org
Copyright © 2006 Massachusetts Institute of Technology Last update 2011-01-09