Changeset 4871


Ignore:
Timestamp:
Mar 25, 2024, 10:27:44 AM (8 months ago)
Author:
abarral
Message:

(WIP)
fix IOIPSL fcm arch
refactor install_xios

Location:
BOL/script_install_amaury
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install_amaury/install_lmdz.sh

    r4862 r4871  
    3838### Functions
    3939
    40 function myget {
    41     # A function to fetch files either locally or on the internet
    42 
    43     local file_name=$1
    44     # Path on local computer where to look for the datafile
    45     if [[ -f "/u/lmdz/WWW/LMDZ/pub/$file_name" ]]; then
    46         \cp -f -p "/u/lmdz/WWW/LMDZ/pub/$file_name" .
    47     elif [[ -f ~"/LMDZ/pub/$file_name" ]]; then
    48         \cp -f -p ~"/LMDZ/pub/$file_name" .
    49     else
    50         wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$file_name"
    51     fi
     40function myget { # Get a file from LMDZ repository
     41  local url=$1
     42
     43  local filename
     44  filename=$(basename "$url")
     45
     46  wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$url"
     47  if [[ $filename =~ .*\.(ba)?sh ]]; then chmod +x "$filename"; fi
    5248}
    5349
     
    323319        \rm "modipsl.$version.tar"
    324320    fi
     321
     322    if [[ $svn != "" ]]; then
     323        mysvn=$svn
     324    else
     325        mysvn="$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)"
     326    fi
     327    echo "SVN revision used: $mysvn"
     328}
     329
     330function setup_local_arch {
     331    # Setup local arch, and correspondance between arch names accross different programs
     332
     333    case $arch in
     334        local)
     335            arch_ioipsl="gfortran"
     336            arch_xios="local"
     337
     338            cat <<EOF >"$MODEL/modipsl/modeles/IOIPSL/arch/arch-${arch_ioipsl}.path"  # fix bad IOIPSL arch files...
     339NETCDF_INCDIR="\$(nf-config --fflags)"
     340NETCDF_LIBDIR="\$(nf-config --flibs)"
     341EOF
     342        ;;
     343      *) arch_ioipsl=$arch
     344         arch_xios=$arch
     345  esac
    325346}
    326347
     
    405426    echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)"
    406427
    407     if ! ./makeioipsl_fcm -job 8 > "$ioipsllog" 2>&1; then
     428    if ! ./makeioipsl_fcm -arch "$arch_ioipsl" -job 8 > "$ioipsllog" 2>&1; then
    408429      echo "IOIPSL compile failed, exiting"; exit 1
    409430    fi
     
    413434}
    414435
     436function install_XIOS {
     437    if [[ $with_xios = "y"  && ! -f "$MODEL/modipsl/modeles/XIOS/lib/libxios.a" ]]; then
     438        cd "$MODEL/modipsl/modeles"
     439        xioslog="$(pwd)/xios.log"
     440        echo "##########################################################"
     441        echo "Compiling XIOS (log $xioslog) $(date)"
     442        echo "##########################################################"
     443        myget script_install/install_xios.bash
     444
     445        if ! ./install_xios.bash -prefix "$MODEL/modipsl/modeles" -arch "$arch_xios" > "$xioslog" 2>&1; then
     446            echo "XIOS compilation failed, exiting"; exit 1
     447        fi
     448
     449        echo "Compiled XIOS $(date)"
     450    fi
     451}
     452
    415453echo "install_lmdz.sh DEBUT $(date)"
    416454
     
    419457check_available_software
    420458download_model
     459setup_local_arch
    421460install_netcdf
    422461install_IOIPSL
     462install_XIOS
     463
     464exit 0
    423465
    424466
     
    562604
    563605
    564 if [[ "$with_xios" = "y" ]]; then
    565     echo '##########################################################'
    566     echo 'Compiling XIOS'
    567     echo '##########################################################'
    568     cd "$MODEL/modipsl/modeles"
    569     xioslog="$(pwd)/xios.log"
    570     #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash
    571     myget script_install/install_xios.bash
    572     chmod u=rwx install_xios.bash
    573 # following will be recalculated later on once LMDZ is updated
    574 #    mysvn=`svnversion LMDZ | egrep || "[0-9]+" 2>/dev/null`
    575     mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)
    576     if [[ $svn != "" ]]; then mysvn=$svn; fi
    577     echo "mysvn $mysvn"
    578 
    579     if [[ ${hostname:0:5} = jean- ]]; then
    580         if [[ $mysvn -ge 4619 ]]; then
    581             svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 XIOS
    582         else
    583             svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 XIOS
    584         fi
    585         cd XIOS/arch
    586         svn update
    587         cd ..
    588         echo "Compiling XIOS, start $(date) (it takes about 20 min on Jean-Zay)"
    589         echo "log file: $xioslog"
    590         ./make_xios --prod --arch $arch --job 4 > xios.log 2>&1
    591     else
    592         ./install_xios.bash -prefix "$MODEL/modipsl/modeles" \
    593                             -netcdf "$ncdfdir" -hdf5 "$ncdfdir" \
    594                             -MPI "$root_mpi" -arch $arch > xios.log 2>&1
    595     fi # of case Jean-Zay
    596     if [[ -f XIOS/lib/libxios.a ]]; then
    597         echo "XIOS library successfully generated"
    598         echo install_lmdz.sh XIOS_OK "$(date)"
    599     fi
    600 fi
    601 
    602606#============================================================================
    603607veget_version=false
    604 if [[ "$veget" != 'NONE' ]]; then
     608if [[ $veget != 'NONE' ]]; then
    605609    cd "$MODEL/modipsl/modeles/ORCHIDEE"
    606610    set +e; svn upgrade; set -e
    607     if [[ "$veget" = "CMIP6" ]]; then
     611    if [[ $veget = "CMIP6" ]]; then
    608612        veget_version=orchidee2.0
    609613        orchidee_rev=6592
     
    652656        # Pour les experts qui voudraient changer de version d'orchidee.
    653657        # Attention : necessite d'avoir le password pour orchidee
    654 
    655         # Correctif suite debug Jean-Zay
    656         if [[ -f src_global/time.f90 ]]; then
    657             sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90
    658         fi
    659658        ###################################################################
    660659        if [[ "$veget_version" == "false" ]]; then
  • BOL/script_install_amaury/install_xios.bash

    r4782 r4871  
    1 #!/bin/bash
    2 #########################################################################
    3 # Defaults
    4 #########################################################################
    5 hostname=`hostname`
    6 install_dir=$(pwd)
    7 netcdf_home="/usr/local/netcdf"
    8 hdf5_home="/usr/local/hdf5"
    9 if [ -d /usr/lib64/openmpi ] ; then
    10   mpi_home="/usr/lib64/openmpi"
    11 else
    12   mpi_home="/usr"
    13 fi
    14 arch="local"
    15 #xios_branch="trunk"
    16 xios_branch="2.6"
    17 #xios_rev="HEAD"
    18 xios_rev="2568"
     1#!/bin/bash
     2set -e -u  # exit on most (not all!) error codes, and error on unset variables
    193
    20 #########################################################################
    21 #  Options
    22 #########################################################################
    23 while (($# > 0))
    24    do
    25    case $1 in
    26      "-h") cat <<........fin
    27     $0 [ -prefix path ]       where (path) to install
    28                               (default: $install_dir)
    29        [ -netcdf path ]       top directory of the netcdf library
    30                               (default: $netcdf_home)
    31        [ -hdf5 path ]         top directory of the hdf5 library
    32                               (default: $hdf5_home)
    33        [ -MPI path ]          top directory of the MPI library
    34                               (default: $mpi_home)
    35        [ -branch branch]      XIOS branch trunk|2.5|2.6
    36                               (default: $xios_branch)
    37        [ -rev number ]        XIOS revision
    38                               (default: $xios_rev)
    39        [ -arch ARCH ]         Use ARCH file (provided by XIOS)
    40                               (default: make/use a local arch file)
    41 ........fin
    42      exit ;;
    43      "-prefix") install_dir=$2 ; shift ; shift ;;
    44      "-netcdf") netcdf_home=$2 ; shift ; shift ;;
    45      "-hdf5" ) hdf5_home=$2 ; shift ; shift ;;
    46      "-MPI") mpi_home=$2 ; shift ; shift ;;
    47      "-branch") xios_branch=$2 ; shift ; shift ;;
    48      "-rev") xios_rev=$2 ; shift ; shift ;;
    49      "-arch") arch=$2 ; shift ; shift ;;
    50      *) echo "Error, bad argument $1" ; $0 -h ; exit
    51    esac
    52 done
     4# Installs xios
     5# Rewritten 02/2024 A. Barral
    536
    54 # Install directory (get full path)
    55 mkdir -p $install_dir
    56 install_dir=$(cd $install_dir ; pwd -P )
     7function read_args {
     8  ## Defaults
     9  install_dir=$(pwd)
    5710
    58 # Download XIOS
    59 case $xios_branch in
    60   "trunk")
    61   xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk" ;;
    62   "2.5")
    63   xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5" ;;
    64   "2.6")
    65   xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6" ;;
    66 *)
    67 echo "Error, bad argument for -branch ! Did not expect $xios_branch" ; exit ;;
    68 esac
     11  xios_branch="2.6"
     12  xios_rev="2568"
     13  arch="local"
     14  make_j="8"
     15  # Not inputs
     16  hdf5_home=$(dirname "$(dirname "$(readlink -f "$(which h5pcc)")")")
     17  mpi_home=$(dirname "$(dirname "$(readlink -f "$(which mpif90)")")")
    6918
    70 cd $install_dir
    71 svn co --revision $xios_rev $xios_http XIOS
     19  while (($# > 0)); do
     20    case $1 in
     21      "-h") cat <<eof
     22      $0 [ -prefix path ]       where (path) to install (default: $install_dir)
     23      [ -branch branch]         XIOS branch trunk|2.5|2.6 (default: $xios_branch)
     24      [ -rev number ]           XIOS revision (default: $xios_rev)
     25      [ -arch ARCH ]            Use ARCH file (provided by XIOS) (default: make/use a local arch file)
     26      [ -make_j N ]             Number of procs for compilation
     27eof
     28      exit;;
     29      "-prefix") install_dir=$2; shift; shift;;
     30      "-branch") xios_branch=$2; shift; shift;;
     31      "-rev") xios_rev=$2; shift; shift;;
     32      "-arch") arch=$2; shift; shift;;
     33      "-make_j") make_j=$2; shift; shift;;
     34      *) echo "Error, bad argument $1"; $0 -h; exit
     35    esac
     36  done
     37}
    7238
    73 # Make arch files, if necesary:
    74 if [ "$arch" = "local" ] ; then
    75 cd $install_dir/XIOS/arch
    76 # arch-local.env
    77 echo 'export MPI_LIB="-L'${mpi_home}'/lib -lmpi"'     > arch-local.env
    78 echo ''                                              >> arch-local.env
    79 echo 'export NETCDFC='${netcdf_home}                 >> arch-local.env
    80 echo 'export NETCDFC_LIB=$NETCDFC/lib'               >> arch-local.env
    81 echo 'export NETCDFC_INC=$NETCDFC/include'           >> arch-local.env
    82 echo ''                                              >> arch-local.env
    83 echo 'export NETCDFF='${netcdf_home}                 >> arch-local.env
    84 echo 'export NETCDFF_LIB=$NETCDFF/lib'               >> arch-local.env
    85 echo 'export NETCDFF_INC=$NETCDFF/include'           >> arch-local.env
    86 echo ''                                              >> arch-local.env
    87 echo 'export NETCDFCXX='${netcdf_home}               >> arch-local.env
    88 echo 'export NETCDFCXX_LIB=$NETCDFCXX/lib'           >> arch-local.env
    89 echo 'export NETCDFCXX_INC=$NETCDFCXX/include'       >> arch-local.env
     39function download_xios {
     40  # Install directory (get full path)
     41  mkdir -p "$install_dir"
     42  install_dir=$(cd "$install_dir" || exit 1; pwd -P)
    9043
    91 # arch-local.fcm
    92 echo '%CCOMPILER      '${mpi_home}'/bin/mpicc'             > arch-local.fcm
    93 echo '%FCOMPILER      '${mpi_home}'/bin/mpif90'           >> arch-local.fcm
    94 echo '%LINKER         '${mpi_home}'/bin/mpif90'           >> arch-local.fcm
    95 echo ''                                                   >> arch-local.fcm
    96 if [ ${hostname:0:5} = cicla ] ; then
    97 echo '%BASE_CFLAGS    -w -ansi'                >> arch-local.fcm
    98 else
    99 echo '%BASE_CFLAGS    -w -std=c++11 -D__XIOS_EXCEPTION'   >> arch-local.fcm
    100 fi
    101 echo '%PROD_CFLAGS    -O3 -D BOOST_DISABLE_ASSERTS'       >> arch-local.fcm
    102 echo '%DEV_CFLAGS     -g -O2'                             >> arch-local.fcm
    103 echo '%DEBUG_CFLAGS   -g -DBZ_DEBUG'                      >> arch-local.fcm
    104 echo ''                                                   >> arch-local.fcm
    105 echo '%BASE_FFLAGS    -D__NONE__ -ffree-line-length-none' >> arch-local.fcm
    106 echo '%PROD_FFLAGS    -O3'                                >> arch-local.fcm
    107 echo '%DEV_FFLAGS     -g -O2'                             >> arch-local.fcm
    108 echo '%DEBUG_FFLAGS   -g'                                 >> arch-local.fcm
    109 echo ''                                                   >> arch-local.fcm
    110 echo '%BASE_INC       -D__NONE__'                         >> arch-local.fcm
    111 echo '%BASE_LD        -lstdc++ -Wl,-rpath='${mpi_home}'/lib' >> arch-local.fcm
    112 echo ''                                                   >> arch-local.fcm
    113 echo '%CPP            '${mpi_home}'/bin/mpicc -EP'        >> arch-local.fcm
    114 echo '%FPP            cpp -P'                             >> arch-local.fcm
    115 echo '%MAKE           make'                               >> arch-local.fcm
     44  local xios_http
     45  case $xios_branch in
     46    "trunk") xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk";;
     47    "2.5") xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5";;
     48    "2.6") xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6";;
     49    *) echo "Error, bad argument for -branch ! Did not expect $xios_branch"; exit 1;;
     50  esac
    11651
    117 # arch-local.path
    118 echo 'NETCDF_INCDIR="-I${NETCDFC_INC} -I${NETCDFF_INC} -I${NETCDFCXX_INC} "'  > arch-local.path
    119 echo 'NETCDF_LIBDIR="-L${NETCDFC_LIB} -L${NETCDFF_LIB} -L${NETCDFCXX_LIB} "' >> arch-local.path
    120 echo 'NETCDF_LIB="-lnetcdf -lnetcdff -lnetcdf_c++4"'                         >> arch-local.path
    121 echo 'HDF5_INCDIR="-I'${hdf5_home}'/include"'                                >> arch-local.path
    122 echo 'HDF5_LIBDIR="-L'${hdf5_home}'/lib"'                                    >> arch-local.path
    123 echo 'HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz -lcurl"'                         >> arch-local.path
    124 fi
     52  cd "$install_dir" || exit 1
     53  svn co --revision "$xios_rev" "$xios_http" XIOS
     54}
    12555
    126 # make XIOS
    127 cd $install_dir/XIOS
    128 ./make_xios --arch $arch --job 8 2>&1 | tee make_xios.out
     56function create_local_arch {
     57  cd "$install_dir/XIOS/arch" || exit 1
    12958
     59  cat <<eof > arch-local.env
     60export MPI_LIB="-L${mpi_home}/lib -lmpi"
     61
     62export NETCDFC_INC="\$(nc-config --includedir)"
     63export NETCDFC_LIB="\$(nc-config --libdir)"
     64
     65export NETCDFF_INC="\$(nf-config --includedir)"
     66export NETCDFF_LIB="\$(nf-config --prefix)/lib"
     67
     68export NETCDFCXX_INC="\$(ncxx4-config --includedir)"
     69export NETCDFCXX_LIB="\$(ncxx4-config --libdir)"
     70eof
     71
     72  cat <<eof > arch-local.fcm
     73%CCOMPILER      "$(which mpicc)"
     74%FCOMPILER      "$(which mpif90)"
     75%LINKER         "$(which mpif90)"
     76
     77%BASE_CFLAGS    -w -std=c++11 -D__XIOS_EXCEPTION
     78%PROD_CFLAGS    -O3 -D BOOST_DISABLE_ASSERTS
     79%DEV_CFLAGS     -g -O2
     80%DEBUG_CFLAGS   -g -DBZ_DEBUG
     81
     82%BASE_FFLAGS    -D__NONE__ -ffree-line-length-none
     83%PROD_FFLAGS    -O3
     84%DEV_FFLAGS     -g -O2
     85%DEBUG_FFLAGS   -g
     86
     87%BASE_INC       -D__NONE__
     88%BASE_LD        -lstdc++ -Wl,-rpath=${mpi_home}/lib
     89
     90%CPP            $(which mpicc) -EP
     91%FPP            cpp -P
     92%MAKE           make
     93eof
     94  cat <<eof > arch-local.path
     95NETCDF_INCDIR="-I\${NETCDFC_INC} -I\${NETCDFF_INC} -I\${NETCDFCXX_INC}"
     96NETCDF_LIBDIR="-L\${NETCDFC_LIB} -L\${NETCDFF_LIB} -L\${NETCDFCXX_LIB}"
     97NETCDF_LIB="-lnetcdf -lnetcdff -lnetcdf_c++4"
     98
     99HDF5_INCDIR="-I${hdf5_home}/include"
     100HDF5_LIBDIR="-L${hdf5_home}/lib"
     101HDF5_LIB="-lhdf5_hl -lhdf5 -lz -lcurl"
     102eof
     103}
     104
     105function make_xios {
     106  cd "$install_dir/XIOS"
     107  echo "Compiling xios, see $(pwd)/make_xios.out"
     108  ./make_xios --arch "$arch" --job "$make_j" >make_xios.out 2>&1
     109}
     110
     111read_args "$@"
     112download_xios
     113if [[ $arch = "local" ]]; then create_local_arch; fi
     114make_xios
     115
Note: See TracChangeset for help on using the changeset viewer.