source: XIOS/dev/XIOS_DEV_CMIP6/make_xios @ 1457

Last change on this file since 1457 was 1453, checked in by oabramkina, 6 years ago

DEV_CMIP6: adding a compilation option '--use_extern_blitz' to allow usage of external blitz.

  • Property svn:executable set to *
File size: 7.9 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
66        gunzip -f "$tarname"
67        tar -xf ${tarname%.gz}
68    done
69fi
[374]70
[248]71# Vérification de la présence d'un identifiant d'architecture.
72
[281]73###############################################################
[374]74# lecture des chemins propres a l'architecture de la machine #
[281]75#           et configuration de l'environnement              #
76###############################################################
77
78rm -f .void_file
79echo > .void_file
80rm -rf .void_dir
81mkdir .void_dir
82
[1450]83if [[ "$arch_defined" == "TRUE" ]]
84then
85  rm -f arch.path
86  rm -f arch.fcm
87  rm -f arch.env
[281]88
[1450]89  if test -f $arch_path/arch-${arch}.path
90  then
91    ln -s $arch_path/arch-${arch}.path arch.path
92  elif test -f $arch_default_path/arch-${arch}.path
93  then
94    ln -s $arch_default_path/arch-${arch}.path arch.path
95  fi
96       
97  if test -f $arch_path/arch-${arch}.fcm
98  then
99    ln -s $arch_path/arch-${arch}.fcm arch.fcm
100  elif test -f $arch_default_path/arch-${arch}.fcm
101  then
102    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
103  fi
[281]104
[1450]105  if test -f $arch_path/arch-${arch}.env
106  then
107    ln -s $arch_path/arch-${arch}.env arch.env
108  elif test -f $arch_default_path/arch-${arch}.env
109  then
110    ln -s $arch_default_path/arch-${arch}.env arch.env
[281]111  else
[1450]112    ln -s .void_file arch.env
113  fi
114  source arch.env
115  source arch.path
116else
[381]117      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
[248]118      exit 1
119fi
120
121# Vérification de la présence d'un mode de compilation.
122
123if [[ "$compil_mode" == "prod" ]]
124   then
125      COMPIL_CFLAGS="%PROD_CFLAGS"
126      COMPIL_FFLAGS="%PROD_FFLAGS"
127elif [[ "$compil_mode" == "dev" ]]
128   then
129      COMPIL_CFLAGS="%DEV_CFLAGS"
130      COMPIL_FFLAGS="%DEV_FFLAGS"
131elif [[ "$compil_mode" == "debug" ]]
132   then
133      COMPIL_CFLAGS="%DEBUG_CFLAGS"
134      COMPIL_FFLAGS="%DEBUG_FFLAGS"
135fi
136
[410]137rm -r $PWD/extern/netcdf4
138
[381]139if [[ "$netcdf_lib" == "netcdf4_par" ]]
140   then
[410]141     ln -s $PWD/.void_dir $PWD/extern/netcdf4
[591]142     XIOS_CPPKEY="$XIOS_CPPKEY USING_NETCDF_PAR"
[381]143elif [[ "$netcdf_lib" == "netcdf4_seq" ]]
144  then
[410]145    ln -s $PWD/.void_dir $PWD/extern/netcdf4
146elif [[ "$netcdf_lib" == "netcdf4_internal" ]]
147  then
148    ln -s $PWD/extern/src_netcdf4 $PWD/extern/netcdf4
[591]149    XIOS_CPPKEY="$XIOS_CPPKEY USING_NETCDF_PAR USING_NETCDF_INTERNAL"
[410]150    export NETCDF_INCDIR="-I${PWD}/extern/netcdf4"
151    export NETCDF_LIBDIR=""
152    export NETCDF_LIB=""
[381]153else
[410]154   echo "Bad choice for --netcdf_lib argument : choose between 'netcdf4_par','netcdf4_seq' or 'netcdf4_internal'"
[381]155   exit
156fi
157
[287]158if [[ "$use_oasis" == "true" ]]
159   then
[475]160    if [[ "$oasis" == "oasis3_mct" ]]
161    then
[591]162        XIOS_CPPKEY="$XIOS_CPPKEY USE_OMCT"
[475]163    elif [[ "$oasis" == "oasis3"  ]]
164    then
[591]165        XIOS_CPPKEY="$XIOS_CPPKEY USE_OASIS"
[475]166        OASIS_INCDIR="-I$PWD/../../prism/X64/build/lib/psmile.MPI1"
167        OASIS_LIBDIR="-L$PWD/../../prism/X64/lib"
168        OASIS_LIB="-lpsmile.MPI1 -lmpp_io"
169    else
170        echo "Bad choice for --use_oasis argument : choose between 'oasis3','oasis3_mct'"
171        exit
172    fi
173    NETCDF_LIB="-lnetcdff -lnetcdf"
[591]174    XIOS_FINCDIR="$OASIS_INCDIR $XIOS_FINCDIR"
175    XIOS_LIB="$OASIS_LIBDIR $OASIS_LIB $XIOS_LIB"
[1450]176fi 
[362]177
[1449]178# Setting path for boost
179if [[ "$use_extern_boost" == "true" ]]
180then
181   ln -s $PWD/.void_dir $PWD/extern/boost
182else
183   export BOOST_INCDIR="-I${PWD}/extern/boost"
184   export BOOST_LIBDIR=""
185   export BOOST_LIB=""
186fi
187
[1453]188# Setting path for blitz
189if [[ "$use_extern_blitz" == "true" ]]
190then
191   ln -s $PWD/.void_dir $PWD/extern/blitz
192else
193   export BLITZ_INCDIR="-I${PWD}/extern/blitz"
194   export BLITZ_LIBDIR=""
195   export BLITZ_LIB=""
196fi
197
198
[402]199if [[ "$use_memtrack" == "true" ]]
200   then
[591]201   XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK"
[1450]202
203    if [[ "$memtrack" == "light" ]]
204    then
205        XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_LIGHT"
206    elif [[ "$memtrack" == "FULL"  ]]
207    then
208      XIOS_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XIOS_LIB"
209      XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_FULL"
210    else
211        echo "Bad choice for --memtrack argument : choose between 'light','full'"
212        exit
213    fi
[402]214fi
215
[1453]216XIOS_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR"
217XIOS_FINCDIR="$NETCDF_INCDIR $XIOS_FINCDIR $MPI_INCDIR $BOOST_INCDIR $BLITZ_INCDIR"
[248]218
[591]219XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
[248]220
221rm -f config.fcm
222echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
223echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
[591]224echo "%CPP_KEY       $XIOS_CPPKEY"   >> config.fcm
[248]225
[591]226echo "%CBASE_INC     $XIOS_CINCDIR" >> config.fcm     
227echo "%FBASE_INC     $XIOS_FINCDIR" >> config.fcm
228echo "%ARCH_LD       $XIOS_LIB"     >> config.fcm
[248]229
[381]230echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
[248]231
232# Création de la documentation doxygen.
233if [[ !(-z $doc) ]]
234   then
[381]235      echo -e "- Create Doxygen documentation (disabled)..."
[248]236      #doxygen -s
237fi
238
239make_dir=$PWD
240
241export PATH=$PWD/tools/FCM/bin:$PATH
242
[287]243if [[ "$compil_full" == "true" ]]
244   then
[395]245   fcm build --clean --ignore-lock
246   fcm build -f --ignore-lock -j $job
[287]247else
[395]248  fcm build --ignore-lock -j $job
[287]249fi
[248]250
[601]251build_exit_status=$?
[287]252
[601]253if [[ $build_exit_status == 0 ]]
[287]254  then
[366]255  set nothing
[591]256#    cd $WORKDIR/XIOS_NEMO_COUPLE/modeles/NEMO/WORK
257#    cd $WORKDIR/XIOS_NEMO/modeles/NEMO/WORK
[301]258#    make
[287]259fi
[601]260
261exit $build_exit_status
Note: See TracBrowser for help on using the repository browser.