= More about compile methods = [[PageOutline]] Author: J. Ghattas[[BR]] Last revision: 2020/02/28, F. Maignan[[BR]] Last revision: 2020/02/26, J. Ghattas To compile ORCHIDEE offline model, first the components IOIPSL and XIOS need to be compiled and then ORCHIDEE source code can be compiled and the driver executable created. All these compilations are launched from one single script, or in older version from a Makefile. The full compilation is done from directory ''modipsl/config/ORCHIDEE_OL''. For newer versions (ORCHIDEE/trunk r6572 or later, and branch2.2 starting r7452), the script ''compile_orchidee_ol.sh'' is used. For older versions (all tags ORCHIDEE_2), a Makefile exists and should be used. More detailed information can be found here: https://forge.ipsl.jussieu.fr/orchidee/wiki/Documentation/UserGuide/InstallingORCHIDEEBasic Compilation of the coupled models such as LMDZOR and IPSLCM uses the same principle as ORCHIDEE offline configurations. For newer versions such as LMDZOR_v6.2 and later, IPSLCM6.2 and ICOLMDZOR_v7, a script ''compile_(model).sh'' is found in ''modipsl/config/(model)''. These scripts have a very close structure to the ''compile_orchidee_ol.sh'' script described below. For older versions including v6.1, a main Makefile is found in ''modipsl/config/(model)'' folder and compilation is done using gmake. Read also the documentation about compilation of IPSL-CMC configurations: https://forge.ipsl.jussieu.fr/igcmg_doc/wiki/Doc/Compile == Compilation script in modipsl/config/ORCHIDEE_OL == See here the compilation script on the trunk: [browser:trunk/ORCHIDEE_OL/compile_orchidee_ol.sh compile_orchidee_ol.sh]. The compilation script does following steps: - 1) Read and set options from argument list - 2) Load default environment if installation on irene/TGCC, jeanzay/IDRIS, obelix/LSCE or ciclad/climserv/IPSL - 3) Compile IOIPSL using ./makeioipsl_fcm - 4) Compile XIOS using ./makexios_fcm - 5) Compile ORCHIDEE using ./makeorchidee_fcm The script can be used as follow: {{{ cd modipsl/config/ORCHIDEE_OL ./compile_orchidee_ol.sh -h # To see a help about the script and its options ./compile_orchidee_ol.sh # Default compilation ./compile_orchidee_ol.sh -debug # Compilation with debug options }}} The compile script can be used as default at the machines that are maintained at IPSL: irene/TGCC, jeanzay/IDRIS, obelix/LSCE and ciclad/climserv/IPSL. The compilation script loads all modules needed for compilation and is therefore independent of personal environment on the machine. If you install on a local PC or a cluster not maintained by IPSL-CMC, then you need to add compile options for your system. See here how to proceed: ​http://forge.ipsl.jussieu.fr/igcmg_doc/wiki/Doc/ComputingCenters/LocalPC == Makefile in modipsl/config/ORCHIDEE_OL == If a Makefile is found in ''modipsl/config/ORCHIDEE_OL'' directory, this should be used to compile the model and the components. This is the case for all ORCHIDEE_2 versions until r6452 and the trunk until r6572. This makefile will first compile IOIPSL and XIOS and then compile ORCHIDEE. ORCHIDEE is always compiled using the script ''makeorchidee_fcm'' found in ''modeles/ORCHIDEE'' directory. 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 }}} == More about makeorchidee_fcm == The script [https://forge.ipsl.jussieu.fr/orchidee/browser/trunk/ORCHIDEE/makeorchidee_fcm 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 script or the main makefile in ''config'' directory but it can also be launched manually from ''modeles'' directory. In the later case, '''IOIPSL and XIOS must have been compiled previously''', this is not recommended. 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:[[BR]] {{{ ./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 does not compile IOIPSL. This must be done in advance. [[BR]] 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 environment especially the path to netcdf library. {{{ ./makeorchidee_fcm -parallel seq -arch gfortran -driver }}} Example 5: Clean files created during previous compilation {{{ ./makeorchidee_fcm -clean }}}