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