WikiPrint - from Polar Technologies

Compile


The compiling steps are described in this chapter.


1. Compiling environment

First of all, make sure that your working environment contains all the necessary compiling tools. To this end, see the chapter Computing environments

1.1. FCM

Most of IPSL models and components use the fcm tool for compiling. Recent versions of the models have fcm in their source directory. Therefor no specific installation is needed anymore.

If no fcm is available in the source directory, then fcm must then be installed and added to your environemental variable PATH. At following machines, fcm is already installed

# At TGCC: 
PATH=~p86ipsl/fcm/bin:$PATH

# At IDRIS: 
PATH=/smphome/rech/psl/rpsl035/FCM/bin:$PATH

# At LSCE(obelix):
PATH=/home/orchideeshare/igcmg/fcm/FCM_V1.2/bin:$PATH

For other machines, extract fcm from svn and add the path to your environement variable PATH. Extract as follow:

svn co  http://forge.ipsl.jussieu.fr/fcm/svn/PATCHED/FCM_V1.2 fcm 

For each machine supported by the IPSL tools, two kinds of files *.fcm and *.path exist. They provide all the information needed by fcm to create a makefile. These files are stored in the directory arch/ (LMDZ/arch/, INCA/arch/).

These files have the name of the machine as a prefix : arch-X64_CURIE.fcm, arch-X64_CURIE.path

2. Creating the main makefile

Note : The compilation of ORCHIDEE_OL and NEMO requires a few special steps. For example, the main Makefile is located in another directory. Read this chapter and the chapter on special cases for ORCHIDEE_OL and for NEMO.

Each model configuration has a main makefile which provides information about each model component's makefiles. The main Makefile is stored in the modipsl/config/XXXX directory. The main Makefile is created when a model configuration is downloaded and installed.

Example :

cd modipsl/util
./model LMDZOR_v5 
(...)
Makefiles setup, scripts and data for ada

Installation in ../config/LMDZOR_v5
Path from Makefile to modipsl/util : ../../util
Installation in ../modeles/IOIPSL/src
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE/src_global
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE/src_parameters
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE/src_parallel
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE/src_stomate
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE/src_sechiba
Path from Makefile to modipsl/util : ../../../util
Installation in ../modeles/ORCHIDEE
Path from Makefile to modipsl/util : ../../util

You can recreate those Makefiles by running the ins_make script. You have to do this if, for example, you changed the path of modipsl.

cd modipsl/util/
./ins_make

The main Makefile is created by concatenating the following 3 items: AA_make.ldef and AA_make located in the directory where the main Makefile will be created, and the lines corresponding explicitly to the target machine of the util/AA_make.gdef file. For each predefined machine the util/AA_make.gdef file contains the compiler settings. If your machine is not included, you can choose a target among the predefined machines in AA_make.gdef or you can add a new one.

vi AA_make.gdef

(...)
#-Q- ada
(...) 
#-Q- curie
(...) 
#-Q- aix6
(...) 
#-Q- gfortran
(...)

In this case, the script becomes

./ins_make -t cible

3. The main makefile

The Makefile is available for different resolutions. Example with LMDZOR_v5 :

LMD4443 : libioipsl liborchidee lmdz44x43x19 verif     
        echo "noORCAxLMD4443" >.resol
        echo "RESOL_ATM_3D=44x43x19" >>.resol

LMD5655 : libioipsl liborchidee lmdz56x55x19 verif     
        echo "noORCAxLMD5655" >.resol
        echo "RESOL_ATM_3D=56x55x19" >>.resol

LMD9671 : libioipsl liborchidee lmdz96x71x19 verif     
        echo "noORCAxLMD9671" >.resol
        echo "RESOL_ATM_3D=96x71x19" >>.resol

LMD9695 : libioipsl liborchidee lmdz96x95x19 verif
        echo "noORCAxLMD9695" >.resol
        echo "RESOL_ATM_3D=96x95x19" >>.resol

LMD9695-L39 : libioipsl liborchidee lmdz96x95x39 verif
        echo "noORCAxLMD9695-L39" >.resol
        echo "RESOL_ATM_3D=96x95x39" >>.resol

LMD144142 : libioipsl liborchidee lmdz144x142x19 verif
        echo "noORCAxLMD144142" >.resol
        echo "RESOL_ATM_3D=144x142x19" >>.resol

LMD144142-L39 : libioipsl liborchidee lmdz144x142x39 verif
        echo "noORCAxLMD144142-L39" >.resol
        echo "RESOL_ATM_3D=144x142x39" >>.resol

Available resolutions are :

Another feature of the Makefile is ability to compile any model with the chosen resolution.

For _v5 configurations, the default resolution is 96x95x39.

4. How to compile?

Once you chose a resolution you can start compiling:

gmake ma_resolution

For the default resolution gmake is fine. Example for LMDZOR_v5:

cd modipsl/config/LMDZOR_v5
gmake LMD144142-L39

The hidden file .resol is created when compiling was successful. This file contains information about the resolution you have just compiled. This file will be used later when setting up the simulation, in particular to locate the input files.
Going back to the previous example, the .resol file looks as follows :

ORCAxLMD144142-L39
RESOL_ATM_3D=144x142x39

Once the file .resol is created, you can recompile your configuration using the gmake script without specifying the resolution.

5. How to optimize the compilation

Example: to compile LMDZ you can add the keyword "-debug" :

(cd ../../modeles/LMDZ; ./makelmdz_fcm (...) -debug (...) -arch $(FCM_ARCH) gcm ; cp bin/gcm_$(RESOL_LMDZ)_phylmd_para_orch.e ../../bin/gcm.e ; )

The default option is -prod