Changeset 2031


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

Simplification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install.sh

    r2030 r2031  
    3333
    3434echo install.sh DEBUT `date`
     35
    3536set -e
    3637
     
    4849version=20130716.trunk
    4950version=testing
     51compilo=gfortran # compilo=pgf90 or g95 or gfortran or ifort sur PC linux
    5052
    5153#Chemin pour placer le modele
    5254MODEL=./LMDZ$version
     55
    5356
    5457getlmdzor=1
     
    6265bench=1
    6366pclinux=1
    64 compilo=gfortran # compilo=pgf90 or g95 or gfortran or ifort sur PC linux
     67
     68# choose the resolution for the bench runs
     69# grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE)
     70#                  96x71x19  standard configuration
     71grid_resolution=48x36x19
     72
     73## compile_with_fcm=1 : use makelmdz_fcm, possible a of version 20111103.trunk (LMDZ5/trunk rev 1578)
     74## compile_with_fcm=0 : use makelmdz
     75compile_with_fcm=0
    6576
    6677
     
    94105
    95106
    96 ## compile_with_fcm=1 : use makelmdz_fcm, possible a of version 20111103.trunk (LMDZ5/trunk rev 1578)
    97 ## compile_with_fcm=0 : use makelmdz
    98 compile_with_fcm=0
    99 
    100107OPTPREC=""
    101108echo '################################################################'
     
    103110echo '################################################################'
    104111
     112OPTIMNC=$OPTIM
     113export FC=$compilo
     114export F90=$compilo
     115export F77=$compilo
     116export CPPFLAGS=
     117BASE_LD=
    105118if [ $compilo = g95 ] ; then
     119# Set the appropriate compilation options
     120   OPTIM='-i4 -O3'
     121   OPTDEB="-g -O0 -Wall -ftrace=full -fbounds-check -freal=nan"
     122   OPTDEV="-g -O1 -Wall"
     123   fmod='fmod='
     124   BASE_LD=""
    106125   if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
    107    OPTIM='-i4 -O3'
     126   export F90FLAGS=" -cpp -ffree-form $OPTIMNC"
     127   export FFLAGS=" -cpp $OPTIMNC"
     128   export CPPFLAGS=-Df2cFortran
     129   export CC=gcc
     130   export CXX=g++
    108131elif [ $compilo = $gfortran ] ; then
     132   OPTIM='-O3'
     133   OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all"
     134   OPTDEV="-Wall -fbounds-check"
     135   fmod='I '
    109136   if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi
     137   export F90FLAGS=" -ffree-form $OPTIMNC"
     138   export FFLAGS=" $OPTIMNC"
     139   export CC=gcc
     140   export CXX=g++
     141elif [ $compilo = mpif90 ] ; then
    110142   OPTIM='-O3'
     143   OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all"
     144   OPTDEV="-Wall -fbounds-check"
     145   BASE_LD="-lblas"
     146   fmod='I '
     147   if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi
     148   export F90FLAGS=" -ffree-form $OPTIMNC"
     149   export FFLAGS=" $OPTIMNC"
     150   export CC=gcc
     151   export CXX=g++
    111152elif [ $compilo = pgf90 ] ; then
     153   OPTIM='-O2 -Munroll -Mnoframe -Mautoinline -Mcache_align'
     154   fmod='module '
    112155   if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi
    113    OPTIM='-O2 -Munroll -Mnoframe -Mautoinline -Mcache_align'
    114    # with pgf90, compile with fcm
     156   export CPPFLAGS="-DNDEBUG -DpgiFortran"
     157   export CC=pgcc
     158   export CFLAGS="-Msignextend"
     159   export CXX=pgCC
     160   export CXXFLAGS="-Msignextend"
     161   export FFLAGS="$OPTIMNC"
     162   export F90FLAGS="$OPTIMNC"
    115163   compile_with_fcm=1
    116 else
    117    # ifort
     164elif [ $compilo = ifort ] ; then
     165   OPTIM="-O2 -fp-model strict -ip -align all "
     166   OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check"
     167   OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check"
     168   fmod='module '
    118169   if [ $real = r8 ] ; then OPTPREC="-real-size 64 -DNC_DOUBLE" ; fi
    119    OPTIM="-O2 -fp-model strict -ip -align all "
    120    # with ifort, compile with fcm
     170   export CPP="icc -E"
     171   export FFLAGS="-O2 -ip -fpic -mcmodel=large"
     172   export FCFLAGS="-O2 -ip -fpic -mcmodel=large"
     173   export CC=icc
     174   export CFLAGS="-O2 -ip -fpic -mcmodel=large"
     175   export CXX=icpc
     176   export CXXFLAGS="-O2 -ip -fpic -mcmodel=large"
    121177   compile_with_fcm=1
    122 fi
     178else
     179   echo unexpected compiler $compilo ; exit
     180fi
     181
    123182OPTIMGCM="$OPTIM $OPTPREC"
    124 
    125 # choose the resolution for the bench runs
    126 # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE)
    127 #                  96x71x19  standard configuration
    128 grid_resolution=48x36x19
    129183
    130184hostname=`hostname`
     
    199253
    200254###########################################################################
    201 
    202 
    203 
    204 
    205255if [ $getlmdzor = 1 ] ; then
    206256echo '##########################################################'
     
    234284
    235285cd netcdf-4.0.1
    236 
    237 OPTIMNC=$OPTIM
    238 if [ $compilo = g95 ] ; then
    239 # Set the appropriate compilation options
    240    export FC=g95
    241    export F90=g95
    242    export F90FLAGS=" -cpp -ffree-form $OPTIMNC"
    243    export FFLAGS=" -cpp $OPTIMNC"
    244    export CPPFLAGS=-Df2cFortran
    245    export CC=gcc
    246    export CXX=g++
    247 elif [ $compilo = $gfortran ] ; then
    248    export FC=$gfortran
    249    export F90=$gfortran
    250    export F90FLAGS=" -ffree-form $OPTIMNC"
    251    export FFLAGS=" $OPTIMNC"
    252    export CPPFLAGS=
    253    export CC=gcc
    254    export CXX=g++
    255 elif [ $compilo = pgf90 ] ; then
    256    export CPPFLAGS="-DNDEBUG -DpgiFortran"
    257    export CC=pgcc
    258    export CFLAGS="-Msignextend"
    259    export CXX=pgCC
    260    export CXXFLAGS="-Msignextend"
    261    export FC=pgf90
    262    export FFLAGS="$OPTIMNC"
    263    export F90=pgf90
    264    export F90FLAGS="$OPTIMNC"
    265 elif [ $compilo = ifort ] ; then
    266    export CPP="icc -E"
    267    export F77=ifort
    268    export FFLAGS="-O2 -ip -fpic -mcmodel=large"
    269    export F90=ifort
    270    export FCFLAGS="-O2 -ip -fpic -mcmodel=large"
    271    export CC=icc
    272    export CFLAGS="-O2 -ip -fpic -mcmodel=large"
    273    export CXX=icpc
    274    export CXXFLAGS="-O2 -ip -fpic -mcmodel=large"
    275 else
    276    echo unexpected compiler $compilo ; exit
    277 fi
    278286
    279287sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
     
    303311  cd $MODEL/modipsl
    304312  \rm -rf lib/*
     313
    305314  cd util
    306315
    307   if [ $compilo = pgf90 ] ; then
    308     fmod='module '
    309   elif [ $compilo = g95 ] ; then
    310     fmod='fmod='
    311   elif [ $compilo = ifort ] ; then
    312     fmod='module '
    313   else # gfortran
    314     fmod='I '
    315   fi
    316316  cp AA_make.gdef AA_make.orig
    317   F_C="$compilo -c " ; if [ $compilo = $gfortran ] ; then F_C="$compilo -c -cpp " ; fi
     317  F_C="$compilo -c " ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then F_C="$compilo -c -cpp " ; fi
    318318  sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp
    319319  sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $F_C": \
     
    340340  fi # of if [ "$use_shell" = "ksh" ]
    341341
     342#=======================================================================================
    342343  echo '##########################################################'
    343344  echo 'Compiling IOIPSL, the interface library with Netcdf'
     
    357358    make clean
    358359    make
    359     if [ $compilo = $gfortran ] ; then # copy module files to lib
     360    if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then # copy module files to lib
    360361      cp -f *.mod ../../../lib
    361362    fi
     
    433434      if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi
    434435      cd $src_d ; \rm -f *.mod make ; make clean
    435       make ; if [ $compilo = $gfortran ] ; then cp -f *.mod ../../../lib ; fi
     436      make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi
    436437      cd ..
    437438  done
     
    452453fi
    453454
    454 #============================================================================
    455 # Traitement momentanne a cause d'un bug dans makegcm
    456 cp create_make_gcm create_make_gcm.orig
    457 nl=`sed -n -e /PROGRAM/= create_make_gcm.orig | tail -1`
    458 sed -e "$nl s/      PROGRA/PROGRA/" create_make_gcm.orig >| create_make_gcm
    459 
    460 
    461455###########################################################
    462456# For those who want to use fcm to compile via :
     
    464458############################################################
    465459
    466 if [ "$pclinux" = 1 ] ; then
     460if [ "$pclinux" = "1" ] ; then
     461
    467462# create local 'arch' files (if on Linux PC):
    468463cd arch
    469464# arch-local.path file
    470465echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf\"" > arch-local.path
     466echo OK3
    471467echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path
    472468echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path
     
    475471echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path
    476472# arch-local.fcm file (adapted from arch-linux-32bit.fcm)
    477 if [ $compilo = g95 ] ; then
    478 sed -e s:"%COMPILER            pgf95":"%COMPILER            g95":1 \
    479     -e s:"%LINK                pgf95":"%LINK                g95":1 \
    480     -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
    481     -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -g -O1 -Wall":1 \
    482     -e s:"%DEBUG_FFLAGS        -g -O0 -Kieee -Ktrap=fp -Mbounds":"%DEBUG_FFLAGS        -g -O0 -Wall -ftrace=full -fbounds-check -freal=nan":1 \
    483     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
    484    arch-linux-32bit.fcm > arch-local.fcm
    485    if [ $real = r8 ] ; then
    486      sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    487      arch-local.fcm > arch-local.fcm.new
    488      mv -f arch-local.fcm.new arch-local.fcm
    489    fi
    490 elif [ $compilo = $gfortran ] ; then
    491 sed -e s:"%COMPILER            pgf95":"%COMPILER            $gfortran":1 \
    492     -e s:"%LINK                pgf95":"%LINK                $gfortran":1 \
    493     -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
    494     -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -Wall -fbounds-check":1 \
    495     -e s:"%DEBUG_FFLAGS        -g -O0 -Kieee -Ktrap=fp -Mbounds":"%DEBUG_FFLAGS        -g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all":1 \
    496     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
    497    arch-linux-32bit.fcm > arch-local.fcm
    498    if [ $real = r8 ] ; then
    499      sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    500      arch-local.fcm > arch-local.fcm.new
    501      mv -f arch-local.fcm.new arch-local.fcm
    502    fi
    503 elif [ $compilo = pgf90 ] ; then
    504 sed -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \
    505     -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
    506     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
    507    arch-linux-32bit.fcm > arch-local.fcm
    508    if [ $real = r8 ] ; then
    509      sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    510      arch-local.fcm > arch-local.fcm.new
    511      mv -f arch-local.fcm.new arch-local.fcm
    512    fi
    513 elif [ $compilo = ifort ] ; then
    514 sed -e s:"%COMPILER            pgf95":"%COMPILER            ifort":1 \
    515     -e s:"%LINK                pgf95":"%LINK                ifort":1 \
    516     -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \
    517     -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
    518     -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
    519     -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -p -g -O2 -traceback -fp-stack-check -ftrapuv -check":1 \
    520     -e s:"%DEBUG_FFLAGS        -g -O0 -Kieee -Ktrap=fp -Mbounds":"%DEBUG_FFLAGS        -g -no-ftz -traceback -ftrapuv -fp-stack-check -check":1 \
    521    arch-linux-32bit.fcm > arch-local.fcm
    522    if [ $real = r8 ] ; then
    523      sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
    524      arch-local.fcm > arch-local.fcm.new
    525      mv -f arch-local.fcm.new arch-local.fcm
    526    fi
    527 else
    528    echo Unexpected compiler $compilo ; exit
    529 fi # of if [ $compilo = g95 ] elif [ $compilo = pgf90 ]
     473
     474if [ $real = r8 ] ; then FPP_DEF=NC_DOUBLE ; else FPP_DEF="" ; fi
     475sed -e s:"%COMPILER        .*.$":"%COMPILER            $compilo":1 \
     476    -e s:"%LINK            .*.$":"%LINK                $compilo":1 \
     477    -e s:"%PROD_FFLAGS     .*.$":"%PROD_FFLAGS         $OPTIM":1 \
     478    -e s:"%DEV_FFLAGS      .*.$":"%DEV_FFLAGS          $OPTDEV":1 \
     479    -e s:"%DEBUG_FFLAGS    .*.$":"%DEBUG_FFLAGS        $OPTDEB":1 \
     480    -e s:"%BASE_FFLAGS     .*.$":"%BASE_FFLAGS         $OPTPREC":1 \
     481    arch-linux-32bit.fcm > arch-local.fcm
     482
    530483cd ..
    531484### Adapt "bld.cfg" (add the shell):
     
    542495##################################################################
    543496echo install.sh avant_compilation `date`
    544 #ok_veget=false
    545 #if [ "$veget" = 1 ] ; then ok_veget=true ; fi
    546497if [ $compile_with_fcm = 1 ] ; then makelmdz=makelmdz_fcm ; else makelmdz=makelmdz ; fi
    547 if [ "$pclinux" = 1 ] ; then
    548         ./$makelmdz -d ${grid_resolution} -arch local -v $veget_version gcm
    549 else
    550    # we are on Ada
    551     ./$makelmdz -d ${grid_resolution} -arch X64_ADA -v $veget_version gcm
    552 fi
     498
     499./$makelmdz -d ${grid_resolution} -v $veget_version gcm
    553500echo install.sh apres_compilation `date`
    554501
     
    611558echo '##########################################################'
    612559
    613 if [ $gfortran = gfortran44 ] ; then
     560if [ "$gfortran" = "gfortran44" ] ; then
    614561    echo Your gfortran compiler was too old so that the model was automatically
    615562    echo compiled with gfortran44 instead. It can not be used in parallel mode.
Note: See TracChangeset for help on using the changeset viewer.