source: XIOS/dev/XIOS_DEV_CMIP6/make_xios @ 1481

Last change on this file since 1481 was 1458, checked in by oabramkina, 6 years ago

Few corrections related to compilation options --use_extern_boost and --use_extern_blitz.

  • Property svn:executable set to *
File size: 8.2 KB
RevLine 
[248]1#!/bin/bash
2
3install_dir=$PWD
[287]4compil_full="false"
5use_oasis="false"
[475]6oasis="oasis3_mct"
[1449]7use_extern_boost="false"
[1453]8use_extern_blitz="false"
[402]9use_memtrack="false"
[313]10job="1"
[381]11netcdf_lib="netcdf4_par"
12compil_mode="prod"
[1450]13arch_path="arch"
14arch_default_path="arch"
15arch_defined="FALSE"
16arch_path_defined="FALSE"
[248]17
18# Traitement de la ligne de commande
19while (($# > 0))
20   do
21      case $1 in
[383]22         "-h"|"--help"|"-help")
[374]23            echo "make_xios - installs XIOS on your architecture"
24            echo "make_xios [options]"
25            echo "options :"
[381]26            echo "       [--prod] : compilation in production mode (default)"
[374]27            echo "       [--dev] : compilation in development mode"
28            echo "       [--debug] : compilation in debug mode"
29            echo "       --arch arch : to choose target architecture"
30            echo "       [--avail] : to know available target architectures "
31            echo "       [--full] : to generate dependencies and recompile from scratch"
[1450]32            echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"i
[1449]33        echo "       [--use_extern_boost : to use external boost library"
[1453]34        echo "       [--use_extern_blitz : to use external blitz library"
[374]35            echo "       [--doc] : to generate Doxygen documentation (not available yet)"
36            echo "       [--job ntasks] : to use parallel compilation with ntasks"
[410]37            echo "       [--netcdf_lib 'netcdf4_par'/'netcdf4_seq'/'netcdf4_internal' : default netcdf4_par] : choice of netcdf library"
[402]38            echo "       [--memtrack] : tracking memory leak - developper only"
[374]39            echo "Example : ./make_xios --prod --arch PW6_VARGAS"
40            echo "Example : ./make_xios --avail"
[248]41            exit;;
42         "--prod")  compil_mode="prod"  ; shift ;;
43         "--dev")   compil_mode="dev"   ; shift ;;
44         "--debug") compil_mode="debug" ; shift ;;
[1450]45         "--arch")  arch=$2     ; arch_defined="TRUE"; shift ; shift ;;
46         "--arch_path")  arch_path=$2     ; arch_path_defined="TRUE"; shift ; shift ;;
[383]47         "--avail") ls arch/*.fcm | cut -d"-" -f2 | cut -d"." -f1 ; exit ;;
[313]48         "--full")  compil_full="true"  ; shift ;;
[475]49         "--use_oasis")  use_oasis="true" oasis=$2 ; shift ; shift  ;;
[1449]50         "--use_extern_boost")  use_extern_boost="true" ; shift  ;;
[1453]51         "--use_extern_blitz")  use_extern_blitz="true" ; shift  ;;
[248]52         "--doc")   doc="true"          ; shift ;;
[313]53         "--job")   job=$2              ; shift ; shift ;;
[381]54         "--netcdf_lib")   netcdf_lib=$2 ; shift ; shift ;;
[1450]55         "--memtrack")  use_memtrack="true" memtrack=$2  ; shift ; shift ;;
[248]56         *)         code="$1"           ; shift ;;
57      esac
58   done
59
[374]60# Installation des sources
[377]61nb_files_gz=`ls $install_dir/tools/archive | grep tar.gz | wc -l`
62if [ ${nb_files_gz} -ne 0 ]               
[376]63then
[377]64    echo -e "- uncompress archives ..."         
[376]65    for tarname in `ls $install_dir/tools/archive/*.tar.gz` ; do
[1458]66        if  ( [[ ${tarname} == "${install_dir}/tools/archive/boost.tar.gz" ]] && [[ "$use_extern_boost" == "true" ]] ) || ( [[ ${tarname} == "${install_dir}/tools/archive/blitz.tar.gz" ]] && [[ "$use_extern_blitz" == "true" ]] )
67        then
68                continue
69        fi
[376]70        gunzip -f "$tarname"
71        tar -xf ${tarname%.gz}
72    done
73fi
[374]74
[248]75# Vérification de la présence d'un identifiant d'architecture.
76
[281]77###############################################################
[374]78# lecture des chemins propres a l'architecture de la machine #
[281]79#           et configuration de l'environnement              #
80###############################################################
81
82rm -f .void_file
83echo > .void_file
84rm -rf .void_dir
85mkdir .void_dir
86
[1450]87if [[ "$arch_defined" == "TRUE" ]]
88then
89  rm -f arch.path
90  rm -f arch.fcm
91  rm -f arch.env
[281]92
[1450]93  if test -f $arch_path/arch-${arch}.path
94  then
95    ln -s $arch_path/arch-${arch}.path arch.path
96  elif test -f $arch_default_path/arch-${arch}.path
97  then
98    ln -s $arch_default_path/arch-${arch}.path arch.path
99  fi
100       
101  if test -f $arch_path/arch-${arch}.fcm
102  then
103    ln -s $arch_path/arch-${arch}.fcm arch.fcm
104  elif test -f $arch_default_path/arch-${arch}.fcm
105  then
106    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
107  fi
[281]108
[1450]109  if test -f $arch_path/arch-${arch}.env
110  then
111    ln -s $arch_path/arch-${arch}.env arch.env
112  elif test -f $arch_default_path/arch-${arch}.env
113  then
114    ln -s $arch_default_path/arch-${arch}.env arch.env
[281]115  else
[1450]116    ln -s .void_file arch.env
117  fi
118  source arch.env
119  source arch.path
120else
[381]121      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
[248]122      exit 1
123fi
124
125# Vérification de la présence d'un mode de compilation.
126
127if [[ "$compil_mode" == "prod" ]]
128   then
129      COMPIL_CFLAGS="%PROD_CFLAGS"
130      COMPIL_FFLAGS="%PROD_FFLAGS"
131elif [[ "$compil_mode" == "dev" ]]
132   then
133      COMPIL_CFLAGS="%DEV_CFLAGS"
134      COMPIL_FFLAGS="%DEV_FFLAGS"
135elif [[ "$compil_mode" == "debug" ]]
136   then
137      COMPIL_CFLAGS="%DEBUG_CFLAGS"
138      COMPIL_FFLAGS="%DEBUG_FFLAGS"
139fi
140
[410]141rm -r $PWD/extern/netcdf4
142
[381]143if [[ "$netcdf_lib" == "netcdf4_par" ]]
144   then
[410]145     ln -s $PWD/.void_dir $PWD/extern/netcdf4
[591]146     XIOS_CPPKEY="$XIOS_CPPKEY USING_NETCDF_PAR"
[381]147elif [[ "$netcdf_lib" == "netcdf4_seq" ]]
148  then
[410]149    ln -s $PWD/.void_dir $PWD/extern/netcdf4
150elif [[ "$netcdf_lib" == "netcdf4_internal" ]]
151  then
152    ln -s $PWD/extern/src_netcdf4 $PWD/extern/netcdf4
[591]153    XIOS_CPPKEY="$XIOS_CPPKEY USING_NETCDF_PAR USING_NETCDF_INTERNAL"
[410]154    export NETCDF_INCDIR="-I${PWD}/extern/netcdf4"
155    export NETCDF_LIBDIR=""
156    export NETCDF_LIB=""
[381]157else
[410]158   echo "Bad choice for --netcdf_lib argument : choose between 'netcdf4_par','netcdf4_seq' or 'netcdf4_internal'"
[381]159   exit
160fi
161
[287]162if [[ "$use_oasis" == "true" ]]
163   then
[475]164    if [[ "$oasis" == "oasis3_mct" ]]
165    then
[591]166        XIOS_CPPKEY="$XIOS_CPPKEY USE_OMCT"
[475]167    elif [[ "$oasis" == "oasis3"  ]]
168    then
[591]169        XIOS_CPPKEY="$XIOS_CPPKEY USE_OASIS"
[475]170        OASIS_INCDIR="-I$PWD/../../prism/X64/build/lib/psmile.MPI1"
171        OASIS_LIBDIR="-L$PWD/../../prism/X64/lib"
172        OASIS_LIB="-lpsmile.MPI1 -lmpp_io"
173    else
174        echo "Bad choice for --use_oasis argument : choose between 'oasis3','oasis3_mct'"
175        exit
176    fi
177    NETCDF_LIB="-lnetcdff -lnetcdf"
[591]178    XIOS_FINCDIR="$OASIS_INCDIR $XIOS_FINCDIR"
179    XIOS_LIB="$OASIS_LIBDIR $OASIS_LIB $XIOS_LIB"
[1450]180fi 
[362]181
[1449]182# Setting path for boost
183if [[ "$use_extern_boost" == "true" ]]
184then
[1458]185   rm -r $PWD/extern/boost
[1449]186   ln -s $PWD/.void_dir $PWD/extern/boost
187else
188   export BOOST_INCDIR="-I${PWD}/extern/boost"
189   export BOOST_LIBDIR=""
190   export BOOST_LIB=""
191fi
192
[1453]193# Setting path for blitz
194if [[ "$use_extern_blitz" == "true" ]]
195then
[1458]196   rm -r $PWD/extern/blitz
[1453]197   ln -s $PWD/.void_dir $PWD/extern/blitz
198else
199   export BLITZ_INCDIR="-I${PWD}/extern/blitz"
200   export BLITZ_LIBDIR=""
201   export BLITZ_LIB=""
202fi
203
204
[402]205if [[ "$use_memtrack" == "true" ]]
206   then
[591]207   XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK"
[1450]208
209    if [[ "$memtrack" == "light" ]]
210    then
211        XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_LIGHT"
212    elif [[ "$memtrack" == "FULL"  ]]
213    then
214      XIOS_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XIOS_LIB"
215      XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_FULL"
216    else
217        echo "Bad choice for --memtrack argument : choose between 'light','full'"
218        exit
219    fi
[402]220fi
221
[1453]222XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR"
223XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR"
[248]224
[591]225XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
[248]226
227rm -f config.fcm
228echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
229echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
[591]230echo "%CPP_KEY       $XIOS_CPPKEY"   >> config.fcm
[248]231
[591]232echo "%CBASE_INC     $XIOS_CINCDIR" >> config.fcm     
233echo "%FBASE_INC     $XIOS_FINCDIR" >> config.fcm
234echo "%ARCH_LD       $XIOS_LIB"     >> config.fcm
[248]235
[381]236echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
[248]237
238# Création de la documentation doxygen.
239if [[ !(-z $doc) ]]
240   then
[381]241      echo -e "- Create Doxygen documentation (disabled)..."
[248]242      #doxygen -s
243fi
244
245make_dir=$PWD
246
247export PATH=$PWD/tools/FCM/bin:$PATH
248
[287]249if [[ "$compil_full" == "true" ]]
250   then
[395]251   fcm build --clean --ignore-lock
252   fcm build -f --ignore-lock -j $job
[287]253else
[395]254  fcm build --ignore-lock -j $job
[287]255fi
[248]256
[601]257build_exit_status=$?
[287]258
[601]259if [[ $build_exit_status == 0 ]]
[287]260  then
[366]261  set nothing
[591]262#    cd $WORKDIR/XIOS_NEMO_COUPLE/modeles/NEMO/WORK
263#    cd $WORKDIR/XIOS_NEMO/modeles/NEMO/WORK
[301]264#    make
[287]265fi
[601]266
267exit $build_exit_status
Note: See TracBrowser for help on using the repository browser.