Welcome to the North Park University Physics and Engineering Department

Physics and Engineering: Compiling CCSM 3.0 on Ubuntu Linux

Introduction

This is a brief tutorial on getting CCSM 3.0 to compile on Ubuntu Linux using the Intel Fortran Compiler. This This work was carried out during 2007–2008 at North Park University on a Dell Poweredge with 4 processors, running Ubuntu 7.04.

Before beginning, it is recommmended that you read through the first few sections of the CCSM 3.0 user guide.

Downloading the Source

Here are the list of files needed:

The following input data:

A compiler:

MPI:

Untarring

The first thing that needs to be done is to untar the CCSM source code using the following command.

tar -xf ccsm3.0.tar.gz

Do the same with the input data tarballs:

For installing IFC see our tutorial here. For installing MPICH, simply follow the directions given in the README. The only change that needs to be made is that the make command must be run as root. That is sudo make ....

Changes for Linux

There are a number of things that must be done before CCSM 3.0 will compile on Linux. (Note: At this point, all the source code and input data should be untarred, and the Intel Fortran Compiler should be installed.)

First, there is an issue in the file batch.linux.generic_linux. Inside the root CCSM directory:

  • cd script/ccsm_utils/Machine/
  • vim batch.linux.generic_linux

On line 3 change:

mach = anchorage

to

mach = generic_linux

At this point we can now create a new case (read the user guide for more info on this). Go to the scripts directory:

  • cd scripts/
  • ./create_newcase –case FULLPATH/ccsm3_0/newcase –mach generic_linux
    (Be sure to put in the complete path. the directory newcase should not exist before running this script.)

A bunch of files are now created in the location you just specificed (.../ccsm3_0/newcase in this example). The following needs to be changed in the file env_mach.generic_linux in that directory:

  • cd ../newcase
  • vim env_mach.generic_linux
  • On about line 94 (before setenv EXEROOT) add the following lines of code:
    setenv LIB_NETCDF /opt/netcdf/lib
    setenv INC_NETCDF /opt/netcdf/include
    setenv INC_MPI /opt/mpich2/include
    setenv SCRATCH /home/sysadmin/Desktop/ccsm3_0/scratch

The paths given here are for my personal installations. Be sure to change those to libraries and include paths of your installations. Note: the scratch directory can be anywhere.

The follow variables need to be changed:

setenv DOUT_S_ROOT /$SCRATCH/$LOGNAME/archive/$CASE
setenv DOUT_LOC_ROOT [FULLPATH]/inputdata
setenv DOUT_LOC_USER [FULLPATH]/inputdata_user

Where FULLPATH is the complete path to the directory that contains inpudata and inputdata_user (these are directories untarred from the input data).

The commands for the compilers must be set. To do this, go to your CCSM root directory:

  • cd /models/utils/esmf/build/linux_pqi/
  • vim base_variables

Change:

  • pgcc to gcc
  • pgCC to gcc
  • pgf90 to ifort

And all instances of –V to -v.

Some of the Fortran flags need to be changed in order to work with IFC. From the CCSM root directory:

vim /models/bld/Macros.Linux

Change:

  • -recursive to –Mrecursive
  • -free to -Mfree
  • -align dcommons to -Mdalign
  • -extend_source 132 to -Mextend
  • -fltconsistency to -Kieee

This concludes all the changes that need to be made. newcase-generic_linux.build should compile correctly.

Other Notes

CCSM is very complex, there are many things that can go wrong. If CCSM does not compile for you, always check the error logs for hints of whats gone wrong. One common and easy to fix problem is that the include or library directories are incorrect. So be sure that they are all written correctly.

The CCSM forums can be very helpful. Be sure to use the search function before posting.

While I was able to compile CCSM without error, I was unable to run it correctly. It would always hang when the coupler started. I have a feeling it was some issue with MPI, but I am unsure. However, this guide should hopefully get CCSM to compile, which is an important first step.

Author: Jonathan Nehring, with editing by Johnny Lin. Updated: Monday, 12-May-2008 17:05:05 PDT. Valid CSS, HTML. This work is licensed under a Creative Commons Attribution-Noncommercial-ShareAlike 3.0 License.