Ignore:
Timestamp:
May 2, 2014, 9:12:40 AM (11 years ago)
Author:
fhourdin
Message:

Simplification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install.sh

    r1911 r2030  
    3232###########################################################################
    3333
     34echo install.sh DEBUT `date`
    3435set -e
    3536
     
    6667#####################################################################
    6768# Test for old gfortran compilers
     69# If the compiler is too old (older than 4.3.x) we test if the
     70# temporary gfortran44 patch is available on the computer in which
     71# case the compiler is changed from gfortran to gfortran44
     72# Must be aware than parallelism can not be activated in this case
     73#####################################################################
     74
    6875if [ $compilo = gfortran ] ; then
     76   gfortran=gfortran
    6977   gfortranv=`gfortran --version | \
    7078   head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } '`
     
    7482       echo compilo=xxx
    7583       echo in the install.sh script and rerun it
    76        exit
     84       if [ `which gfortran44 | wc -w` -ne 0 ] ; then
     85          gfortran=gfortran44
     86       else
     87          echo gfotran trop vieux ; exit
     88       fi
    7789   fi
     90   compilo=$gfortran
    7891fi
    7992#####################################################################
     
    93106   if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
    94107   OPTIM='-i4 -O3'
    95 elif [ $compilo = gfortran ] ; then
     108elif [ $compilo = $gfortran ] ; then
    96109   if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi
    97110   OPTIM='-O3'
     
    173186if [ $pclinux = 1 ] ; then
    174187cd $MODEL
    175 cat <<eod> tt.f90
     188cat <<eod > tt.f90
    176189print*,'coucou'
    177190end
     
    189202
    190203
     204
    191205if [ $getlmdzor = 1 ] ; then
    192206echo '##########################################################'
     
    195209cd $MODEL
    196210wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/modipsl.$version.tar.gz
     211echo install.sh wget_OK `date`
    197212gunzip modipsl.$version.tar.gz
    198213tar xvf modipsl.$version.tar
     
    230245   export CC=gcc
    231246   export CXX=g++
    232 elif [ $compilo = gfortran ] ; then
    233    export FC=gfortran
    234    export F90=gfortran
     247elif [ $compilo = $gfortran ] ; then
     248   export FC=$gfortran
     249   export F90=$gfortran
    235250   export F90FLAGS=" -ffree-form $OPTIMNC"
    236251   export FFLAGS=" $OPTIMNC"
     
    262277fi
    263278
     279sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
    264280localdir=`pwd -P`
    265281./configure --prefix=$localdir
     282sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile
    266283make check
    267284make install
     285echo install.sh netcdf_OK `date`
    268286fi # of if [ $netcdf = 1 ]
     287
    269288
    270289#=======================================================================================
     
    283302if [ $ioipsl = 1 ] ; then
    284303  cd $MODEL/modipsl
    285   rm -rf lib/*
    286 
     304  \rm -rf lib/*
    287305  cd util
    288306
     
    297315  fi
    298316  cp AA_make.gdef AA_make.orig
    299   F_C="$compilo -c " ; if [ $compilo = gfortran ] ; then F_C="$compilo -c -cpp " ; fi
     317  F_C="$compilo -c " ; if [ $compilo = $gfortran ] ; then F_C="$compilo -c -cpp " ; fi
    300318  sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp
    301319  sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $F_C": \
     
    339357    make clean
    340358    make
    341     if [ $compilo = gfortran ] ; then # copy module files to lib
     359    if [ $compilo = $gfortran ] ; then # copy module files to lib
    342360      cp -f *.mod ../../../lib
    343361    fi
     
    386404
    387405  fi # of if [ ${hostname:0:5} = ada33 ]
     406  echo install.sh ioipsl_OK `date`
    388407fi # of if [ $ioipsl = 1 ]
     408
    389409
    390410#============================================================================
     
    413433      if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi
    414434      cd $src_d ; \rm -f *.mod make ; make clean
    415       make ; if [ $compilo = gfortran ] ; then cp -f *.mod ../../../lib ; fi
     435      make ; if [ $compilo = $gfortran ] ; then cp -f *.mod ../../../lib ; fi
    416436      cd ..
    417437  done
     438  echo install.sh orchidee_OK `date`
    418439fi # of if [ "$veget" = 1 ]
     440
    419441
    420442#============================================================================
     
    436458sed -e "$nl s/      PROGRA/PROGRA/" create_make_gcm.orig >| create_make_gcm
    437459
    438 #mv -f tmp crea
    439 if [ "$pclinux" = 1 ] ; then
    440   if [ $compilo = gfortran ] ; then
    441 sed \
    442 -e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    443 -e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    444 -e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    445 -e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    446 -e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
    447 -e 's/g95/gfortran/g' \
    448 -e 's/-fmod=/-I/g' \
    449 -e 's/-fno-second-underscore//' -e 's/-fstatic//' \
    450 -e 's/-lparallel//' \
    451 -e 's/-lnetcdff//g' \
    452 -e 's/-lorglob//' \
    453 -e 's/-ffixed-form//' -e 's/-ffree-form//' \
    454 -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
    455   elif [ $compilo = ifort ] ; then
    456 sed \
    457 -e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    458 -e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    459 -e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    460 -e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    461 -e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
    462 -e 's/g95/ifort/g' \
    463 -e 's/-fmod=/-module /g' \
    464 -e 's/-fno-second-underscore//' -e 's/-fstatic//' \
    465 -e 's/-lparallel//' \
    466 -e 's/-lnetcdff//g' \
    467 -e 's/-lorglob//' \
    468 -e 's/-ffixed-form//' -e 's/-ffree-form//' \
    469 -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
    470   else # g95 or pgf90
    471 sed \
    472 -e 's:\#setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    473 -e 's:\#setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    474 -e 's:setenv NCDFINC.*.$:setenv NCDFINC '"$ncdfdir"'/include:' \
    475 -e 's:setenv NCDFLIB.*.$:setenv NCDFLIB '"$ncdfdir"'/lib:' \
    476 -e 's/set FC_LINUX.*.$/set FC_LINUX='$compilo'/' \
    477 -e 's/-fno-second-underscore//' -e 's/-fstatic//' \
    478 -e 's/-lparallel//' \
    479 -e 's/-lnetcdff//g' \
    480 -e 's/-lorglob//' \
    481 -e 's/-ffixed-form//' -e 's/-ffree-form//' \
    482 -e 's/set OPT_LINUX.*.$/set OPT_LINUX=\"'"$OPTIMGCM"\"'/' makegcm.orig >| makegcm
    483   fi
    484 else
    485 sed \
    486 -e 's/-lparallel//' \
    487 -e 's/-lorglob//' \
    488 -e 's/-lsxorglob//' \
    489 -e 's/-lsxparallel//' \
    490 -e 's/-lsxioipsl/-lioipsl/g' \
    491 makegcm.orig >| makegcm
    492 fi
    493 
    494 chmod +x makegcm
    495460
    496461###########################################################
     
    523488     mv -f arch-local.fcm.new arch-local.fcm
    524489   fi
    525 elif [ $compilo = gfortran ] ; then
    526 sed -e s:"%COMPILER            pgf95":"%COMPILER            gfortran":1 \
    527     -e s:"%LINK                pgf95":"%LINK                gfortran":1 \
     490elif [ $compilo = $gfortran ] ; then
     491sed -e s:"%COMPILER            pgf95":"%COMPILER            $gfortran":1 \
     492    -e s:"%LINK                pgf95":"%LINK                $gfortran":1 \
    528493    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
    529494    -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -Wall -fbounds-check":1 \
     
    576541# Compile LMDZ
    577542##################################################################
     543echo install.sh avant_compilation `date`
    578544#ok_veget=false
    579545#if [ "$veget" = 1 ] ; then ok_veget=true ; fi
     
    585551    ./$makelmdz -d ${grid_resolution} -arch X64_ADA -v $veget_version gcm
    586552fi
     553echo install.sh apres_compilation `date`
     554
    587555
    588556if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then
     
    606574echo '##########################################################'
    607575
    608 rm -rf BENCH${grid_resolution}
     576\rm -rf BENCH${grid_resolution}
    609577bench=bench_lmdz_${grid_resolution}
     578echo install.sh avant_chargement_bench  `date`
    610579wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/$bench.tar.gz
     580echo install.sh apres_chargement_bench  `date`
    611581gunzip $bench.tar.gz
    612582tar xvf $bench.tar
     
    623593fi
    624594
     595
    625596cd BENCH${grid_resolution}
    626597./bench.sh > bench.out  2>&1
    627598
     599
    628600echo '##########################################################'
    629601echo ' Bench results '
     
    631603
    632604cat ./bench.out
     605echo install.sh FIN_du_BENCH  `date`
    633606
    634607echo '##########################################################'
     
    637610echo 'or ./bench.sh'
    638611echo '##########################################################'
     612
     613if [ $gfortran = gfortran44 ] ; then
     614    echo Your gfortran compiler was too old so that the model was automatically
     615    echo compiled with gfortran44 instead. It can not be used in parallel mode.
     616    echo You can change the compiler at the begining of the install.sh
     617    echo script and reinstall.
     618fi
Note: See TracChangeset for help on using the changeset viewer.