Juan 14/04/2015 : add OCCIGEN in configure for 5-2-0
[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.9.16 ;
84 export GRIBAPI_PATH=/opt/softs/libraries/ICC13.1.4.183/grib_api-1.9.16_libtool
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 "}
275               ;;
276
277 Linux*)
278                 export     ARCH=${ARCH:-LXgfortran}
279                 export  VER_MPI=${VER_MPI:-MPIVIDE}
280                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
281                 export MVWORK=${MVWORK:-NO}
282                 #export VER_CDF=${VER_CDF:-CDFGFOR}
283                 export VER_CDF=${VER_CDF:-CDFAUTO}
284                 export NEED_NCARG=${NEED_NCARG:-YES}
285               ;;
286 *)
287                 echo "WARNING ; system not yet tested "
288                 echo "WARNING ; edit profile_mesonh & set correct variables ARCH , VER_MPI & OPTLEVEL "
289
290                 export     ARCH=${ARCH}
291                 export  VER_MPI=${VER_MPI:-MPIVIDE}
292                 export OPTLEVEL=${OPTLEVEL:-DEBUG}
293               ;;
294 esac
295 ##
296 ## Environnement for scandollar
297 ##
298
299 if [ "x${CONF_DOLLAR}" = "x" ] ; then
300 # set default value for CONF_DOLLAR file
301 case "$(hostname)" in
302   tori*|yuki*)
303         export POSTCONF=confdollar_dsinec_default
304         ;;
305
306   lx*|px*|sx*)
307         export POSTCONF=confdollar_cnrmpc_default
308         ;;
309
310   aeropc*)
311         export POSTCONF=confdollar_aeropc_default
312
313         ;;
314
315   brodie*)
316         export POSTCONF=confdollar_brodie_default
317
318         ;;
319
320   vargas*)
321         export POSTCONF=confdollar_vargas_default
322         ;;
323
324   c1a*)
325         export POSTCONF=confdollar_c1a_default
326         ;;
327
328   service*)
329         export POSTCONF=confdollar_jade_default
330         ;;
331
332   babel*)
333         export POSTCONF=confdollar_babel_default
334         ;;
335   turing*)
336         export POSTCONF=confdollar_turing_default
337         ;;
338  titane*|curie*)
339         export POSTCONF=confdollar_titane_default
340         ;;
341
342   eos*)
343         export POSTCONF=confdollar_eos_default
344         ;;
345
346   occigen*)
347         export POSTCONF=confdollar_occigen_default
348         ;;
349
350   *)
351         export POSTCONF=confdollar_aeropc_default
352         ;;
353 esac
354
355 export CONF_DOLLAR=${LOCAL}/conf/post/${POSTCONF}
356
357 fi
358
359 #
360 #  Install 32/64 mesonh tools
361 #
362 if [ "x${NEED_TOOLS}" == "xYES" ] ; then
363   case "$(uname -m)" in
364   'x86_64')
365           export BIN_TOOLS=${BIN_TOOLS:-X86_64}
366            ;;
367   'x86'|'i'*'86')
368           export BIN_TOOLS=${BIN_TOOLS:-X86}
369            ;;
370   esac
371 fi
372
373 #
374 # Generate profile_mesonh
375 #
376 ${LOCAL}/bin/eval_dollar  profile_mesonh.ihm > profile_mesonh
377 chmod +x profile_mesonh
378 XYZ=${ARCH}${MNH_REAL}I${MNH_INT}-${VERSION_XYZ}${VER_USER:+-${VER_USER}}-${VER_MPI}-${OPTLEVEL}
379 cp profile_mesonh profile_mesonh-${XYZ}
380 #
381 #  Do some post-install stuff
382 #
383 if [ "x${MVWORK}" == "xYES" ] ; then
384    if [ "x${WORKDIR}" == "x" ] ; then
385      echo "ATTENTION :: configure !!!!!"
386      echo
387      echo '  ---> vous n avez pas initialiser la variable $WORKDIR '
388      echo '  ---> ou seront stoké les binaires et cas tests '
389      echo '  ---> initialisez la et relance "./configure"'
390      exit 1
391    fi
392    if [ -d $WORKDIR ] && [ ${LOCAL} == ${LOCAL##/work} ] ; then
393 #  if we are not allready in the workdir --> move stuff
394       WORK=$WORKDIR/${RACINE}_WORKDIR
395       mkdir -p ${WORK}
396       for dir in MY_RUN exe pub
397       do
398          [ -d $LOCAL/${dir} ] && [ ! -L $LOCAL/${dir} ] \
399           && mv $LOCAL/${dir} ${WORK}/. \
400           && ln -s ${WORK}/${dir} $LOCAL/.
401       done
402    fi
403 fi
404 if [ "x${NEED_NCARG}" != "xNO" ] ; then
405 ( cd $LOCAL/pub ; [ ! -d ncl_ncarg-5.2.1.Linux_x86_64 ] && tar xvfz ncl_ncarg-5.2.1.Linux_x86_64.tar.gz )
406 fi
407
408 #
409 #  Install CDF if VER_CDF=CDFAUTO
410 #
411 if [ "x${VER_CDF}" == "xCDFAUTO" ] ;then
412 ( cd $LOCAL/src/LIB ; [ ! -d netcdf-${VERSION_CDF} ] && tar xvfz netcdf-${VERSION_CDF}.tar.gz )
413 ( cd $LOCAL/src/LIB ; [ ! -d hdf5-${VERSION_HDF} ] && tar xvfz hdf5-${VERSION_HDF}.tar.gz )
414 fi
415 #
416 #  Install GRIBAPI
417 #
418 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 -
419 ##########################################################
420 #                                                        #
421 #      RESUME                                            #
422 #                                                        #
423 ##########################################################
424
425 echo  ARCH=${ARCH}
426 echo  VER_MPI=${VER_MPI}
427 echo  VER_USER=${VER_USER-" pas de version user ..."}
428 echo  OPTLEVEL=${OPTLEVEL}
429 echo  CONF_DOLLAR=${CONF_DOLLAR}
430 echo  VER_CDF=${VER_CDF}
431 echo  BIN_TOOLS=${BIN_TOOLS}
432 echo
433 echo  "---> XYZ=${XYZ}"
434 echo
435 echo "création du fichier -->  ../conf/profile_mesonh-${XYZ}"
436 echo
437 ##########################################################
438 #                                                        #
439 # ENVIRONEMENT MESONH ALLREADY SET                       #
440 #                                                        #
441 ##########################################################
442 else
443 clear
444 echo
445 echo "ATTENTION :: configure !!!!!"
446 echo
447 echo '  ---> vous avez déjà initialisé votre environnement MESONH sur cette version'
448 echo '  ---> $XYZ="'$XYZ'"'
449 echo
450 echo "Vérifiez votre fichier '.profile'" ou "'.bashrc'"  !!!
451 echo
452 echo "  ---> mettez en commentaire la ligne '. ../profile_mesonh...' "
453 echo "  ---> relogger vous sur une autre session et relancer ./configure "
454 echo
455 echo "Fichier 'profile_mesonh' non modifié !!! "
456 echo
457 exit 1
458 fi