Ignore:
Timestamp:
Nov 22, 2011, 4:00:48 PM (13 years ago)
Author:
jghattas
Message:

Updated install.sh :

  • Alwas compile netcdf with r4.
  • Added option real=r4 or =r8(defaut) for the compiling of LMDZ. If r8, then also adding cpp key NC_DOUBLE.

FH

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install.sh

    r1588 r1589  
    2626# Pré-requis : g95/pgf90/gfortran, ksh, wget , gunzip, tar, ... (à compléter)
    2727#
     28# Modif 18/11/2011
     29#    changement pour l'option real 8.
     30#      On compile avec -r8 (ou équivalent) et -DNC_DOUBLE pour le GCM
     31#      mais avec -r4 netcdf. La variable real est initialisée à
     32#      r4 ou r8 en début de script.
     33#
    2834###########################################################################
    2935
     
    3238echo '################################################################'
    3339
     40
     41real=r4
     42real=r8
    3443
    3544# ATTENTION !!!! Pour des versions anterieures a octobre 2009, utiliser
     
    5766compile_with_fcm=0
    5867
     68OPTPREC=""
    5969echo '################################################################'
    6070echo  Choix des options de compilation
    6171echo '################################################################'
     72
    6273if [ $compilo = g95 ] ; then
    63    OPTIM='-i4 -r8 -O3'
     74   if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
     75   OPTIM='-i4 -O3'
    6476elif [ $compilo = gfortran ] ; then
    65    OPTIM='-O3 -fdefault-real-8'
     77   if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi
     78   OPTIM='-O3'
    6679else #pgf90
     80   if [ $real = r8 ] ; then echo "Option real 8 non disponible pour pgf90" ; exit ; fi
    6781   OPTIM='-O2 -Munroll -Mnoframe -Mautoinline -Mcache_align'
    6882fi
     83OPTIMGCM="$OPTIM $OPTPREC"
    6984
    7085# choix de la resolution pour le bench
     
    177192cd netcdf-4.0.1
    178193
     194OPTIMNC=$OPTIM
    179195if [ $compilo = g95 ] ; then
    180196# On modifie les options de compilation
    181197   export FC=g95
    182198   export F90=g95
    183    export F90FLAGS=" -cpp -ffree-form $OPTIM"
    184    export FFLAGS=" -cpp $OPTIM"
     199   export F90FLAGS=" -cpp -ffree-form $OPTIMNC"
     200   export FFLAGS=" -cpp $OPTIMNC"
    185201   export CPPFLAGS=-Df2cFortran
    186202   export CC=gcc
     
    189205   export FC=gfortran
    190206   export F90=gfortran
    191    export F90FLAGS=" -ffree-form $OPTIM"
    192    export FFLAGS=" $OPTIM"
     207   export F90FLAGS=" -ffree-form $OPTIMNC"
     208   export FFLAGS=" $OPTIMNC"
    193209   export CPPFLAGS=
    194210   export CC=gcc
     
    201217   export CXXFLAGS="-Msignextend"
    202218   export FC=pgf90
    203    export FFLAGS="$OPTIM"
     219   export FFLAGS="$OPTIMNC"
    204220   export F90=pgf90
    205    export F90FLAGS="$OPTIM"
     221   export F90FLAGS="$OPTIMNC"
    206222else
    207223   echo Le compilateur $compilo pas prevu ; exit
     
    251267sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp
    252268sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $compilo -c": \
    253 -e 's/g95.*.w_w.*.(F_D)/g95      w_w = '"$OPTIM"'/' \
     269-e 's/g95.*.w_w.*.(F_D)/g95      w_w = '"$OPTIMGCM"'/' \
    254270-e 's:g95.*.NCDF_INC.*.$:g95      NCDF_INC='"$ncdfdir"'/include:' \
    255271-e 's:g95.*.NCDF_LIB.*.$:g95      NCDF_LIB='"$ncdfdir"'/lib:' \
     
    301317cd src_parameters
    302318# Une petite astuce pour ORCHIDEE suivant qu'on est en real*4 ou real*8
    303 if [ $compilo = gfortran ] ; then
    304   if [ "`echo $OPTIM | grep real-8`" = "" ] ; then real=r4 ; else real=r8 ; fi
    305 else # g95 ou pgf90
    306   if [ "`echo $OPTIM | grep r8`" = "" ] ; then real=r4 ; else real=r8 ; fi
    307 fi
     319
     320
    308321\cp reqdprec.$real reqdprec.f90
    309322make
     
    357370-e 's/-lorglob//' \
    358371-e 's/-ffixed-form//' -e 's/-ffree-form//' \
    359 -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIM"\"'/' makegcm.orig >| makegcm
     372-e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
    360373  else # g95 or pgf90
    361374sed \
     
    369382-e 's/-lorglob//' \
    370383-e 's/-ffixed-form//' -e 's/-ffree-form//' \
    371 -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIM"\"'/' makegcm.orig >| makegcm
     384-e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
    372385  fi
    373386else
     
    403416    -e s:"%LINK                pgf95":"%LINK                g95":1 \
    404417    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         ":1 \
    405     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIM":1 \
     418    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIMGCM":1 \
    406419   arch-linux-32bit.fcm > arch-local.fcm
    407    if [ "`echo $OPTIM | grep r8`" != "" ] ; then
     420   if [ $real = r8 ] ; then
    408421     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    409422     arch-local.fcm > arch-local.fcm.new
     
    414427    -e s:"%LINK                pgf95":"%LINK                gfortran":1 \
    415428    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         ":1 \
    416     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIM":1 \
     429    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIMGCM":1 \
    417430   arch-linux-32bit.fcm > arch-local.fcm
    418    if [ "`echo $OPTIM | grep real-8`" != "" ] ; then
     431   if [ $real = r8 ] ; then
    419432     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    420433     arch-local.fcm > arch-local.fcm.new
     
    424437sed -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \
    425438    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         ":1 \
    426     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIM":1 \
     439    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTIMGCM":1 \
    427440   arch-linux-32bit.fcm > arch-local.fcm
    428    if [ "`echo $OPTIM | grep r8`" != "" ] ; then
     441   if [ $real = r8] ; then
    429442     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    430443     arch-local.fcm > arch-local.fcm.new
Note: See TracChangeset for help on using the changeset viewer.