Setting up MARS environment

Local Setting up MARS environment

  • 1. Environment variables and paths

    If classical use : add following environment variables and paths in your .cshrc
#------------------------------------------------------
#  MARS DEVELOPMENT ENVIRONMENT
#------------------------------------------------------
setenv HOMEMARS /export/home11/mars/CODE_MARS/CODE_MARS_V9/V9.05/Mars_Agrif2
                                                                          (Directory where is the reference code)

setenv UDIR /export/home/${USER}/MARS/MARS_CONFIG
setenv CDIR /export/home/${USER}/MARS/COMPILE_MARS
setenv RDIR /export/home/${USER}/MARS/RUN_MARS

setenv HTTPSVNROOT https://forge.ifremer.fr/svn/mars3d
alias getfile=‘$HOMEMARS/../TOOLS/MARSENV/getfile’
setenv extranet_login yours
                                                                           (yours : Set your extranet_login name)

setenv PATH ${PATH}:$HOMEMARS/../TOOLS/MARSENV**

alias mkconfdir $HOMEMARS/../TOOLS/MARSENV/mkconfdir_datarmor
alias mkconfdir_bisc $HOMEMARS/../TOOLS/MARSENV/mkconfdir_datarmor_bisc
                                                                          (list of useful commands to MARS setting up)
  • 2. type : source .cshrc

  • 3. create the 3 directories necessary for MARS environment :

    • # UDIR :
    mkdir /export/home/${USER}/MARS/MARS_CONFIG
    
    • # CDIR :
    mkdir /export/home/${USER}/MARS/COMPILE_MARS
    
    • # RDIR :
    mkdir /export/home/${USER}/MARS/RUN_MARS
    
    • # if the reference MARS code is locally saved – (not for IFREMER users)
    mkdir /export/home/${USER}/MARS/CODE_MARS
    

Note

IFREMER users have no need to duplicate the code under their account

Bash setting up MARS environment (not on datarmor)

  • 1. Environment variables and paths

    If bash use create a new file (env_MARS_V9.05 for instance)
#------------------------------------------------------
#  MARS DEVELOPMENT ENVIRONMENT
#------------------------------------------------------
export HOMEMARS = (Directory where is the reference code)

export UDIR=/export/home/${USER}/MARS/MARS_CONFIG
export CDIR=/export/home/${USER}/MARS/COMPILE_MARS
export RDIR=/export/home/${USER}/MARS/RUN_MARS

alias mkconfdir=‘$HOMEMARS/../TOOLS/MARSENV/mkconfdir_linux’
alias getfile=‘$HOMEMARS/../TOOLS/MARSENV/getfile’
alias update=‘$HOMEMARS/../TOOLS/MARSENV/update’
                                                         (list of useful commands to MARS setting up)
  • 2. type : source env_MARS_V9.05

  • 3. create the 3 directories necessary for MARS environment :

    • # UDIR :
    mkdir /export/home/${USER}/MARS/MARS_CONFIG
    
    • # CDIR :
    mkdir /export/home/${USER}/MARS/COMPILE_MARS
    
    • # RDIR :
    mkdir /export/home/${USER}/MARS/RUN_MARS
    
    • # if the reference MARS code is locally saved – (not for IFREMER users)
    mkdir /export/home/${USER}/MARS/CODE_MARS
    

Get the MARS3D code (not for datarmor users)

  • Get the code from mars3d projet under forge with the following command :
svn --username $extranet_login export $HTTPSVNROOT/tags/V9.05**
cd V9.05/EXAMPLES
vi Makefile.linux
modify library paths of netcdf, io_netcdf.
(if make use, replace all ‘gmake’ by ‘make’ in makefile_env_linux or link gmake to make in your linux environment)

Note

1 : changes inside Makefile.linux (and makefile_env_linux) are the only ones allowed in CODE_MARS directory
2 : no help from PHYSED if the source code has been modified
  • Important remarks :
    • MARS requires fortran compiler, netcdf4 library (netcdf4 requires hdf5 and zlib librairies)
    • MARS results are easily visualized with ferret (free) or matlab…
    • Library NCO is useful for files management

FORTRAN compiler setting up

  • Download free Intel Fortran compiler from http://www.intel.com/cd/software/products/asmo-na/eng/index.htm
    • register at « Free Non Commercial Download » to receive a number authorization by mail;
    • choose ‘Intel Fortran Compiler Profressional Edition for linux’)
  • Installation from file /export/home/l_fc_p_10.X.XXX.tar.gz
  • If library stcd++ is missing : yum install libstdc++.so.5
  • Set compiler environment : source /opt/intel/fce/10.X.XXX/bin/ifortvars.csh

Netcdf4 setting up

We assume the netcdf4 library is installed under /export/home/logiciel/netcdf4

  • zlib library

      1. Create installation directory
    cd export/home/logiciel/netcdf4
    mkdir install
    cd install
    
      1. Download of zlib-1.2.5.tar from http://zlib.net/ (get the sources and not the binaries)
      1. unzip :
    bunzip2 zlib-1.2.5.tar.bz2
    tar xvf zlib-1.2.5.tar
    
      1. Installation
    +------------------------------------------------------------+------------------------------------------------------------------+
    |    sequential or OMP purpose                               |       MPI purpose                                                |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | Module purge                                               |       Module purge                                               |
    | module load intel-comp/11.1.073                            |       module load intel-comp/11.1.073                            |
    |      (path for intel fortran and "c++")                    |                                                                  |
    |                                                            |      module load intel-mpi/4.0.0.028 (path mpi)                  |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | export NC4DIR=/export/home/logiciels/netcdf4/lib/seq       |     export NC4DIR=/export/home/logiciels/netcdf4/lib/mpi         |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | cd /export/home/logiciels/netcdf4/install/zlib-1.2.5       |     cd /export/home/logiciels/netcdf4/install/zlib-1.2.5         |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | ./configure --prefix=$NC4DIR                               |     /configure --prefix=$NC4DIR                                  |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | make check install                                         |     make check install                                           |
    +------------------------------------------------------------+------------------------------------------------------------------+
    
  • hdf5 library

      1. Go to installation directory
    cd export/home/logiciel/netcdf4/install (or create installation directory
    mkdir install
    cd install
    
      1. Download http://www.hdfgroup.org/ftp/HDF5/prev-releases/hdf5-1.8.6/src/hdf5-1.8.6.tar.gz (get the sources and not the binaries)
      1. unzip
    gunzip file
    tar xvf file
    
      1. Installation
    +------------------------------------------------------------+------------------------------------------------------------------+
    |    sequential or OMP purpose                               |       MPI purpose                                                |
    +------------------------------------------------------------+------------------------------------------------------------------+
    |   Module purge                                             |       Module purge                                               |
    |   module load gfortran                                     |       module load gfortran                                       |
    |      (path for fortran and "c++")                          |                                                                  |
    |                                                            |       module load gfortran-mpi (path mpi)                        |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | export NC4DIR=/export/home/logiciels/netcdf4/lib/seq       |     export NC4DIR=/export/home/logiciels/netcdf4/lib/mpi         |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | cd /export/home/logiciels/netcdf4/install/hdf5-1.8.6       |     cd /export/home/logiciels/netcdf4/install/hdf5-1.8.6         |
    +------------------------------------------------------------+------------------------------------------------------------------+
    |   ./configure --prefix=$NC4DIR --with-zlib=$NC4DIR         |    ./configure --prefix=$NC4DIR --with-zlib=$NC4DIR              |
    |   --disable-shared CC=gcc CPP='''gcc -E'''                 |    -disable-shared --enable-parallel CC=mpicc CPP='''mpicc -E''' |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | make                                                       |     make                                                         |
    +------------------------------------------------------------+------------------------------------------------------------------+
    | make install                                               |     make install                                                 |
    +------------------------------------------------------------+------------------------------------------------------------------+
    
  • netcdf4 library

      1. Go to installation directory
    cd export/home/logiciel/netcdf4/install (or create installation directory
    mkdir install
    cd install
    
      1. Download of netcdf-4.1.2.tar.gz from http://www.unidata.ucar.edu/downloads/netcdf/netcdf-4_1_2/index.jsp (get the sources and not the binaries)
      1. unzip
    gunzip file
    tar xvf file
    
      1. Installation
      sequential or OMP purpose MPI purpose
      Module purge module load gfortran (path for fortran and c++)

      Module purge module load gfortran

      module load gfortran-mpi (path mpi)

      export NC4DIR=/export/home/logiciels/netcdf4/lib/seq export NC4DIR=/export/home/logiciels/netcdf4/lib/mpi
      cd /export/home/logiciels/netcdf4/install/netcdf-4.1.2 cd /export/home/logiciels/netcdf4/install/netcdf-4.1.2
      export LDFLAGS=”-lm”  (access to a mathematics library)  
      ./configure –prefix=$NC4DIR –with-hdf5=$NC4DIR –with-zlib=$NC4DIR –enable-ncgen4 –enable-netcdf-4 –disable-shared –disable-cxx –disable-dap FC=gfortran CC=gcc CPP=’gcc -E’ ./configure –prefix=$NC4DIR –with-hdf5=$NC4DIR –with-zlib=$NC4DIR –enable-ncgen4 –enable-netcdf-4 –disable-shared –disable-cxx –disable-dap CPPFLAGS=’-DNDEBUG -DpgiFortran’ FC=mpif90 CC=mpicc CPP=’mpicc -E’
      make make
      make check install make check install

IO NETCDF library

Libionc4 is an interface between NetCDF4 and MARS (or other softwares). This library is developed by IFREMER/PHYSED and supplied with MARS under ‘$HOMEMARS/../LIB/libionc4’. It is a module of MARS software.(to be compiled only if used by software other than MARS)

    1. preparation
cd $HOMEMARS/../LIB/libionc4/src
ln -s $HOMEMARS/INC/comionc4.F90
ln -s $HOMEMARS/PHYS/OUT/ionc4.F90
    1. install directorie
cd ..
./install.csh (2 directories are created intel-seq and intel-mpi; the will store the library and the include files)
    1. edit Makefile and modify
+-------------------------------------------------------+------------------------------------------------------------------+
|    sequential or OMP purpose                          |       MPI purpose                                                |
+-------------------------------------------------------+------------------------------------------------------------------+
| FC = ifort                                            |     FC = mpiifort                                                |
+-------------------------------------------------------+------------------------------------------------------------------+
| CPPFLAGS =                                            |     CPPFLAGS = -Dkey_MPI_2D                                      |
+-------------------------------------------------------+------------------------------------------------------------------+
| NETCDF4 = /home1/datarmor/rramel/netcdf4.1.2          |     NETCDF4 = /home1/datarmor/rramel/netcdf4.1.2_par             |
+-------------------------------------------------------+------------------------------------------------------------------+
| OUTDIR = ./intel-seq                                  |              OUTDIR = ./intel-mpi                                |
+-------------------------------------------------------+------------------------------------------------------------------+
| FFLAGS required compilation options                   | FFLAGS required compilation options                              |
+-------------------------------------------------------+------------------------------------------------------------------+
    1. create the library :
gmake clean
gmake
Library libionc4.a is under $HOMEMARS/../LIB/libionc4/intel-XXX/lib
module files comionc4.mod and ionc4.mod are under $HOMEMARS/../LIB/libionc4/intel-XXX/inc

File connexion

This fortran code developed by IFREMER/PHYSED to gather MPI output files is supplied with MARS under $HOMEMARS/../TOOLS/CONNECT

    1. cd $HOMEMARS/../TOOLS/connect
    1. Modify the library paths in compile_cap
    1. Compile_cap

The connect.exe is created under the directory $HOMEMARS/../TOOLS/connect. It will be automatically copied under $RDIR/CONF/CONF-CASE[/rank_X]

Domain cutting out executable (for MPI purpose)

This fortran code has been developed by IFREMER/RIC to divide the regional model in X sub-domains. It is available in $HOMEMARS/../TOOLS/MPI2D_DOMAIN

    1. cd $HOMEMARS/../TOOLS/MPI2D_DOMAIN
    1. Modify the library paths in makefile
    1. make

The ./run executable is created under the directory $HOMEMARS/../TOOLS/MPI2D_DOMAIN.

A user manual is available from http://wwz.ifremer.fr/dyneco/Moyens-Outils/Logiciels/MARS/Documentation

FERRET - NCO Tools - nedit editor

FERRET

    1. Download files from http://ferret.pmel.noaa.gov/static/Downloads/
    1. Follow instructions of installation

NCO tools : yum install nco

nedit editor : yum install nedit