Juan 5/12/2014: add CALMIP eos BULLX
[MNH-git_open_source-lfs.git] / src / configure
1 #!/bin/bash
2 #MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
3 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
4 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
5 #MNH_LIC for details. version 1.
6 #set -x
7 #set -e
8 if [ "x$XYZ" = "x" ]
9 then
10
11 export VERSION_MASTER=${VERSION_MASTER:-MNH-V5-1}
12 export VERSION_BUG=${VERSION_BUG:-3}
13 export VERSION_XYZ=${VERSION_XYZ:-${VERSION_MASTER}-${VERSION_BUG}}
14 export VERSION_DATE=${VERSION_DATE:-"20/11/2014"}
15 export VERSION_CDF=${VERSION_CDF-"3.6.3"}
16 export VERSION_GRIBAPI=${VERSION_GRIBAPI-"1.9.9"}
17 export MNH_INT=${MNH_INT-"I4"}
18 #
19 export NEED_TOOLS=YES
20 #
21 export LOCAL=${PWD%/src}
22 RACINE=$(basename $LOCAL )
23 #
24 cd ${LOCAL}/conf
25 #
26 TARG=$(uname -s -n)
27 #
28 case "$TARG" in
29 'Linux service'*)
30                 export     ARCH=${ARCH:-LXifort}
31                 export  VER_MPI=${VER_MPI:-MPIICE}
32                 export NEED_NCARG=${NEED_NCARG:-YES}
33                 export MVWORK=${MVWORK:-NO}
34                 domain=$(grep .fr /etc/hosts | head -1 )
35                 case "${domain}" in
36 *cines*) # jade
37                 export OPTLEVEL=${OPTLEVEL:-O2}
38                 export MVWORK=${MVWORK:-NO}
39                 export VER_CDF=${VER_CDF:-CDFICE}
40                 export NEED_NCARG=${NEED_NCARG:-YES}
41                 export MNHENV=${MNHENV:-"
42 module rm netcdf ; module load netcdf/4.0
43 module rm MPT    ; module load MPT/2.02
44 module rm intel  ; module load intel/12.0.13
45 export MPI_DSM_CPULIST=0-7:allhosts
46 "}
47 ;;
48 *cict*)  # hyperion
49                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
50                 export VER_CDF=${VER_CDF:-CDFAUTO}
51                 export MNHENV=${MNHENV:-"
52 . /usr/share/modules/init/bash
53 module purge
54 module load intel-fc-10/10.1.017
55 module load sgi-mpt/1.26
56 export MPI_DSM_CPULIST=0-7:allhosts
57 "}
58               ;;
59                 esac
60               ;;
61 'Linux platine'*|'Linux titane'*|'Linux curie'*)
62                 export     ARCH=${ARCH:-LXifort}
63                 export  VER_MPI=${VER_MPI:-MPIAUTO}
64                 export OPTLEVEL=${OPTLEVEL:-O2}
65                 export MVWORK=${MVWORK:-NO}
66                 export VER_CDF=${VER_CDF:-CDFAUTO}
67               ;;
68 'Linux beaufix'*|'Linux compute'*)
69                 export     ARCH=${ARCH:-LXifort}
70                 export  VER_MPI=${VER_MPI:-MPIINTEL}
71                 export OPTLEVEL=${OPTLEVEL:-O3}
72                 export MVWORK=${MVWORK:-NO}
73                 export MNH_NCWRIT=${MNH_NCWRIT:-MNH_NCWRIT}
74                 export VER_CDF=${VER_CDF:-CDFBFIX}
75                 export NEED_TOOLS=NO
76                 export MNHENV=${MNHENV:-"
77 module rm intel    ; module load intel/13.1.4.183 ;
78 module rm intelmpi ; module load intelmpi/4.1.1.036 ;
79 module rm netcdf ; module load netcdf/4.3.0 ;
80 module load grib_api/1.9.16 ;
81 export GRIBAPI_PATH=/opt/softs/libraries/ICC13.1.4.183/grib_api-1.9.16_libtool
82 "}
83               ;;
84 'Linux login0'*|'Linux compute'*)
85                 export     ARCH=${ARCH:-LXifort}
86                 export  VER_MPI=${VER_MPI:-MPIAUTO}
87                 export OPTLEVEL=${OPTLEVEL:-O3}
88                 export MVWORK=${MVWORK:-NO}
89                 export VER_CDF=${VER_CDF:-CDFBULL}
90                 export MNHENV=${MNHENV:-"
91 module rm intel    ; module load intel/13.0.1.117 ;
92 module rm intelmpi ; module load intelmpi/4.1.0 ;
93 module rm intel-itac ; module load intel-itac/8.0.3
94 "}
95               ;;
96 'Linux brodie'*|'Linux mercure'*)
97                 export     ARCH=${ARCH:-SX8}
98                 export  VER_MPI=${VER_MPI:-MPIAUTO}
99                 export OPTLEVEL=${OPTLEVEL:-O4}
100                 export MVWORK=${MVWORK:-YES}
101                 export VER_CDF=${VER_CDF:-CDFSX}
102                 export MNHENV=${MNHENV:-"
103 module rm sxf90  ; module load sxf90/400 ;
104 module rm sxmpi  ; module load sxmpi/8.0.10 ;
105 module rm netcdf ; module load netcdf/3.6.3
106 "}
107               ;;
108 'Linux tori'*|'Linux yuki'*)
109                 export     ARCH=${ARCH:-SX8}
110                 export  VER_MPI=${VER_MPI:-MPIAUTO}
111                 export OPTLEVEL=${OPTLEVEL:-O4}
112                 export MVWORK=${MVWORK:-NO}
113                 export MNH_NCWRIT=${MNH_NCWRIT:-MNH_NCWRIT}
114                 export VER_CDF=${VER_CDF:-CDFMFSX}
115                 export NEED_NCARG=${NEED_NCARG:-NO}
116                 export VERSION_GRIBAPI="1.9.9"
117 export MNHENV=${MNHENV:-"
118 export GRIBAPI_PATH=/usr/local/SX/grib_api/
119 "}
120               ;;
121 'Linux babel'*)
122                 export     ARCH=${ARCH:-BGQ}
123                 export  VER_MPI=${VER_MPI:-MPIAUTO}
124                 export OPTLEVEL=${OPTLEVEL:-O2}
125                 export MVWORK=${MVWORK:-YES}
126                 export MNHENV=${MNHENV:-"
127 module load netcdf/3.6.3
128 "}
129                ;;
130 'Linux turing'*)
131                 export     ARCH=${ARCH:-BGQ}
132                 export  VER_MPI=${VER_MPI:-MPIAUTO}
133                 export OPTLEVEL=${OPTLEVEL:-O2NAN}
134                 export MVWORK=${MVWORK:-YES}
135                 export VER_CDF=${VER_CDF:-CDFBGQ}
136                 export MNHENV=${MNHENV:-"
137 source /bglocal/fe/pub/Modules/default/init/bash
138 export MODULEPATH=/bghome/rech/mnh/rmnh007/my_modules:\$MODULEPATH
139 module purge
140 module load ibmcmp/V1R2M0/14.01.0000.0002/gcc.legacy
141 export VER_GA=ga-mpi-5-0-3
142 module load ga/\${VER_GA}
143 "}
144               ;;
145 'Linux ada'*)
146                 export     ARCH=${ARCH:-LXifort}
147                 export  VER_MPI=${VER_MPI:-MPIINTEL}
148                 export OPTLEVEL=${OPTLEVEL:-O2}
149                 export MVWORK=${MVWORK:-YES}
150                 export MNHENV=${MNHENV:-"
151 #export OBJDIR_PATH=$WORKDIR/DIR_OBJ_ADA
152 export MP_MPILIB=pempi
153 module load netcdf/seq/4.1.3
154 "}
155               ;;
156 AIX*)
157                 export MNH_ARCH=`echo $ARCH | grep AIX`
158                 export     ARCH=${MNH_ARCH:-AIX64}
159                 export  VER_MPI=${VER_MPI:-MPIAUTO}
160                 export OPTLEVEL=${OPTLEVEL:-O2}
161                 export MVWORK=${MVWORK:-NO}
162                 export VER_CDF=${VER_CDF:-CDFAIX}
163                 case "$(hostname)" in
164                       vargas*)
165                       export MNHENV=${MNHENV:-"
166 module rm fortran ; module load fortran/13.1.0.7
167 module rm netcdf  ; module load netcdf/3.6.3
168 "}
169                       ;;
170                       c1a*)
171                       export VERSION_GRIBAPI="1.9.9"
172                       export MNHENV=${MNHENV:-"
173 . /usr/local/apps/module/init/sh.in
174 module rm fortran ; module load fortran/xlf/13.1.0.7
175 module rm netcdf  ; module load netcdf/3.6.3
176 export CDF_PATH=/usr/local/apps/netcdf/3.6.3/LP64
177 export GRIBAPI_PATH=/usr/local/lib/metaps/lib/grib_api/${VERSION_GRIBAPI}
178 export LIB_GRIBAPI='${GRIB_API_LIB}'
179 "}
180                       ;;
181                       c2a*)
182                       export VERSION_GRIBAPI="2.0.0"
183                       export MNHENV=${MNHENV:-"
184 . /usr/local/apps/module/init/sh.in
185 module rm fortran ; module load fortran/xlf/13.1.0.9
186 module rm netcdf  ; module load netcdf/3.6.3
187 export CDF_PATH=/usr/local/apps/netcdf/3.6.3/LP64
188 export GRIBAPI_PATH=/usr/local/lib/metaps/lib/grib_api/${VERSION_GRIBAPI}
189 export LIB_GRIBAPI='${GRIB_API_LIB}'
190 "}
191                       ;;
192                  esac
193               ;;
194 'Linux cc'*) # ECMWF Cray plateforme
195                 export MNH_ARCH=`echo $ARCH | grep LX`
196                 export     ARCH=${MNH_ARCH:-LXcray}
197                 export  VER_MPI=${VER_MPI:-MPICRAY}
198                 export OPTLEVEL=${OPTLEVEL:-O2}
199                 export MVWORK=${MVWORK:-NO}
200                 export VER_CDF=${VER_CDF:-CDFAUTO}
201                 if [ "${ARCH}" == "LXcray" ] 
202                 then
203                 export MNHENV=${MNHENV:-"
204 . /opt/modules/default/init/bash
205 module rm grib_api
206 "}
207                 else
208                 if [ "${ARCH}" == "LXifort" ]
209                 then
210                 export MNHENV=${MNHENV:-"
211 . /opt/modules/default/init/bash
212 module switch PrgEnv-cray PrgEnv-intel
213 "}
214                 fi
215                 fi
216 ;;
217 'Linux sxmnh1') #CNRM ifort sur sxmnh1 (diff mandriva)
218                 export    OMPI_FC=ifort
219                 export       ARCH=${ARCH:-LXifort}
220                 export    VER_MPI=${VER_MPI:-MPIAUTO}
221                 export   OPTLEVEL=${OPTLEVEL:-DEBUG}
222                 export     MVWORK=${MVWORK:-NO}
223                 export    VER_CDF=${VER_CDF:-CDFCTI}
224                 export NEED_NCARG=${NEED_NCARG:-NO}
225                 export NEED_TOOLS=NO
226               ;;
227 'Linux lx'*|'Linux sx'*|'Linux px'*) #CNRM
228                 export MNH_ARCH=`echo $ARCH | grep LX`
229                 export     ARCH=${MNH_ARCH:-LXgfortran}
230                 export  VER_MPI=${VER_MPI:-MPIAUTO}
231                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
232                 export MVWORK=${MVWORK:-NO}
233                 export VER_CDF=${VER_CDF:-CDFCTI}
234                 export NEED_NCARG=${NEED_NCARG:-NO}
235                 export NEED_TOOLS=NO
236               ;;
237 'Linux nuwa'*)
238                 export     ARCH=${ARCH:-LXifort}
239                 export  VER_MPI=${VER_MPI:-MPIAUTO}
240                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
241                 export MVWORK=${MVWORK:-NO}
242                 export VER_CDF=${VER_CDF:-CDFAUTO}
243                 export NEED_NCARG=${NEED_NCARG:-YES}
244                       export MNHENV=${MNHENV:-"
245 . /opt/intel/fce/10.1.021/bin/ifortvars.sh
246 export MPI_ROOT=/usr/local/OpenMPI/1.6.3/ifort10.1.021
247 export PATH=\$MPI_ROOT/bin:\$PATH
248 export LD_LIBRARY_PATH=\$MPI_ROOT/lib64:\$LD_LIBRARY_PATH
249 export MANPATH=\$MPI_ROOT/share/man:\$MANPATH
250 "}
251               ;;
252 'Linux eos'*)
253                 export     ARCH=${ARCH:-LXifort}
254                 export  VER_MPI=${VER_MPI:-MPIINTEL}
255                 export OPTLEVEL=${OPTLEVEL:-O2}
256                 export VER_CDF=${VER_CDF:-CDFAUTO}
257                 export   MNHENV=${MNHENV:-"
258 "}
259               ;;
260
261 Linux*)
262                 export     ARCH=${ARCH:-LXgfortran}
263                 export  VER_MPI=${VER_MPI:-MPIVIDE}
264                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
265                 export MVWORK=${MVWORK:-NO}
266                 #export VER_CDF=${VER_CDF:-CDFGFOR}
267                 export VER_CDF=${VER_CDF:-CDFAUTO}
268                 export NEED_NCARG=${NEED_NCARG:-YES}
269               ;;
270 *)
271                 echo "WARNING ; system not yet tested "
272                 echo "WARNING ; edit profile_mesonh & set correct variables ARCH , VER_MPI & OPTLEVEL "
273
274                 export     ARCH=${ARCH}
275                 export  VER_MPI=${VER_MPI:-MPIVIDE}
276                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
277               ;;
278 esac
279 ##
280 ## Environnement for scandollar
281 ##
282
283 if [ "x${CONF_DOLLAR}" = "x" ] ; then
284 # set default value for CONF_DOLLAR file
285 case "$(hostname)" in
286   tori*|yuki*)
287         export POSTCONF=confdollar_dsinec_default
288         ;;
289
290   lx*|px*|sx*)
291         export POSTCONF=confdollar_cnrmpc_default
292         ;;
293
294   aeropc*)
295         export POSTCONF=confdollar_aeropc_default
296
297         ;;
298
299   brodie*)
300         export POSTCONF=confdollar_brodie_default
301
302         ;;
303
304   vargas*)
305         export POSTCONF=confdollar_vargas_default
306         ;;
307
308   c1a*)
309         export POSTCONF=confdollar_c1a_default
310         ;;
311
312   service*)
313         export POSTCONF=confdollar_jade_default
314         ;;
315
316   babel*)
317         export POSTCONF=confdollar_babel_default
318         ;;
319   turing*)
320         export POSTCONF=confdollar_turing_default
321         ;;
322  titane*|curie*)
323         export POSTCONF=confdollar_titane_default
324         ;;
325
326   eos*)
327         export POSTCONF=confdollar_eos_default
328         ;;
329
330   *)
331         export POSTCONF=confdollar_aeropc_default
332         ;;
333 esac
334
335 export CONF_DOLLAR=${LOCAL}/conf/post/${POSTCONF}
336
337 fi
338
339 #
340 #  Install 32/64 mesonh tools
341 #
342 if [ "x${NEED_TOOLS}" == "xYES" ] ; then
343   case "$(uname -m)" in
344   'x86_64')
345           export BIN_TOOLS=${BIN_TOOLS:-X86_64}
346            ;;
347   'x86'|'i'*'86')
348           export BIN_TOOLS=${BIN_TOOLS:-X86}
349            ;;
350   esac
351 fi
352
353 #
354 # Generate profile_mesonh
355 #
356 ${LOCAL}/bin/eval_dollar  profile_mesonh.ihm > profile_mesonh
357 chmod +x profile_mesonh
358 XYZ=${ARCH}${MNH_REAL}${MNH_INT}-${VERSION_XYZ}${VER_USER:+-${VER_USER}}-${VER_MPI}-${OPTLEVEL}
359 cp profile_mesonh profile_mesonh-${XYZ}
360 #
361 #  Do some post-install stuff
362 #
363 if [ "x${MVWORK}" == "xYES" ] ; then
364    if [ "x${WORKDIR}" == "x" ] ; then
365      echo "ATTENTION :: configure !!!!!"
366      echo
367      echo '  ---> vous n avez pas initialiser la variable $WORKDIR '
368      echo '  ---> ou seront stoké les binaires et cas tests '
369      echo '  ---> initialisez la et relance "./configure"'
370      exit 1
371    fi
372    if [ -d $WORKDIR ] && [ ${LOCAL} == ${LOCAL##/work} ] ; then
373 #  if we are not allready in the workdir --> move stuff
374       WORK=$WORKDIR/${RACINE}_WORKDIR
375       mkdir -p ${WORK}
376       for dir in MY_RUN exe pub
377       do
378          [ -d $LOCAL/${dir} ] && [ ! -L $LOCAL/${dir} ] \
379           && mv $LOCAL/${dir} ${WORK}/. \
380           && ln -s ${WORK}/${dir} $LOCAL/.
381       done
382    fi
383 fi
384 if [ "x${NEED_NCARG}" != "xNO" ] ; then
385 ( cd $LOCAL/pub ; [ ! -d ncl_ncarg-5.2.1.Linux_x86_64 ] && tar xvfz ncl_ncarg-5.2.1.Linux_x86_64.tar.gz )
386 fi
387
388 #
389 #  Install CDF if VER_CDF=CDFAUTO
390 #
391 if [ "x${VER_CDF}" == "xCDFAUTO" ] ;then
392 ( cd $LOCAL/src/LIB ; [ ! -d netcdf-${VERSION_CDF} ] && tar xvfz netcdf-${VERSION_CDF}.tar.gz )
393 fi
394 #
395 #  Install GRIBAPI
396 #
397 cd $LOCAL/src/LIB ; [ ! -d grib_api-${VERSION_GRIBAPI} ] && [ -f grib_api-${VERSION_GRIBAPI}.tar.gz ] && gunzip -c grib_api-${VERSION_GRIBAPI}.tar.gz |tar -xvf -
398 ##########################################################
399 #                                                        #
400 #      RESUME                                            #
401 #                                                        #
402 ##########################################################
403
404 echo  ARCH=${ARCH}
405 echo  VER_MPI=${VER_MPI}
406 echo  VER_USER=${VER_USER-" pas de version user ..."}
407 echo  OPTLEVEL=${OPTLEVEL}
408 echo  CONF_DOLLAR=${CONF_DOLLAR}
409 echo  VER_CDF=${VER_CDF}
410 echo  BIN_TOOLS=${BIN_TOOLS}
411 echo
412 echo  "---> XYZ=${XYZ}"
413 echo
414 echo "création du fichier -->  ../conf/profile_mesonh-${XYZ}"
415 echo
416 ##########################################################
417 #                                                        #
418 # ENVIRONEMENT MESONH ALLREADY SET                       #
419 #                                                        #
420 ##########################################################
421 else
422 clear
423 echo
424 echo "ATTENTION :: configure !!!!!"
425 echo
426 echo '  ---> vous avez déjà initialisé votre environnement MESONH sur cette version'
427 echo '  ---> $XYZ="'$XYZ'"'
428 echo
429 echo "Vérifiez votre fichier '.profile'" ou "'.bashrc'"  !!!
430 echo
431 echo "  ---> mettez en commentaire la ligne '. ../profile_mesonh...' "
432 echo "  ---> relogger vous sur une autre session et relancer ./configure "
433 echo
434 echo "Fichier 'profile_mesonh' non modifié !!! "
435 echo
436 exit 1
437 fi