source: XIOS/dev/dev_olga/make_xios @ 1204

Last change on this file since 1204 was 660, checked in by mhnguyen, 9 years ago

Adding interpolation test_remap

+) Add new test case for domain interpolation
+) Resolve circular dependence
+) Add function to read weigh file

Test
+) On Curie
+) test_remap can print out .nc

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