Contents
1. Install Pre-requisites
1.1 zlib
1.2 hdf5
1.3 netcdf
2. Build , install and test CESM-1.0.2
3. Known errors and solutions
4. References
1. Install Pre-requisites
Below are the additional software which are required to compile and build CESM-1.0.2 with Hdf5 .
1.1 zlib installation
1.1.1 untar the zip file
1.1.2 Read the comment section of Makefile.in
1.1.3 Export environment variables
export CC=pgcc
export FC=pgf90
export CFLAGS=”-m64 ”
export FFLAGS=”-m64″
1.1.4 ./configure –prefix=<config-path>
1.1.5 make install prefix=<install-path>
1.2. hdf5-1.8.11 installation
1.2.1 Download and untar
1.2.2 Export environment variables
export CC=pgcc
export FC=pgf90
export LDFLAGS=-L/opt/intel/impi/4.1.0.024/lib64
export LIBS=”-lmpi -lmpigf”
export CPPFLAGS=” -m64 -I/opt/intel/impi/4.1.0.024/include64″
export CFLAGS=” -m64 -I/opt/intel/impi/4.1.0.024/include64″
export FFLAGS=”-m64 -I/opt/intel/impi/4.1.0.024/include64″
export FCFLAGS=”-m64 -I/opt/intel/impi/4.1.0.024/include64″
export CXXFLAGS=”-m64 -I/opt/intel/impi/4.1.0.024/include64″
1.2.3 configure
./configure –prefix=/home/internal/sysadmin/anisha/software/lib/hdf5_1_8_11 –enable-parallel –with-zlib=/home/internal/sysadmin/anisha/software/lib/zlib_1_2_8
2.4 make install
1.3. netcdf-4.1.3 Installation
1.3.1 Download and untar
1.3.2 Export environment variables
export CC=pgcc
export FC=pgf90
export LDFLAGS=-L/opt/intel/impi/4.1.0.024/lib64
export LIBS=”-L/opt/intel/impi/4.1.0.024/lib64 -lmpi -lmpigf -L<path-to-zlib/lib>
-L<path-to-hdf5/lib>”
export CPPFLAGS=” -m64 -I/opt/intel/impi/4.1.0.024/include64
-I<path-tozlib/include> -I<path-to-hdf5/include>”
export CFLAGS=” -m64 -I/opt/intel/impi/4.1.0.024/include64
-I<path-tozlib/include> -I<path-to-hdf5/include>”
export FFLAGS=”-m64 -I/opt/intel/impi/4.1.0.024/include64
-I<path-tozlib/include> -I<path-to-hdf5/include>”
export FCFLAGS=”-m64 -I/opt/intel/impi/4.1.0.024/include64
-I<path-tozlib/include> -I<path-to-hdf5/include>”
export CXXFLAGS=” -m64 -I/opt/intel/impi/4.1.0.024/include64
-DMPICH_IGNORE_CXX_SEEK -I<path-tozlib/include> -I<path-to-hdf5/include>”
1.3.3 Configure
./configure –prefix=/opt/app/CESM/lib/netcdf_4.1.3 –enable-netcdf4 –enable-shared=no –with-libcf –disable-dap
1.3.4 make install
2.Build , install and test CESM-1.0.2
2.1 Create , build and execute new case
2.1.1 Use below command to set pgi compilers in PATH , if not in $PATH
source /opt/pgi/env.sh
2.1.2 Configure a new case
$ /opt/app/CESM/cesm1_0_2/scripts/create_newcase -case $HOME/test_F_f19_f19 -res f19_f19 -compset F_2000 -mach generic_linux_pgi -scratchroot $HOME/cesm-scratch -din_loc_root_csmdata $HOME/inputdata -max_tasks_per_node 4
2.1.3 Change the directory to case directory
cd $HOME/test_F_f19_f19
2.1.4 Modify files to build case
- Macro.<machine-name>
- Tools/Makefile
- In Macro.<machine-name> do the following modification
– Modify compilers
FC :=pgf90
CC :=pgcc
– Add following lines after CC :=pgcc line
HDF5_PATH=/opt/app/CESM/lib/hdf5_1.8.11
INC_HDF5=-I$(HDF5_PATH)/include
LIB_HDF5=-L$(HDF5_PATH)/lib
ZLIB_PATH=/opt/app/CESM/lib/zlib_1.2.8
INC_ZLIB=-I$(ZLIB_PATH)/include
LIB_ZLIB=-L$(ZLIB_PATH)/lib
– Set MPI and netcdf PATH
NETCDF_PATH := /opt/app/CESM/lib/netcdf_4.1.3
INC_NETCDF := $(NETCDF_PATH)/include
LIB_NETCDF := $(NETCDF_PATH)/lib $(LIB_HDF5) $(LIB_ZLIB)
MOD_NETCDF := $(NETCDF_PATH)/include
MPICH_PATH := /opt/intel/impi/4.1.0.024
INC_MPI := $(MPICH_PATH)/include64
LIB_MPI := $(MPICH_PATH)/lib64
MPI_LIB_NAME :=mpi -lmpigf
– Set mct and pio configuration parameters, replace the mct and pio CONFIG_ARGS
values with below mention parameters
ifeq ($(MODEL),mct)
#add arguments for mct configure here
CONFIG_ARGS+= FC=”$(FC)” F90=”$(FC)” FFLAGS=”$(FFLAGS)” CC=”$(CC)” MPIF90=”$(FC)” MPIHEADER=”-I $(INC_MPI)” MPILIBS=”-L$(LIB_MPI) -l$(MPI_LIB_NAME)” –host=Linux
endif
ifeq ($(MODEL),pio)
ifneq ($(strip $(PIO_CONFIG_OPTS)),)
CONFIG_ARGS += $(PIO_CONFIG_OPTS)
endif
CONFIG_ARGS += FC=”$(FC)” F90=”$(FC)” FFLAGS=”$(FFLAGS)” CC=”$(CC)” MPIF90=”$(FC)” MPICC=”$(CC)” MPI_INC=”-I$(INC_MPI)” MPI_LIB=”-L$(LIB_MPI) -l$(MPI_LIB_NAME)” NETCDF_PATH=”$(NETCDF_PATH)” PNETCDF_PATH=$(PNETCDF_PATH) –with-hdf5=”$(HDF5_PATH)” –with-zlib=”$(ZLIB_PATH)” –enable-netcdf=no –enable-netcdf4=yes –enable-mpiio=yes –enable-mpi2=yes
endif
- Modify Tools/Makefile
Replace -lnetcdf to -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz at line number 113, 115 and 216. These lines should look like below provided lines after modification
113 SLIBS := -L$(LIB_NETCDF) -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
115 SLIBS += -L$(LIB_NETCDF) -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
216 $(LD) -o $@ test_nc.o -L$(LIB_NETCDF) -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz $(LDFLAGS)
2.1.5 Configure the case
./configure -case
2.1.6 Build the executable(case)
./test_F_f19_f19.generic_linux_pgi.build
2.1.7 To run the case Modify the file test_F_f19_f19.generic_linux_pgi.run
Uncomment and modify the below lines as per your requirement
9 ##PBS -N test_F_f19_f19
10 ##PBS -q batch
11 ##PBS -l nodes=16:ppn=4
12 ##PBS -l walltime=00:59:00
13 ##PBS -r n
14 ##PBS -j oe
15 ##PBS -S /bin/csh -V
108 #mpirun -np 64 ./ccsm.exe >&! ccsm.log.$LID
2.1.8 After the modification use below command to run
qsub test_F_f19_f19.generic_linux_pgi.run
2.1.9 Verify run
When the job is complete, review the following directories and files
a. $RUNDIR. This directory is set in the env_build.xml file. This is the location where CESM was run. There should be log files there for every component (i.e. of the form cpl.log.yymmdd-hhmmss). Each component writes its own log file. Also see whether any restart or history files were written. To check that a run completed successfully, check the last several lines of the cpl.log file for the string ” SUCCESSFUL TERMINATION OF CPL7-CCSM”.
b. $CASEROOT/logs. The log files should have been copied into this directory if the run completed successfully.
c. $CASEROOT. There could be a standard out and/or standard error file.
d. $CASEROOT/CaseDocs. The case namelist files are copied into this directory from the $RUNDIR.
e. $CASEROOT/timing. There should be a couple of timing files there that summarize the model performance.
f. $DOUT_S_ROOT/$CASE. This is the archive directory. If DOUT_S is FALSE, then no archive directory should exist. If DOUT_S is TRUE, then log, history, and restart files should have
2.1.10 Porting
for porting refer chapter 7 ” Porting CESM ” of CESM user guide.
3. Known errors and solutions
3.1 Error : rm : No match
Solution : This message is because you are running the model first time.
3.2 Error : Model did not complete – no cpl.log file present – exiting.
Solution: You are running the model first time and you changed the number of processes mention in the <test-case>.<mach>.run file. Do not modify the default number of processes and just uncomment the required lines (at least mpirun line to execute on a single host).
3.3 Error :undefined reference to `H5Dclose’
Solution : If you are using netcdf with hdf5 then the linking with netcdf and hdf5 should be in order . Below is the order
-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
3.4 Error : co2_cycle.F90:(.data+0x7a8): undefined reference to `typesizes_’
co2_cycle.F90:(.data+0x7b0): undefined reference to `netcdf_’
Solution : Link with the library -lnetcdff also. Add the below flags in Tools/Makefile in same sequence given below
-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
3.5 Error : Application terminated by signal 11 (illegal instruction)
Solution: Check for the compiler which is used to compile the CESM-1.0.2, is build for the architecture on which you are trying to execute . Also check for the architecture specific compiler flags , if used remove those flags and rebuild.
In my case pgi compilers are build for target processor sandybridge (checked with pgcc –version) thats why terminating with the mentioned error while trying to execute on old processor.
4. References
4.1. Linking netcdf4 & hdf5 http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Quick-Instructions.html
4.2. Netcdf download
http://www.unidata.ucar.edu/downloads/netcdf/netcdf-4_0/index.jsp
4.3 Zlib download http://www.zlib.net/
4.4 Hdf5 download http://www.hdfgroup.org/HDF5/release/obtain5.html
4.5 Netcdf4p option setting https://github.com/yongqiangyu/FGOALS/blob/master/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml
4.6 CPL7 does not support netcdf4p and netcdf4c optionshttp://www.cesm.ucar.edu/models/ccsm4.0/cpl7/ug.pdf
4.7 https://github.com/LICOMGroup/FGOALS/blob/master/drv/bld/cpl.template
4.8https://github.com/yongqiangyu/FGOALS/blob/master/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml 4.9 CESM http://www.cesm.ucar.edu/models/cesm1.0/
4.10 CESM 1.2.0 user guide
http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html