Difference between revisions of "CISM exercise I: build model"

From Interactive System for Ice sheet Simulation
Jump to: navigation, search
(Building CISM)
(Building CISM)
Line 7: Line 7:
 
Because we are currently working on readying Glimmer-CISM-2.0 for release, the most recent publicly available version on the code does not contain many recent updates that we would like to take advantage of in this coarse. For that reason, we will be working from an intermediate version of the code:
 
Because we are currently working on readying Glimmer-CISM-2.0 for release, the most recent publicly available version on the code does not contain many recent updates that we would like to take advantage of in this coarse. For that reason, we will be working from an intermediate version of the code:
  
:[[media:CISM-BNU-3-2011.tar.gz]]
+
:[http://where-is-the-code/CISM-BNU-3-2011.tar.gz CISM-BNU-3-2011.tar.gz]
  
 
Click on the link above and save the tarball to your own CISM directory. To unpack the tarball, type
 
Click on the link above and save the tarball to your own CISM directory. To unpack the tarball, type
Line 17: Line 17:
 
  cd CISM-BNU-3-2011
 
  cd CISM-BNU-3-2011
  
CISM uses autotools to build the code. We will need to tell the configure script where to look to find the necessary NetCDF library and the compiler that we want to use to build the code:
+
CISM uses autotools to build the code. First, we need to build the build system by typing
  
  ./configure --prefix=$HOME/installs/glimmer-1.0.18 --with-netcdf=$HOME/installs/netcdf-4.0.1 FC=gfortran F77=gfortran
+
  ./bootstrap
  
Now, we can run ''make'' and ''make install'', as before. Glimmer takes a while to build, but when it's finished you can look in ''~/installs/glimmer-1.0.18/bin'' to find the executables, and ''~/installs/glimmer-1.0.18/lib'' to see the libraries which have been built.
+
Next, we need to tell the configure script where to build the code, where to look to find the necessary NetCDF libraries, and which fortran compiler we want to use to build the code:
  
The final step is to add the location of the Glimmer executables to your path variable, which we do in the same way as before:
+
./configure --prefix=/path-where-you-want-build-CISM --with-netcdf=/path-to-netCDF-library FC=gfortran F77=gfortran
  
export PATH=$PATH:$HOME/installs/glimmer-1.0.18/bin
+
Check to make sure that the configuration step was successful with
  
And of course we can add this to our ''.bashrc'' file as well.
+
tail config.log
 +
 
 +
If you see 'configure: exit 0' as the final line then configure was successful. Now, we type
 +
 
 +
make; make install
 +
 
 +
to first compile the various pieces of code and then build the model in the installation directory that you specified in when you ran configure. Note that if you simply want to build the code in the same directory where it was untarred you can simply do
 +
 
 +
./bootstrap
 +
./configure --with-netcdf=/path-to-netCDF-library FC=gfortran F77=gfortran
 +
make
 +
 
 +
The code will take a while to build. When it is done, and assuming you haven't seen any obvious errors, you can confirm a successful build by checking in the ''example-drivers/simple_glide/src/'' directory. If there is an executable file there called ''simple_glide'', then your build was successful. This is the executable we will use to run the various test cases uses the higher-order dynamics version of the model.

Revision as of 13:42, 12 March 2011

Building CISM

The first step is to acquire the model code. In common with many open-source projects, there are regular releases of CISM — these are numbered snapshots of the code and represent stable versions of the model (relative to development versions of the code on the repository). The latest release can be downloaded from the CISM website[1]:

http://developer.berlios.de/projects/glimmer-cism

Because we are currently working on readying Glimmer-CISM-2.0 for release, the most recent publicly available version on the code does not contain many recent updates that we would like to take advantage of in this coarse. For that reason, we will be working from an intermediate version of the code:

CISM-BNU-3-2011.tar.gz

Click on the link above and save the tarball to your own CISM directory. To unpack the tarball, type

tar -xzvf CISM-BNU-3-2011.tar.gz

To build the code, you need to first cd into the correct directory

cd CISM-BNU-3-2011

CISM uses autotools to build the code. First, we need to build the build system by typing

./bootstrap

Next, we need to tell the configure script where to build the code, where to look to find the necessary NetCDF libraries, and which fortran compiler we want to use to build the code:

./configure --prefix=/path-where-you-want-build-CISM --with-netcdf=/path-to-netCDF-library FC=gfortran F77=gfortran

Check to make sure that the configuration step was successful with

tail config.log

If you see 'configure: exit 0' as the final line then configure was successful. Now, we type

make; make install

to first compile the various pieces of code and then build the model in the installation directory that you specified in when you ran configure. Note that if you simply want to build the code in the same directory where it was untarred you can simply do

./bootstrap
./configure --with-netcdf=/path-to-netCDF-library FC=gfortran F77=gfortran
make

The code will take a while to build. When it is done, and assuming you haven't seen any obvious errors, you can confirm a successful build by checking in the example-drivers/simple_glide/src/ directory. If there is an executable file there called simple_glide, then your build was successful. This is the executable we will use to run the various test cases uses the higher-order dynamics version of the model.
Cite error: <ref> tags exist, but no <references/> tag was found