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