Changeset 3044 for BOL


Ignore:
Timestamp:
Oct 26, 2017, 3:12:15 PM (7 years ago)
Author:
fhourdin
Message:

Update install script and delete obsolete install1d.sh.
EM

Location:
BOL/script_install
Files:
1 deleted
1 moved

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install_lmdz.sh

    r3043 r3044  
    22
    33###########################################################################
    4 # Author : Frédéric Hourdin/LMD/hourdin@lmd.jussieu.fr
    5 # Usage  : install.sh
     4# Author : Laurent Fairhead et Frédéric Hourdin
     5# Usage  : install_lmdz.sh -help
    66#
    77# bash installation script of the LMDZ model on a Linux PC.
     
    2222# munimal configuration.
    2323#
    24 # Prerequisites : g95/pgf90/gfortran, ksh, wget , gunzip, tar, ...
     24# Prerequisites : pgf90/gfortran, ksh, wget , gunzip, tar, ...
    2525#
    2626# Modif 18/11/2011
     
    3636set -e
    3737
    38 echo '################################################################'
    39 echo  Choice of installation options
    40 echo '################################################################'
     38################################################################
     39# Choice of installation options
     40################################################################
     41
     42# A function to fetch files either locally or on the internet
     43function myget { #1st and only argument should be file name
     44  # Path on local computer where to look for the datafile
     45  LMDZ_HOME="/u/lmdz/WWW/Distrib"
     46  if [ -f $LMDZ_HOME/$1 ] ; then
     47    \cp -f -p $LMDZ_HOME/$1 .
     48  else
     49    wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$1
     50  fi
     51}
    4152
    4253
     
    4758# install.v2.sh instead of install.sh
    4859
    49 version=trunk
    50 version=20151130.trunk
     60#########################################################################
     61# Valeur par défaut des parametres
     62#########################################################################
     63svn=""
    5164version=testing
    52 
    53 compilo=gfortran # compilo=pgf90 or g95 or gfortran or ifort sur PC linux
    54 
    55 #Chemin pour placer le modele
    56 MODEL=./LMDZ$version
    57 
    58 
    5965getlmdzor=1
    6066netcdf=1   #  1 for automatic installation
     
    6773bench=1
    6874pclinux=1
    69 
     75SCM=0
     76# use the old orchidee interface without the calculation of z0h
     77no_z0h_orc=1
    7078# choose the resolution for the bench runs
    71 # grid_resolution= 32x24x11, 32x32x39 or 48x36x19 for tests
     79# grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE)
     80#                  96x71x19  standard configuration
     81grid_resolution=144x142x79
    7282grid_resolution=48x36x19
    7383
    74 ## compile_with_fcm=1 : use makelmdz_fcm, possible a of version 20111103.trunk (LMDZ5/trunk rev 1578)
    75 ## compile_with_fcm=0 : use makelmdz
    76 compile_with_fcm=0
    77 
    78 
    79 
    80 if [ -d /u/lmdz/WWW/Distrib ] ; then
    81   dirget=/u/lmdz/WWW/Distrib
    82 elif [ -d ~/LMDZ/Distrib ] ; then
    83   dirget=~/LMDZ/Distrib
    84 else
    85   dirget=NONE
    86 fi
    87 wget='wget http://www.lmd.jussieu.fr/~lmdz/Distrib'
     84## parallel can take the values none/mpi/omp/mpi_omp
     85parallel=mpi_omp
     86parallel=none
     87OPT_GPROF=""
     88OPT_MAKELMDZ=""
     89MODEL=""
     90
     91#########################################################################
     92#  Options interactives
     93#########################################################################
     94while (($# > 0))
     95   do
     96   case $1 in
     97     "-h") cat <<........fin
     98    $0 [ -v version ] [ -r svn_release ]
     99           [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ]
     100           [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz]
     101
     102    -v       "version" like 20150828.trunk
     103             see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk
     104
     105    -r       "svn_release" : either the svn release number or "last"
     106
     107    -parallel PARA : can be mpi_omp (mpi with openMP) or none (for sequential)
     108
     109    -d        GRID_RESOLUTION should be among the available benchs if -bench 1
     110              among which : 48x36x19, 48x36x39
     111              if wanting to run a bench simulation in addition to compilation
     112              default : 48x36x19
     113
     114    -bench     activating the bench or not (0/1). Default 1
     115
     116    -name      LOCAL_MODEL_NAME : default = LMDZversion.release
     117
     118    -gprof     to compile with -pg to enable profiling with gprof
     119    -SCM        install 1D version automatically
     120    -opt_makelmdz     to call makelmdz or makelmdz_fcm with additional options
     121........fin
     122     exit ;;
     123     "-v") version=$2 ; shift ; shift ;;
     124     "-r") svn=$2 ; shift ; shift ;;
     125     "-d") grid_resolution=$2 ; shift ; shift ;;
     126     "-gprof") OPT_GPROF="-pg" ; shift ;;
     127     "-SCM") SCM=1 ; shift ;;
     128     "-opt_makelmdz") OPT_MAKELMDZ="$2" ; shift ; shift ;;
     129     "-parallel") parallel=$2
     130                  case $parallel in
     131                    "mpi"|"omp"|"mpi_omp") parallel=$2 ; shift ; shift ;;
     132                    *) echo Only mpi omp mpi_omp for the parallel option ; exit
     133                  esac ;;
     134     "-bench") bench=$2 ; shift ; shift ;;
     135     "-name") MODEL=$2 ; shift ; shift ;;
     136     *) ./install_lmdz.sh -h ; exit
     137   esac
     138done
     139
     140if [ $parallel = none ] ; then sequential=1 ; else sequential=0 ; fi
     141
     142
     143compilo=gfortran # compilo=pgf90 or gfortran or ifort sur PC linux
     144#Chemin pour placer le modele
     145if [ "$MODEL" = "" ] ; then MODEL=./LMDZ$version$svn ; fi
     146
     147
     148## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0)
     149compile_with_fcm=1
     150arch=local
     151
     152
     153if [ $compilo = g95 ] ; then echo g95 is not supported anymore ; exit ; fi
     154
     155################################################################
     156# Specificite des machines
     157################################################################
     158
     159hostname=`hostname`
     160if [ "$pclinux" = 1 ] ; then o_ins_make="-t g95" ; else o_ins_make="" ; fi
     161
     162case ${hostname:0:5} in
     163
     164   ada33)   compilo="ifort" ;
     165            par_comp="ifort" ;
     166            o_ins_make="-t ada" ;
     167            make=gmake ;
     168#            module load intel/2013.0 ;
     169            arch=X64_ADA ;;
     170
     171   *)       compilo="gfortran" ;
     172            if [ $parallel = none -o -f /usr/bin/mpif90 ] ; then
     173                path_mpi="" ;
     174            # Pour les installations Scientifique Linux LMD ou ciclad :
     175            elif [ -f /usr/lib64/openmpi/1.4.5-gfortran/bin/mpif90 ] ; then
     176                path_mpi=/usr/lib64/openmpi/1.4.5-gfortran/bin/ ;
     177            else
     178               echo Je ne trouve pas mpif90 ;
     179               exit ;
     180            fi ;
     181            par_comp=${path_mpi}mpif90 ;
     182            mpirun=${path_mpi}mpirun ;
     183            arch=local  ;
     184            make=make ;
     185            o_ins_make="-t g95"
     186esac
     187
     188
     189# MPI_FLAGS are the flags needed for compilation with MPI
     190MPI_FLAGS="-I/usr/include/openmpi-x86_64 -fcray-pointer"
     191MPI_FLAGS="-fcray-pointer"
     192# MPI_LD are the flags needed for linking with MPI
     193MPI_LD="-L/usr/lib64/openmpi/lib -lmpi"
     194# OMP_FLAGS are the flags needed for compilation with OpenMP
     195OMP_FLAGS="-fopenmp -fcray-pointer"
     196# OMP_LD are the flags needed for linking with OpenMP
     197OMP_LD="-fopenmp -L/usr/lib64 -lnuma"
     198OMP_LD="-fopenmp"
    88199
    89200
     
    96207#####################################################################
    97208
    98 if [ $compilo = gfortran ] ; then
     209if [ "$compilo" = "gfortran" ] ; then
    99210   gfortran=gfortran
    100211   gfortranv=`gfortran --version | \
     
    102213   if [ $gfortranv -le 43 ] ; then
    103214       echo ERROR : Your gfortran compiler is too old
    104        echo 'Please choose a new one (g95, ifort) and change the line'
     215       echo 'Please choose a new one (ifort) and change the line'
    105216       echo compilo=xxx
    106217       echo in the install.sh script and rerun it
     
    117228
    118229
    119 OPTPREC=""
    120230echo '################################################################'
    121231echo  Choix des options de compilation
    122232echo '################################################################'
    123233
    124 OPTIMNC=$OPTIM
    125234export FC=$compilo
    126235export F90=$compilo
    127236export F77=$compilo
    128237export CPPFLAGS=
    129 BASE_LD=
    130 if [ $compilo = g95 ] ; then
    131 # Set the appropriate compilation options
    132    OPTIM='-i4 -O3'
    133    OPTDEB="-g -O0 -Wall -ftrace=full -fbounds-check -freal=nan"
    134    OPTDEV="-g -O1 -Wall"
    135    fmod='fmod='
    136    BASE_LD=""
    137    if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
    138    export F90FLAGS=" -cpp -ffree-form $OPTIMNC"
    139    export FFLAGS=" -cpp $OPTIMNC"
    140    export CPPFLAGS=-Df2cFortran
    141    export CC=gcc
    142    export CXX=g++
    143 elif [ $compilo = $gfortran ] ; then
     238OPTIMNC=$OPTIM
     239BASE_LD="$OPT_GPROF"
     240OPTPREC="$OPT_GPROF"
     241
     242if [ "$compilo" = "$gfortran" ] ; then
    144243   OPTIM='-O3'
    145    OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -finit-real=nan -fbacktrace"
     244   OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=nan"
    146245   OPTDEV="-Wall -fbounds-check"
    147246   fmod='I '
    148 #   OPTPREC="-frecursive -ffree-line-length-none"
    149    OPTPREC="-ffree-line-length-none"
     247   OPTPREC="$OPTPREC -cpp -ffree-line-length-0"
    150248   if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE" ; fi
    151249   export F90FLAGS=" -ffree-form $OPTIMNC"
     
    153251   export CC=gcc
    154252   export CXX=g++
     253   export fpp_flags="-P -C -traditional -ffreestanding"
     254
    155255elif [ $compilo = mpif90 ] ; then
    156256   OPTIM='-O3'
    157    OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -finit-real=nan -fbacktrace"
     257   OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all"
    158258   OPTDEV="-Wall -fbounds-check"
    159    BASE_LD="-lblas"
     259   BASE_LD="$BASE_LD -lblas"
    160260   fmod='I '
    161    if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi
     261   if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi
    162262   export F90FLAGS=" -ffree-form $OPTIMNC"
    163263   export FFLAGS=" $OPTIMNC"
    164264   export CC=gcc
    165265   export CXX=g++
     266
    166267elif [ $compilo = pgf90 ] ; then
    167268   OPTIM='-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align'
     
    169270   OPTDEV='-g -Mbounds -Ktrap=fp -traceback'
    170271   fmod='module '
    171    if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
     272   if [ $real = r8 ] ; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE" ; fi
    172273   export CPPFLAGS="-DpgiFortran"
    173274   export CC=pgcc
     
    178279   export F90FLAGS="-O2 $OPTIMNC"
    179280   compile_with_fcm=1
     281
    180282elif [ $compilo = ifort ] ; then
    181283   OPTIM="-O2 -fp-model strict -ip -align all "
     
    183285   OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check"
    184286   fmod='module '
    185    if [ $real = r8 ] ; then OPTPREC="-real-size 64 -DNC_DOUBLE" ; fi
     287   if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE" ; fi
    186288   export CPP="icc -E"
    187289   export FFLAGS="-O2 -ip -fpic -mcmodel=large"
     
    192294   export CXXFLAGS="-O2 -ip -fpic -mcmodel=large"
    193295   compile_with_fcm=1
     296
    194297else
    195298   echo unexpected compiler $compilo ; exit
     
    207310  check_linux=0
    208311  pclinux=0
    209   ioipsl=0 # no need to recompile ioipsl, already available
     312  ioipsl=1 # no need to recompile ioipsl, already available
    210313  #netcdf="/smplocal/pub/NetCDF/4.1.3"
    211314  compilo="ifort"
    212315  fmod='module '
    213   if [ $real = r8 ] ; then OPTPREC="-real-size 64 -DNC_DOUBLE" ; fi
     316  if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE" ; fi
    214317  OPTIM="-O2 -fp-model strict -ip -axAVX,SSE4.2 -align all "
    215318  OPTIMGCM="$OPTIM $OPTPREC"
    216319fi
    217320##########################################################################
     321
    218322
    219323
     
    247351
    248352
    249 for logiciel in wget tar gzip make $compilo gcc ; do
     353for logiciel in csh wget tar gzip make $compilo gcc ; do
    250354if [ "`which $logiciel`" = "" ] ; then
    251355echo You must first install $logiciel on your system
     
    274378echo '##########################################################'
    275379cd $MODEL
    276 if [ -f $dirget/modipsl.$version.tar.gz ] ; then
    277    tar xvf $dirget/modipsl.$version.tar.gz
    278 else
    279    $wget/modipsl.$version.tar.gz
    280    tar xvf modipsl.$version.tar.gz
    281    \rm modipsl.$version.tar.gz
    282 fi
    283 
    284 # We download LMDZ and make some modifications to make it
    285 #compatible with $compilo
    286 # and we use an old stable but robust and well tested version of ORCHIDEE
    287 # That version of ORCHIDEE can be obtained using
    288 # wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/getlmdzor.x
     380#wget http://www.lmd.jussieu.fr/~lmdz/Distrib/modipsl.$version.tar.gz
     381myget modipsl.$version.tar.gz
     382echo install.sh wget_OK `date`
     383gunzip modipsl.$version.tar.gz
     384tar xvf modipsl.$version.tar
     385\rm modipsl.$version.tar
     386
    289387fi
    290388
     
    296394echo '##########################################################'
    297395cd $MODEL
    298 if [ -f $dirget/netcdf-4.0.1.tar.gz ] ; then
    299    tar xvf $dirget/netcdf-4.0.1.tar.gz
    300 else
    301    $wget/netcdf-4.0.1.tar.gz
    302    tar xvf netcdf-4.0.1.tar.gz
    303    \rm -f netcdf-4.0.1.tar.gz
    304 fi
     396#wget http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.0.1.tar.gz
     397myget netcdf-4.0.1.tar.gz
     398gunzip netcdf-4.0.1.tar.gz
     399tar xvf netcdf-4.0.1.tar
     400\rm -f netcdf-4.0.1.tar
    305401
    306402cd netcdf-4.0.1
     
    308404sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
    309405localdir=`pwd -P`
    310 ./configure --prefix=$localdir --disable-cxx
     406./configure --prefix=$localdir --enable-shared --disable-cxx
    311407sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile
    312 make check
    313 make install
     408$make check
     409$make install
    314410echo install.sh netcdf_OK `date`
    315411fi # of if [ $netcdf = 1 ]
     
    342438  -e 's/g95.*.w_w.*.(F_D)/g95      w_w = '"$OPTIMGCM"'/' \
    343439  -e 's:g95.*.NCDF_INC.*.$:g95      NCDF_INC= '"$ncdfdir"'/include:' \
    344   -e 's:g95.*.NCDF_LIB.*.$:g95      NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdf:' \
     440  -e 's:g95.*.NCDF_LIB.*.$:g95      NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdff -lnetcdf:' \
    345441  -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \
    346442  -e 's:#-Q- g95      M_K = gmake:#-Q- g95      M_K = make:' \
     
    348444
    349445
     446# We use lines for g95 even for the other compilers to run ins_make
    350447  if [ "$use_shell" = "ksh" ] ; then
    351     if [ "$pclinux" = 1 ] ; then
    352        ./ins_make -t g95 # We use lines for g95 even for the other compilers
    353     fi
     448    ./ins_make $o_ins_make
    354449  else # bash
    355450    sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash
     451    if [ "`grep ada AA_make.gdef`" = "" ] ; then # Bidouille pour compiler sur ada des vieux modipsl.tar
     452        \cp -f ~rdzt401/bin/AA_make.gdef .
     453    fi
    356454    chmod u=rwx ins_make.bash
    357     if [ "$pclinux" = 1 ] ; then
    358     ./ins_make.bash -t g95 # We use lines for g95 even for the other compilers
    359     else
    360     ./ins_make.bash
    361     fi
     455    ./ins_make.bash $o_ins_make
    362456  fi # of if [ "$use_shell" = "ksh" ]
    363457
     
    372466    sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile
    373467  fi
    374   if [ "$pclinux" = 1 ] ; then
     468# if [ "$pclinux" = 1 ] ; then
    375469    # Build IOIPSL modules and library
    376     if [ $compilo = g95 ] ; then
    377        cp restcom.f90 restcom.f90.orig
    378        sed -e 's:cmode=or(NF90_NOCLOBBER,NF90_64BIT_OFFSET):cmode=NF90_NOCLOBBER:' restcom.f90.orig > restcom.f90 
    379     fi
    380     make clean
    381     make
     470echo EOEOFOOEOOOOOOOOOOOOOOOOOOOOOOOOOOOO
     471    $make clean
     472    $make
    382473    if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then # copy module files to lib
    383474      cp -f *.mod ../../../lib
     
    395486            -e 's:print:echo:g' rebuild.ksh > rebuild
    396487      fi
    397       make clean
    398       make
     488      $make clean
     489      $make
    399490    fi
    400   fi # of if [ "$pclinux" = 1 ]
     491# fi # of if [ "$pclinux" = 1 ]
    401492
    402493else # of if [ $ioipsl = 1 ]
     
    415506    tmp >| AA_make.gdef
    416507
    417     ./ins_make -t g95 # We use lines for g95 even for the other compilers
     508    ./ins_make $o_ins_make # We use lines for g95 even for the other compilers
    418509
    419510    # on Ada, IOIPSL is already installed in ~rpsl035/IOIPSL_PLUS
     
    423514    ln -s ~rpsl035/IOIPSL_PLUS IOIPSL
    424515    cd ..
    425     ln -s ~rpsl035/IOIPSL_PLUS/modipsl/bin/* bin/
    426     ln -s ~rpsl035/IOIPSL_PLUS/modipsl/lib/* lib/
     516    ln -s ~rpsl035/IOIPSL_PLUS/modipsl_Tagv2_2_3/bin/* bin/
     517    ln -s ~rpsl035/IOIPSL_PLUS/modipsl_Tagv2_2_3/lib/* lib/
    427518
    428519  fi # of if [ ${hostname:0:5} = ada33 ]
    429520  echo install.sh ioipsl_OK `date`
    430521fi # of if [ $ioipsl = 1 ]
    431 
     522# Saving ioipsl lib for possible parallel compile
     523  cd $MODEL/modipsl
     524  tar cf ioipsl.tar lib/ bin/
    432525
    433526#============================================================================
     
    438531  echo '########################################################'
    439532  cd $MODEL/modipsl/modeles/ORCHIDEE
    440   echo OKpwd ; pwd
    441 
    442533  export ORCHPATH=`pwd`
    443534  if [ -d tools ] ; then
    444 #     orchidee_rev=2247
     535     orchidee_rev=2247
    445536     veget_version=orchidee2.0
    446       cd arch
    447       fpp_flags='-P -traditional'
     537      cd arch
    448538      sed -e s:"%COMPILER        .*.$":"%COMPILER            $compilo":1 \
    449539     -e s:"%LINK            .*.$":"%LINK                $compilo":1 \
     
    452542     -e s:"%DEV_FFLAGS      .*.$":"%DEV_FFLAGS          $OPTDEV":1 \
    453543     -e s:"%DEBUG_FFLAGS    .*.$":"%DEBUG_FFLAGS        $OPTDEB":1 \
    454      -e s:"%BASE_FFLAGS     .*.$":"%BASE_FFLAGS         $OPTPREC -cpp":1 \
     544     -e s:"%BASE_FFLAGS     .*.$":"%BASE_FFLAGS         $OPTPREC":1 \
     545     -e s:"%BASE_LD         .*.$":"%BASE_LD             $BASE_LD":1 \
    455546     arch-gfortran.fcm > arch-local.fcm
    456      echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf\"" > arch-local.path
     547     echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path
    457548     echo "NETCDF_INCDIR=${ncdfdir}/include" >> arch-local.path
    458549     echo "IOIPSL_INCDIR=$ORCHPATH/../../lib" >> arch-local.path
    459550     echo "IOIPSL_LIBDIR=$ORCHPATH/../../lib" >> arch-local.path
    460      cd ../
     551     cd ../ 
    461552# compiling ORCHIDEE sequential mode
    462      ./makeorchidee_fcm -noxios -prod -parallel none -arch local
     553     ./makeorchidee_fcm -j 8 -noxios -prod -parallel none -arch $arch
     554     echo ./makeorchidee_fcm -j 8 -noxios -prod -parallel none -arch $arch
     555     echo Fin de la premiere compilation orchidee ; pwd
    463556  else
    464557     if [ -d src_parallel ] ; then
     
    476569        echo ls ; ls
    477570        if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi
    478         cd $src_d ; \rm -f *.mod make ; make clean
    479         make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi
     571        cd $src_d ; \rm -f *.mod make ; $make clean
     572        $make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi
    480573        cd ..
    481574     done
    482575  fi
    483   echo liste_strc $liste_src
    484 
    485   for d in $liste_src ; do src_d=src_$d
    486       echo src_d $src_d
    487       echo ls ; ls
    488       if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi
    489       cd $src_d ; \rm -f *.mod make ; make clean
    490       make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi
    491       cd ..
    492   done
    493576  echo install.sh orchidee_OK `date`
    494577fi # of if [ "$veget" = 1 ]
     
    497580#============================================================================
    498581# Ehouarn: it may be directory LMDZ4 or LMDZ5 depending on tar file...
    499 if [ -d $MODEL/modipsl/modeles/LMDZ[45] ] ; then
     582if [ -d $MODEL/modipsl/modeles/LMD* ] ; then
    500583  echo '##########################################################'
    501584  echo 'Compiling LMDZ'
    502585  echo '##########################################################'
    503   cd $MODEL/modipsl/modeles/LMDZ[45]
     586  cd $MODEL/modipsl/modeles/LMD*
     587  LMDZPATH=`pwd`
    504588else
    505   echo "ERROR: No LMDZ4 (or LMDZ5) directory !!!"
     589  echo "ERROR: No LMD* directory !!!"
    506590  exit
    507591fi
     
    517601cd arch
    518602# arch-local.path file
    519 echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf\"" > arch-local.path
     603echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path
    520604echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path
    521605echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path
    522606echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path
     607echo 'XIOS_INCDIR=$LMDGCM/../XIOS/inc' >> arch-local.path
     608echo 'XIOS_LIBDIR=$LMDGCM/../XIOS/lib' >> arch-local.path
    523609echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path
    524610echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path
     611
     612BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib"
    525613# arch-local.fcm file (adapted from arch-linux-32bit.fcm)
    526614
     
    533621    -e s:"%BASE_FFLAGS     .*.$":"%BASE_FFLAGS         $OPTPREC":1 \
    534622    -e s:"%FPP_DEF         .*.$":"%FPP_DEF             $FPP_DEF":1 \
     623    -e s:"%BASE_LD         .*.$":"%BASE_LD             $BASE_LD":1 \
    535624    arch-linux-32bit.fcm > arch-local.fcm
    536625
     
    543632
    544633
    545 cd $MODEL/modipsl/modeles/LMDZ?
     634cd $MODEL/modipsl/modeles/LMD*
     635
     636##################################################################
     637# Mise a jour eventuelle de LMDZ en cas de specification de la release svn
     638##################################################################
     639
     640if [ "$svn" = "last" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi
     641if [ "$svn" != "" ] ; then set +e ; svn upgrade ; set -e ; svn update $svnopt ; fi
    546642
    547643##################################################################
    548644# Compile LMDZ
    549645##################################################################
     646
    550647echo install.sh avant_compilation `date`
    551 if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm -j 8 -arch local" ; else makelmdz=makelmdz ; fi
    552 
    553 ./$makelmdz -d ${grid_resolution} -v $veget_version gcm
     648if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm -arch $arch -j 8" ; else makelmdz="makelmdz -arch $arch" ; fi
     649
     650# use the orchidee interface that has no z0h
     651if [ "$no_z0h_orc" = 1 ] ; then
     652veget_version="$veget_version -cpp ORCHIDEE_NOZ0H"
     653fi
     654
     655# sequential compilation and bench
     656if [ "$sequential" = 1 ] ; then
     657echo "./$makelmdz $OPT_MAKELMDZ -rrtm true -d ${grid_resolution} -v $veget_version gcm" >> compile.sh
     658chmod +x ./compile.sh ; ./compile.sh
    554659echo install.sh apres_compilation `date`
    555660
    556661
    557 if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then
    558 echo '##########################################################'
    559 echo 'Compilation successfull !! '
    560 echo '##########################################################'
     662fi # fin sequential
     663
     664
     665
     666# compiling in parallel mode
     667if [ $parallel != "none" ] ; then
     668echo '##########################################################'
     669echo ' Parallel compile '
     670echo '##########################################################'
     671# saving the sequential libs and binaries
     672cd $MODEL/modipsl
     673tar cf sequential.tar bin/ lib/
     674\rm -rf bin/ lib/
     675tar xf ioipsl.tar
     676#
     677# Orchidee
     678#
     679cd $ORCHPATH
     680if [ -d src_parallel ] ; then
     681     cd arch
     682     sed  \
     683     -e s:"%COMPILER.*.$":"%COMPILER            $par_comp":1 \
     684     -e s:"%LINK.*.$":"%LINK                $par_comp":1 \
     685     -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS          $MPI_FLAGS":1 \
     686     -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS          $OMP_FLAGS":1 \
     687     -e s:"%MPI_LD.*.$":"%MPI_LD              $MPI_LD":1 \
     688     -e s:"%OMP_LD.*.$":"%OMP_LD              $OMP_LD":1 \
     689     arch-local.fcm > tmp.fcm
     690
     691     mv tmp.fcm arch-local.fcm
     692     cd ../
     693# compiling ORCHIDEE parallel mode
     694     ./makeorchidee_fcm -j 8 -clean -noxios -prod -parallel $parallel -arch $arch
     695     ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch
     696     echo ./makeorchidee_fcm -j 8 -clean -noxios -prod -parallel $parallel -arch $arch
     697     echo ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch
     698     echo deuxieme compilation orchidee ; pwd
    561699else
    562 echo 'Compilation failed !!'
    563 exit
    564 fi
    565 
    566 ##################################################################
    567 # Below, we run a benchmark test (if bench=0)
    568 ##################################################################
    569 if [ $bench = 0 ] ; then
    570                 exit
    571 fi
    572 
    573 echo '##########################################################'
    574 echo ' Running a test run '
    575 echo '##########################################################'
    576 
    577 \rm -rf BENCH${grid_resolution}
    578 bench=bench_lmdz_${grid_resolution}
    579 echo install.sh avant_chargement_bench  `date`
    580 if [ -f $dirget/$bench.tar.gz ] ; then
    581    tar xvf $dirget/$bench.tar.gz
    582 else
    583    $wget/$bench.tar.gz
    584    echo install.sh apres_chargement_bench  `date`
    585    tar xvf $bench.tar.gz
    586 fi
    587 
    588 if [ -f gcm.e ] ; then
    589     cp gcm.e BENCH${grid_resolution}/
    590 elif [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] ; then
    591     cp bin/gcm_${grid_resolution}_phylmd_seq_orch.e  BENCH${grid_resolution}/gcm.e
    592 elif [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then
    593     cp bin/gcm_${grid_resolution}_phylmd_seq.e  BENCH${grid_resolution}/gcm.e
    594 else
    595     echo "No gcm.e found"
    596     exit
    597 fi
    598 
    599 
    600 cd BENCH${grid_resolution}
    601 ./bench.sh > bench.out  2>&1
    602 
    603 
    604 echo '##########################################################'
    605 echo ' Bench results '
    606 echo '##########################################################'
    607 
    608 cat ./bench.out
    609 echo install.sh FIN_du_BENCH  `date`
    610 
    611 echo '##########################################################'
    612 echo 'Simulation finished in' `pwd`
    613 echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e'
    614 echo 'or ./bench.sh'
    615 echo '##########################################################'
    616 
     700  echo '##########################################################'
     701  echo ' Orchidee version too old                                 '
     702  echo ' Please update to new version                             '
     703  echo '##########################################################'
     704  exit
     705fi
     706# LMDZ
     707cd $LMDZPATH
     708     if [ $arch = local ] ; then
     709     cd arch
     710     sed -e s:"%COMPILER.*.$":"%COMPILER            $par_comp":1 \
     711     -e s:"%LINK.*.$":"%LINK                $par_comp":1 \
     712     -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS          $MPI_FLAGS":1 \
     713     -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS          $OMP_FLAGS":1 \
     714     -e s:"%MPI_LD.*.$":"%MPI_LD              $MPI_LD":1 \
     715     -e s:"%OMP_LD.*.$":"%OMP_LD              $OMP_LD":1 \
     716     arch-local.fcm > tmp.fcm
     717     mv tmp.fcm arch-local.fcm
     718     cd ../
     719     fi
     720     rm -f compile.sh
     721     if [ ${hostname:0:5} = ada33 ] ; then echo "module load intel/2013.0" > compile.sh ; fi
     722     echo resol=${grid_resolution} >> compile.sh
     723     echo ./$makelmdz $OPT_MAKELMDZ -rrtm true -d \$resol -v $veget_version -mem -parallel $parallel gcm >> compile.sh
     724     chmod +x ./compile.sh ; ./compile.sh
     725
     726     echo Compilation finished
     727
     728fi
     729
     730echo LLLLLLLLLLLLLLLLLLLLLLLLLLL
    617731if [ "$gfortran" = "gfortran44" ] ; then
    618732    echo Your gfortran compiler was too old so that the model was automatically
     
    621735    echo script and reinstall.
    622736fi
     737
     738##################################################################
     739# Verification du succes de la compilation
     740##################################################################
     741
     742# Recherche de l'executable dont le nom a change au fil du temps ...
     743gcm=""
     744for exe in gcm.e bin/gcm_${grid_resolution}_phylmd_seq_orch.e bin/gcm_${grid_resolution}_phylmd_seq.e bin/gcm_${grid_resolution}_phylmd_para_mem_orch.e ; do
     745   if [ -f $exe ] ; then gcm=$exe ; fi
     746done
     747
     748if [ "$gcm" = "" ] ; then
     749   echo 'Compilation failed !!'
     750   exit
     751else
     752   echo '##########################################################'
     753   echo 'Compilation successfull !! '
     754   echo '##########################################################'
     755   echo The executable is $gcm
     756fi
     757
     758##################################################################
     759# Below, we run a benchmark test (if bench=0)
     760##################################################################
     761
     762if [ $bench != 0 ] ; then
     763
     764echo '##########################################################'
     765echo ' Running a test run '
     766echo '##########################################################'
     767
     768\rm -rf BENCH${grid_resolution}
     769bench=bench_lmdz_${grid_resolution}
     770echo install.sh avant_chargement_bench  `date`
     771#wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz
     772myget $bench.tar.gz
     773echo install.sh after bench download  `date`
     774tar xvf $bench.tar.gz
     775
     776cp $gcm BENCH${grid_resolution}/gcm.e
     777
     778
     779cd BENCH${grid_resolution}
     780# On cree le fichier bench.sh au besoin
     781# Dans le cas 48x36x39 le bench.sh existe deja en parallele
     782
     783if [ "$grid_resolution" = "48x36x39" ] ; then
     784   echo On ne touche pas au bench.sh
     785   # But we have to adapt "run_local.sh" for $mpirun
     786   sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp
     787   mv -f tmp run_local.sh
     788   chmod u=rwx run_local.sh
     789elif [ "${parallel:0:3}" = "mpi" ] ; then
     790   # Lancement avec deux procs mpi et 2 openMP
     791   echo "export OMP_STACKSIZE=800M" > bench.sh
     792   if [ "${parallel:4:3}" = "omp" ] ; then
     793     echo "export OMP_NUM_THREADS=2" >> bench.sh
     794   fi
     795   echo "ulimit -s unlimited" >> bench.sh
     796   echo "$mpirun -np 2 gcm.e > listing  2>&1" >> bench.sh
     797else
     798   echo "./gcm.e > listing  2>&1" > bench.sh
     799fi
     800echo EXECUTION DU BENCH
     801date ; ./bench.sh > out.bench 2>&1 ; date
     802tail listing
     803
     804
     805echo '##########################################################'
     806echo 'Simulation finished in' `pwd`
     807   echo 'You have compiled with:'
     808   cat ../compile.sh
     809if [ $parallel = "none" ] ; then
     810  echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e'
     811  echo 'or ./bench.sh'
     812else
     813  echo 'You may re-run it with : '
     814  echo 'cd ' `pwd` '; ./bench.sh'
     815  echo 'ulimit -s unlimited'
     816  echo 'export OMP_NUM_THREADS=2'
     817  echo 'export OMP_STACKSIZE=800M'
     818  echo "$mpirun -np 2 gcm.e "
     819fi
     820echo '##########################################################'
     821
     822fi
     823
     824
     825#################################################################
     826# Installation eventuelle du 1D
     827#################################################################
     828
     829if [ $SCM = 1 ] ; then
     830cd $MODEL
     831#wget http://www.lmd.jussieu.fr/~lmdz/Distrib/1D.tar.gz
     832myget 1D.tar.gz
     833tar xvf 1D.tar.gz
     834cd 1D
     835./run.sh
     836fi
Note: See TracChangeset for help on using the changeset viewer.