Ignore:
Timestamp:
Nov 2, 2017, 2:00:05 PM (7 years ago)
Author:
fhourdin
Message:

Update install script to also be able to download/install XIOS and NetCDF4-HDF5 libraries.
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install_lmdz.sh

    r3044 r3056  
    8989MODEL=""
    9090
     91## also compile XIOS? (and more recent NetCDF/HDF5 libraries) Default=no
     92with_xios="n"
     93opt_makelmdz_xios=""
     94
    9195#########################################################################
    9296#  Options interactives
     
    116120    -name      LOCAL_MODEL_NAME : default = LMDZversion.release
    117121
     122    -netcdf    PATH : full path to an existing installed NetCDF library
     123               (without -netcdf: also download and install the NetCDF library) 
     124   
     125    -xios      also download and compile the XIOS library
     126               (requires the NetCDF4-HDF5 library, also installed by default)
     127               (requires to also have -parallel mpi_omp)
     128
    118129    -gprof     to compile with -pg to enable profiling with gprof
     130
    119131    -SCM        install 1D version automatically
     132
    120133    -opt_makelmdz     to call makelmdz or makelmdz_fcm with additional options
    121134........fin
     
    134147     "-bench") bench=$2 ; shift ; shift ;;
    135148     "-name") MODEL=$2 ; shift ; shift ;;
     149     "-netcdf") netcdf=$2 ; shift ; shift ;;
     150     "-xios") with_xios="y" ; shift ;;
    136151     *) ./install_lmdz.sh -h ; exit
    137152   esac
     
    169184            arch=X64_ADA ;;
    170185
     186   cicla)   compilo="gfortran" ;
     187            if [ $parallel != none ] ; then
     188              module load openmpi/1.4.5-gfortran ;
     189              root_mpi=$MPI_HOME ;
     190              path_mpi=$root_mpi/bin ;
     191              par_comp=${path_mpi}/mpif90 ;
     192              mpirun=${path_mpi}/mpirun ;
     193            fi ;
     194            arch=local  ;
     195            make=make ;
     196            o_ins_make="-t g95" ;;
     197           
    171198   *)       compilo="gfortran" ;
    172199            if [ $parallel = none -o -f /usr/bin/mpif90 ] ; then
    173200                path_mpi="" ;
    174             # Pour les installations Scientifique Linux LMD ou ciclad :
     201                if [ -d /usr/lib64/openmpi ] ; then
     202                  root_mpi="/usr/lib64/openmpi"
     203                else
     204                  root_mpi="/usr"
     205                fi
     206            # For Scientifique Linux at LMD :
    175207            elif [ -f /usr/lib64/openmpi/1.4.5-gfortran/bin/mpif90 ] ; then
    176                 path_mpi=/usr/lib64/openmpi/1.4.5-gfortran/bin/ ;
     208                path_mpi=/usr/lib64/openmpi/1.4.5-gfortran/bin ;
     209                root_mpi=/usr/lib64/openmpi/1.4.5-gfortran ;
     210                export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH
    177211            else
    178                echo Je ne trouve pas mpif90 ;
     212               echo "Cannot find mpif90" ;
    179213               exit ;
    180214            fi ;
    181             par_comp=${path_mpi}mpif90 ;
    182             mpirun=${path_mpi}mpirun ;
     215            par_comp=${path_mpi}/mpif90 ;
     216            mpirun=${path_mpi}/mpirun ;
    183217            arch=local  ;
    184218            make=make ;
     
    188222
    189223# MPI_FLAGS are the flags needed for compilation with MPI
    190 MPI_FLAGS="-I/usr/include/openmpi-x86_64 -fcray-pointer"
     224#MPI_FLAGS="-I/usr/include/openmpi-x86_64 -fcray-pointer"
    191225MPI_FLAGS="-fcray-pointer"
    192226# MPI_LD are the flags needed for linking with MPI
     
    195229OMP_FLAGS="-fopenmp -fcray-pointer"
    196230# OMP_LD are the flags needed for linking with OpenMP
    197 OMP_LD="-fopenmp -L/usr/lib64 -lnuma"
     231#OMP_LD="-fopenmp -L/usr/lib64 -lnuma"
    198232OMP_LD="-fopenmp"
    199233
     
    226260#####################################################################
    227261
    228 
     262## if also compiling XIOS, parallel must be mpi_omp
     263if [ "$with_xios" = "y" -a "$parallel" != "mpi_omp" ] ; then
     264  echo "Error, you must set -parallel mpi_omp if you want XIOS"
     265  exit
     266fi
     267if [ "$with_xios" = "y" ] ; then
     268  opt_makelmdz_xios="-io xios"
     269fi
    229270
    230271echo '################################################################'
     
    394435echo '##########################################################'
    395436cd $MODEL
    396 #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.0.1.tar.gz
    397 myget netcdf-4.0.1.tar.gz
    398 gunzip netcdf-4.0.1.tar.gz
    399 tar xvf netcdf-4.0.1.tar
    400 \rm -f netcdf-4.0.1.tar
    401 
    402 cd netcdf-4.0.1
    403 
    404 sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
    405 localdir=`pwd -P`
    406 ./configure --prefix=$localdir --enable-shared --disable-cxx
    407 sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile
    408 $make check
    409 $make install
     437if [ "$with_xios" = "n" ] ; then
     438  # keep it simple
     439  #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.0.1.tar.gz
     440  myget netcdf-4.0.1.tar.gz
     441  gunzip netcdf-4.0.1.tar.gz
     442  tar xvf netcdf-4.0.1.tar
     443  \rm -f netcdf-4.0.1.tar
     444
     445  cd netcdf-4.0.1
     446
     447  # seds to possibly use gfortran44 obsolete nowdays (Ehouarn: 10/2017)
     448  #sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
     449  localdir=`pwd -P`
     450  ./configure --prefix=$localdir --enable-shared --disable-cxx
     451  #sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile
     452  $make check
     453  $make install
     454else
     455  # download and compile hdf5 and netcdf, etc. using the install_netcdf4_hdf5.bash script
     456  #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_netcdf4_hdf5.bash
     457  myget install_netcdf4_hdf5.bash
     458  chmod u=rwx install_netcdf4_hdf5.bash
     459  if [ "$compilo" = "gfortran" ] ; then
     460  ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC gcc -FC gfortran -CXX g++ -MPI $root_mpi
     461  elif [ "$compilo" = "ifort" ] ; then
     462  ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC icc -FC ifort -CXX icpc -MPI $root_mpi
     463  elif [ "$compilo" = "pgf90" ] ; then
     464  ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC pgcc -FC pgf90 -CXX pgCC -MPI $root_mpi
     465  else
     466    echo "unexpected compiler $compilo" ; exit
     467  fi
     468fi  # of if [ "$with_xios" = "n" ]
    410469echo install.sh netcdf_OK `date`
    411470fi # of if [ $netcdf = 1 ]
     
    420479
    421480if [ $netcdf = 0 -o $netcdf = 1 ] ; then
    422 ncdfdir=$MODEL/netcdf-4.0.1
     481  if [ "$with_xios" = "y" ] ; then
     482  ncdfdir=$MODEL/netcdf4_hdf5
     483  else
     484  ncdfdir=$MODEL/netcdf-4.0.1
     485  fi
    423486else
    424 ncdfdir=$netcdf
     487  ncdfdir=$netcdf
    425488fi
    426489
     
    523586  cd $MODEL/modipsl
    524587  tar cf ioipsl.tar lib/ bin/
     588
     589#===========================================================================
     590if [ "$with_xios" = "y" ] ; then
     591  echo '##########################################################'
     592  echo 'Compiling XIOS'
     593  echo '##########################################################'
     594  cd $MODEL/modipsl/modeles
     595  #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash
     596  myget install_xios.bash
     597  chmod u=rwx install_xios.bash
     598  ./install_xios.bash -prefix $MODEL/modipsl/modeles \
     599                      -netcdf ${ncdfdir} -hdf5 ${ncdfdir} \
     600                      -MPI $root_mpi -arch $arch
     601fi
    525602
    526603#============================================================================
     
    632709
    633710
    634 cd $MODEL/modipsl/modeles/LMD*
     711cd $MODEL/modipsl/modeles/LMDZ*
    635712
    636713##################################################################
    637 # Mise a jour eventuelle de LMDZ en cas de specification de la release svn
     714# Possibly update LMDZ if a specific svn release is requested
    638715##################################################################
    639716
     
    666743# compiling in parallel mode
    667744if [ $parallel != "none" ] ; then
    668 echo '##########################################################'
    669 echo ' Parallel compile '
    670 echo '##########################################################'
    671 # saving the sequential libs and binaries
    672 cd $MODEL/modipsl
    673 tar cf sequential.tar bin/ lib/
    674 \rm -rf bin/ lib/
    675 tar xf ioipsl.tar
    676 #
    677 # Orchidee
    678 #
    679 cd $ORCHPATH
    680 if [ -d src_parallel ] ; then
     745  echo '##########################################################'
     746  echo ' Parallel compile '
     747  echo '##########################################################'
     748  # saving the sequential libs and binaries
     749  cd $MODEL/modipsl
     750  tar cf sequential.tar bin/ lib/
     751  \rm -rf bin/ lib/
     752  tar xf ioipsl.tar
     753  #
     754  # Orchidee
     755  #
     756  cd $ORCHPATH
     757  if [ -d src_parallel ] ; then
    681758     cd arch
    682759     sed  \
     
    691768     mv tmp.fcm arch-local.fcm
    692769     cd ../
    693 # compiling ORCHIDEE parallel mode
     770     # compiling ORCHIDEE parallel mode
    694771     ./makeorchidee_fcm -j 8 -clean -noxios -prod -parallel $parallel -arch $arch
    695772     ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch
     
    697774     echo ./makeorchidee_fcm -j 8 -noxios -prod -parallel $parallel -arch $arch
    698775     echo deuxieme compilation orchidee ; pwd
    699 else
    700   echo '##########################################################'
    701   echo ' Orchidee version too old                                 '
    702   echo ' Please update to new version                             '
    703   echo '##########################################################'
    704   exit
    705 fi
    706 # LMDZ
    707 cd $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 
    728 fi
     776  else
     777    echo '##########################################################'
     778    echo ' Orchidee version too old                                 '
     779    echo ' Please update to new version                             '
     780    echo '##########################################################'
     781    exit
     782  fi # of if [ -d src_parallel ]
     783  # LMDZ
     784  cd $LMDZPATH
     785  if [ $arch = local ] ; then
     786    cd arch
     787    sed -e s:"%COMPILER.*.$":"%COMPILER            $par_comp":1 \
     788    -e s:"%LINK.*.$":"%LINK                $par_comp":1 \
     789    -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS          $MPI_FLAGS":1 \
     790    -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS          $OMP_FLAGS":1 \
     791    -e s@"%BASE_LD.*.$"@"%BASE_LD             -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib"@1 \
     792    -e s:"%MPI_LD.*.$":"%MPI_LD              $MPI_LD":1 \
     793    -e s:"%OMP_LD.*.$":"%OMP_LD              $OMP_LD":1 \
     794    arch-local.fcm > tmp.fcm
     795    mv tmp.fcm arch-local.fcm
     796    cd ../
     797  fi
     798  rm -f compile.sh
     799  if [ ${hostname:0:5} = ada33 ] ; then echo "module load intel/2013.0" > compile.sh ; fi
     800  echo resol=${grid_resolution} >> compile.sh
     801  echo ./$makelmdz $OPT_MAKELMDZ -rrtm true $opt_makelmdz_xios -d \$resol -v $veget_version -mem -parallel $parallel gcm >> compile.sh
     802  chmod +x ./compile.sh ; ./compile.sh
     803
     804  echo "Compilation finished"
     805 
     806fi # of if [ $parallel != "none" ]
    729807
    730808echo LLLLLLLLLLLLLLLLLLLLLLLLLLL
     
    748826if [ "$gcm" = "" ] ; then
    749827   echo 'Compilation failed !!'
    750    exit
     828   # Ehouarn : temporary, do not exit and let job finish (to set up bench case)
     829   #exit
     830   set +e
    751831else
    752832   echo '##########################################################'
     
    774854tar xvf $bench.tar.gz
    775855
     856if [ "$with_xios" = "y" ] ; then
     857  cd BENCH${grid_resolution}
     858  cp ../DefLists/iodef.xml .
     859  cp ../DefLists/context_lmdz.xml .
     860  cp ../DefLists/field_def_lmdz.xml .
     861  cp ../DefLists/file_def_hist*xml .
     862  # adapt iodef.xml to use attached mode
     863  sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' iodef.xml > tmp
     864  \mv -f tmp iodef.xml
     865  # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE.
     866  # except for histday
     867  for histfile in file_def_hist*xml
     868  do
     869    if [ "$histfile" = "file_def_histday_lmdz.xml" ] ; then
     870    sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' $histfile > tmp ; \mv -f tmp $histfile
     871    else
     872    sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' $histfile > tmp ; \mv -f tmp $histfile
     873    fi
     874  done
     875  # and add option "ok_all_xml=y" in config.def
     876  echo "### XIOS outputs" >> config.def
     877  echo 'ok_all_xml=.true.' >> config.def
     878  cd ..
     879fi
     880
    776881cp $gcm BENCH${grid_resolution}/gcm.e
    777 
    778882
    779883cd BENCH${grid_resolution}
Note: See TracChangeset for help on using the changeset viewer.