wiki:Documentation/UserGuide/CompileMethods

There are 2 methods for compiling ORCHIDEE.

  • Old obsolete method: Standard makefiles created based on AA_make and AA_make.gdef.
    • Full compiling is done from modipsl/modeles/ORCHIDEE directory
    • Specific platform dependent compile options are set in modipsl/util/AA_make.gdef
  • Current default method: A main makefile in config directory which will launch the script makeorchidee_fcm based on the tool FCM.
    • Full compiling is done from modipsl/config/ORCHIDEE_OL directory
    • Specific platform dependent compile options are set in modipsl/modeles/ORCHIDEE/arch directory

Compile using standard makefiles (old method)

The compile options are set in modipsl/util/AA_make.gdef for all predefined environements. Using the script modipsl/util/ins_make the main makefile is created in modipsl/modeles/ORCHIDEE/Makefile. To change a compile option, it is necessary to change in AA_make.gdef and relaunch ins_make. The target machine is determined automatically by ins_make if the machine is in a predefined list. It is also possible to specify the target using the optional argument -t. Create makefiles and compile as follow:

cd modipsl/util
./ins_make [-t target]
cd ../modeles/ORCHIDEE
gmake driver

Compile using with FCM method (default method)

Main makefile in modipsl/config/ORCHIDEE_OL

A main makefile is found in modipsl/config/ORCHIDEE_OL directory or in modipsl/config/LMDZOR_v5.2 directory. This makefile will first compile IOIPSL and then ORCHIDEE using the script makeorchidee_fcm.

The default set up compiles ORCHIDEE for MPI parallel run mode. The default options for compiling ORCHIDEE can be changed in AA_make in the following section(regenerate makefiles using the script ins_make in modipsl/util after modification) :

# driver : Only compiling ORCHIDEE (with fcm method)
driver :
        (cd ../../modeles/ORCHIDEE ; ./makeorchidee_fcm -j 8 -parallel mpi -prod -arch ${FCM_ARCH} -driver ; )

Example 1 : compile the ORCHIDEE offline model :

cd modipsl/config/ORCHIDEE_OL
gmake

Example 2 : Clean temporary files created during compilation of IOIPSL and ORCHIDEE (the executable is not deleted) :

cd modipsl/config/ORCHIDEE_OL
gmake clean

Example 3 : Compile using debug compile options

cd modipsl/config/ORCHIDEE_OL
vi AA_make                       => change -prod into -debug or -dev:  ./makeorchidee_fcm -j 8 -parallel mpi -debug -arch ${FCM_ARCH} -driver 
../../util/ins_make
gmake

makeorchidee_fcm

The script makeorchidee_fcm compiles ORCHIDEE using the FCM, a software developed by the Hadley Centre. While using this script the dependencies between fortran modules do not need to be set in advance. Fcm determines the dependencies. Fcm is stored in tools/ directory.

makeorchidee_fcm is launched by the main makefile in config directory but it can also be launched manually from modeles directory. In the later case, IOIPSL must have been compiled previously.

Compile options for different target machines or compilers are defined in the directory arch/. For each target machine two files must exist : archname.fcm and archname.path. Use ./makeorchidee_fcm -h to get information about available arguments. See here the main arguments

./makeorchidee_fcm [Options] 

[ -h ]        : show this help

[ -arch XXX ] : name of the archicture file containg platform dependent compile options. 
                The files arch/arch-XXX.fcm and arch/arch-XXX.path must exist. 

[ -parallel|-p PARALLEL_TYPE ] : choose parallelization mode for ORCHIDEE : 
    PARALLEL_TYPE =
    ( mpi | MPI )              : only MPI (Message Passing Interface)
    ( omp | OMP )              : only OpenMP
    ( mpi_omp | MPI_OMP )      : hybrid MPI/OpenMP mode
    ( none | NONE | seq )      : sequential mode (default)

[ -driver ]      : compilation of ORCHIDEE offline driver (default compiling only the library)

Options related to cleaning
| -clean ]       : delete all files produceed during previous compilation
| -full ]        : activate full recompiling 

Options for XIOS, only choose one of the following
[ -xios ]        : linking with XIOS
[ -noxios ]      : compilation without XIOS (default)

Options for optimization, choose only one of the following
[ -prod ]        : compilation for production (all optimization)
[ -dev ]         : compilation for development (low optimization and -g)
[ -debug ]       : compilation for debugging (no optmization and all debug options)

Option to optimize the compilation time
[ -j x ]         : activate parallel compiling on x task, default 1 task

Option to add extra source to compile
[ -ext_src path] : path to an additional directory with fortran routines to compile with the model

Using fcm, the dependencies between the modules are not predefined. fcm will determine the correct order to compile. makeorchidee_fcm do not compile IOIPSL. This must be done in advance.
Example 1 : compile at curie(TGCC) for MPI parallel run mode

   ./makeorchidee_fcm -parallel mpi -arch X64_CURIE -driver

Example 2 : compile at ada(IDRIS) for MPI-OpenMP parallel run mode

   ./makeorchidee_fcm -parallel mpi_omp -arch X64_ADA -driver

Example 3 : compile at obelix(LSCE)

   ./makeorchidee_fcm -arch ifort_LSCE -driver

Example 4 : compile using gfortran compiler for sequential run mode First make sure that the files arch/gfortran.fcm and arch/gfortran.path are suitable for your environement especially the path to netcdf library.

   ./makeorchidee_fcm -parallel seq -arch gfortran -driver

Example 5 : clean files created during previous compilation

   ./makeorchidee_fcm -clean

Compatibility

Compiling using makeorchidee_fcm is possible using the trunk ORCHIDEE at least since rev 1369. A detailed comparison between the 2 methods has been done using the trunk rev 2149 after updating compile options to have the same as in AA_make.gdef.

Remove compilation of teststomate and/or forcesoil

Contributed by Ferenc Pasztor with input from Josfine Ghattas & Betrand Guenet

The compilation scripts compile orchidee libraries, and the three executables orchidee_ol, forcesoil and teststomate at the same time. Although forcesoil and teststomate are still required for some branches to speed up the simulation time, for several other branches they became obsolete. If you want to compile your changes to orchidee without compiling teststomate you can change the compilation script. If using makeorchidee_fcm, remove teststomate.exe to have

TARGET="liborchidee_ol.a dim2_driver.exe forcesoil.exe"

or if you want to remove also forcesoil.exe :

TARGET="liborchidee_ol.a dim2_driver.exe"

Then remove the corresponding copy command further down :

cp bin/teststomate.exe ../../bin/teststomate
cp bin/forcesoil.exe ../../bin/forcesoil

If you are using the old compilation method you should instead change in src_driver/Makefile, change the line:

all : orchidee_ol teststomate forcesoil

to

all : orchidee_ol

You can now compile as before.

Last modified 3 years ago Last modified on 09/04/15 16:56:28