source: XIOS/dev/XIOS_DEV_CMIP6/make_xios @ 1451

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

And adding a mistakenly deleted line in r1450.

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