wiki:Doc/Compile

Version 28 (modified by cetlod, 4 years ago) (diff)

--

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. Therefore no specific installation is needed anymore.

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

# At TGCC: 
PATH=`ccc_home -u igcmg`/Tools/fcm/bin:$PATH

# At IDRIS: 
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 environment 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, 3 kinds of files *.fcm, *.path, and .env 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/).

  • *.fcm : contains the compiler information
    • compiler name
    • compiling options
    • options and settings
  • *.path : contains the library path names.
  • *.env : contains module to be load to install properly the environment for the compilation of this model.

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

Note : for configurations IPSLCM, arch files for OASIS and NEMO are taken in modipsl/config/IPSLCM*/SOURCE/OASIS and modipsl/config/IPSLCM6/SOURCE/NEMO

2. Compilation for configurations _v6 and _v6.1.*

2.1. Creating the main makefile

Each model configuration XXX 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_v6.1.10
(...)
Makefiles setup, scripts and data for irene

Installation in ../config/LMDZOR_v6
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- jeanzay
(...) 
#-Q- irene
(...) 
#-Q- aix6
(...) 
#-Q- gfortran
(...)

In this case, the script becomes

./ins_make -t target

2.2. The main makefile

The Makefile is available for different resolutions. Example with LMDZOR_v6.1.10 :

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

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

LMD9695 : libioipsl xios liborchidee lmdz96x95x19 verif
        echo "noORCAxLMD9695" >.resol
        echo "RESOL_ATM_3D=96x95x19" >>.resol
	
LMD9695-L39 : libioipsl xios liborchidee lmdz96x95x39 verif
        echo "noORCAxLMD9695-L39" >.resol
        echo "RESOL_ATM_3D=96x95x39" >>.resol
	
LMD9695-L79 : libioipsl xios liborchidee lmdz96x95x79 verif
        echo "noORCAxLMD9695-L79" >.resol
        echo "RESOL_ATM_3D=96x95x79" >>.resol
	
LMD128118-L39 : libioipsl xios liborchidee lmdz128x118x39 verif
        echo "noORCAxLMD128118-L39" >.resol
        echo "RESOL_ATM_3D=128x118x39" >>.resol
	
LMD144142 : libioipsl xios liborchidee lmdz144x142x19 verif
        echo "noORCAxLMD144142" >.resol
        echo "RESOL_ATM_3D=144x142x19" >>.resol

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

LMD144142-L59 : libioipsl xios liborchidee lmdz144x142x59 verif
        echo "noORCAxLMD144142-L59" >.resol
        echo "RESOL_ATM_3D=144x142x59" >>.resol

LMD144142-L79 : libioipsl xios liborchidee lmdz144x142x79 verif
        echo "noORCAxLMD144142-L79" >.resol
        echo "RESOL_ATM_3D=144x142x79" >>.resol
	
LMD512360-L79 : libioipsl xios liborchidee lmdz512x360x79 verif
        echo "noORCAxLMD512360-L79" >.resol
        echo "RESOL_ATM_3D=512x360x79" >>.resol
	

Available resolutions are :

  • LMD5655
  • LMD9671
  • LMD9695
  • LMD9695-L39
  • LMD9695-L79
  • LMD128118-L39
  • LMD144142
  • LMD144142-L39
  • LMD144142-L59
  • LMD144142-L79
  • LMD512360-L79

2.3. How to compile?

Once you chose a resolution you can start compiling:

gmake my_resolution

Example for LMDZOR_v6.1.10:

cd modipsl/config/LMDZOR_v6
gmake LMD144142-L79

An 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 :

noORCAxLMD144142-L79
RESOL_ATM_3D=144x142x79

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

For ORCHIDEE_OL, the resolution is not specified during run time. Use only gmaketo compile. The file .resol will not be created.

2.4. How to change compile options for debugging or optimization of the model?

  • You can change your optimization options for IOIPSL models in the AA_make.gdef file. To this end you must find your target machine and change the associated lines. You will have to recreate the Makefile.
  • Three levels of optimization for the ORCHIDEE, INCA and LMDZ models are predefined in the arch/files.You need to write them in the modipsl/config/.../Makefile file. The three options are: -debug, -dev, -prod. XIOS offers the same three levels of compilations, accessible through the flags --debug, --dev and prod.


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

3. Compilation for configurations _v6.2 and newer configurations

The compilation slightly differs from what has been done so far. Now we use a script compile_ipslcm6.sh with several options ( resolution, level of optimisation, full or partial recompilation ) to compile the model. It is necessary to set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement.

########################################################################
# Usage of the script compile_ipslcm6.sh
#
########################################################################

./compile_ipslcm6.sh [Options] 


Options: [LR / VLR / MR1 / MR025] Model resolution, choose only one. Default: LR.
         [ESMCO2] Compile IPSLCM6 for CO2 interactif ocean/atmosphere.
         [ESMAER] Compile IPSLCM6 for AER interactif on atmosphere
         [-full] Full recompilation of all components. This option can be added to all other options.
         [-cleannemo] Full recompilation of NEMO component  only.
         [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod.


Example 1: Default compilation of IPSLCM6 for resoltion LR 
          (Resolution atmos: 144x142x79, ocean: ORCA1)
./compile_ipslcm6.sh

Example 2: Compilation of IPSLCM6 for resolution MR025
           (atmos: 256x256x79, ocean: ORCA025, NOPISCES)
./compile_ipslcm6.sh MR025

Example 3: Compilation of IPSLCM6 for ESM CO2
./compile_ipslcm6.sh ESMCO2 -cleannemo

Example 4: Default resoltuion (LR) compiled in debug mode
./compile_ipslcm6.sh -debug

Example 5: Default compilation with full recompilation of all components. No clean is needed.
./compile_ipslcm6.sh -full

Example 6: Full recompilation of resolution MR05 in debug mode
./compile_ipslcm6.sh MR025 -debug -full

if you compile in debug or in dev mode you need to modify the parameter OptMode in config.card. If you change the resolution at the compilation you need to modify the parameter ResolAtm in config.card