-
Notifications
You must be signed in to change notification settings - Fork 4
/
install
executable file
·466 lines (387 loc) · 14.3 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
#! /bin/bash
source script/help
source script/discover_os
source script/show_solutions
source script/pre_req
source script/remove_old
source script/set_mpi
##
install_req=1
i_dir=" "
sq=0
while getopts :di:shc: FLAG; do
case $FLAG in
d)
echo "Disable depencencies installation"
install_req=0
;;
i)
echo "Setting dependencies installation dir: $OPTARG"
i_dir=$OPTARG
;;
s)
echo "Skipping user cin"
sq=1
;;
c)
echo "Fowarding options $OPTARG to configure script"
configure_options=$OPTARG
;;
h) #show help
HELP
;;
\?) #unrecognized option - are fowarded to configure
;;
esac
done
discover_os
## Remove old dependencies and installations
if [ x"$i_dir" == x" " ]; then
i_dir="$HOME"
fi
remove_old $i_dir
## Check and try to install the prerequisites
pre_req
## clone the dependencies
git submodule init
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
git submodule update
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
# Create config directory in each submodule
cd openfpm_data
if [ ! -d src/config ]; then
mkdir src/config
fi
cd ..
cd openfpm_devices
if [ ! -d src/config ]; then
mkdir src/config
fi
cd ..
cd openfpm_vcluster
if [ ! -d src/config ]; then
mkdir src/config
fi
cd ..
cd openfpm_io
if [ ! -d src/config ]; then
mkdir src/config
fi
cd ..
cd openfpm_numerics
if [ ! -d src/config ]; then
mkdir src/config
fi
cd ..
# Create config directory
if [ ! -d src/config ]; then
mkdir src/config
fi
## generate configure script
sh ./autogen.sh
if [ $? -ne 0 ]; then
echo -e "Configure\033[91;5;1m FAILED \033[0m"
exit 1
fi
## check for options
echo -e "\033[1;34;5mDEPENCENCIES INSTALLATION DIR \033[0m"
echo -e "Every required dependencies if needed will be installed into: \033[1;34;5m$i_dir\033[0m"
echo -e "if you want to install somewhere else do ./install -i /somewhere/else"
if [ $sq -eq 0 ]; then
unset commands
commands[0]="Continue"
possible_solutions "${commands[@]}"
fi
ncore=4
echo -e "\033[1mHow many core you want to use to install the dependencies?\033[0m"
if [ $sq -eq 0 ]; then
read ncore
fi
echo -e "Installing requirements into: $i_dir "
##
## Take all the options with the exception of -d -i -s
## call the configure script
### Installing PETSC
if [ ! -d "$i_dir/PETSC" -o ! -d "$i_dir/EIGEN" ]; then
echo -e "\033[1;34m Optional packages \033[0m"
echo -e "\033[1mDo you want to install linear algebra packages ?(y/n)\033[0m"
echo "Installation can take long time (90 minutes on i7-3612QM 4 cores)"
if [ $sq -eq 0 ]; then
read inst_lin_alg
else
inst_lin_alg = n
fi
# if [ ! x"$choose" == x"0" ]; then
# ./script/install_PETSC.sh $i_dir $choose
# configure_options="$configure_options --with-PETSC=$i_dir/PETSC "
# fi
fi
if [ -d "$i_dir/PETSC" ]; then
configure_options="$configure_options --with-petsc=$i_dir/PETSC "
fi
if [ -d "$i_dir/EIGEN" ]; then
configure_options=" $configure_options --with-eigen=$i_dir/EIGEN --with-suitesparse=$i_dir/SUITESPARSE "
configure_blas_option="--with-blas=-L$i_dir/OPENBLAS/lib -lopenblas"
fi
if [ -d "$i_dir/MPI" ]; then
configure_options="$configure_options CXX=mpic++ "
fi
if [ -d "$i_dir/METIS" ]; then
configure_options=" $configure_options --with-metis=$i_dir/METIS "
fi
if [ -d "$i_dir/BOOST" ]; then
configure_options=" $configure_options --with-boost=$i_dir/BOOST "
fi
if [ -d "$i_dir/PARMETIS" ]; then
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
fi
if [ -d "$i_dir/HDF5" ]; then
configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
fi
### MPI
if [ x"$MPI_valid" == x"yes" ]; then
configure_options="$configure_options CXX=mpic++ "
else
./script/install_MPI.sh $i_dir $ncore
fi
### MPI compilers must be in your PATH folder
set_mpi $i_dir
### METIS and ParMETIS must be installed independently from sistem wide installation
./script/install_Parmetis.sh $i_dir $ncore
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp $ncore
configure_options=" $configure_options --with-metis=$i_dir/METIS "
MPI_installed=0
MPI_System_prv=1
METIS_installed=1
PARMETIS_installed=1
BOOST_installed=0
BOOST_System_prv=1
LAPACK_installed=0
LAPACK_System_prv=1
SUITESPARSE_installed=0
SUITESPARSE_System_prv=1
EIGEN_installed=0
EIGEN_System_prv=1
HDF5_installed=0
HDF5_System_prv=1
conf_err=1
if [ $install_req -eq 0 ]; then
./configure $options $configure_options $configure_blas_option
else
while [ $conf_err -ne 0 ]
do
./configure $options $configure_options "$configure_blas_option"
conf_err=$?
echo "Configure script terminated with $conf_err"
## if MPI or METIS installation required install it
if [ $conf_err -eq 200 ]; then
echo "MPI not found try to install, $MPI_installed"
if [ $MPI_installed -eq 1 ]; then
echo "Error the installation of MPI failed"
exit 1
fi
./script/install_MPI.sh $i_dir $ncore
MPI_installed=1
export PATH="$PATH:$i_dir/MPI/bin"
configure_options="$configure_options CXX=mpic++ "
elif [ $conf_err -eq 201 ]; then
echo "Metis not found try to install"
if [ $METIS_installed -eq 1 ]; then
echo "Error the installation of METIS failed"
exit 1
fi
./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp
METIS_installed=1
configure_options=" $configure_options --with-metis=$i_dir/METIS "
elif [ $conf_err -eq 202 ]; then
echo "Boost not found try to install in $i_dir with $compiler_opt"
if [ $BOOST_installed -eq 1 ]; then
echo "Error the installation of Boost failed"
exit 1
fi
./script/install_BOOST.sh $i_dir $ncore
BOOST_installed=1
configure_options=" $configure_options --with-boost=$i_dir/BOOST "
elif [ $conf_err -eq 208 ]; then
echo "ParMetis not found try to install"
if [ $PARMETIS_installed -eq 1 ]; then
echo "Error the installation of ParMETIS failed"
exit 1
fi
./script/install_Parmetis.sh $i_dir $ncore
PARMETIS_installed=1
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
elif [ $conf_err -eq 207 ]; then
echo "HDF5 not found try to install"
if [ $HDF5_installed -eq 1 ]; then
echo "Error the installation of HDF5 failed"
exit 1
fi
./script/install_HDF5.sh $i_dir $ncore
configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
HDF5_installed=1
elif [ $conf_err -ne 0 ]; then
echo "I do not know how to recover from this error"
exit 1
fi
done
if [ x"$inst_lin_alg" == x"y" ]; then
./script/install_EIGEN.sh $i_dir $ncore
if [ $? -eq 0 ]; then
configure_options=" $configure_options --with-eigen=$i_dir/EIGEN --with-suitesparse=$i_dir/SUITESPARSE "
configure_blas_option=" --with-blas=\"$i_dir/OPENBLAS/lib -lopenblas\" "
fi
./script/install_PETSC.sh $i_dir $ncore
if [ $? -eq 0 ]; then
configure_options=" $configure_options --with-petsc=$i_dir/PETSC "
fi
fi
./configure $options $configure_options $configure_blas_option
fi
### Create example.mk
install_base=$(cat install_dir)
echo "INCLUDE_PATH=-I. -I$install_base/openfpm_numerics/include -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include -I$i_dir/PARMETIS/include -I$i_dir/BOOST/include -I$i_dir/HDF5/include" > example.mk
echo "LIBS_PATH= -L$install_base/openfpm_devices/lib -L$install_base/openfpm_pdata/lib -L$install_base/openfpm_vcluster/lib -L$i_dir/METIS/lib -L$i_dir/PARMETIS/lib -L$i_dir/BOOST/lib -L$i_dir/HDF5/lib" >> example.mk
echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lmetis -lparmetis -lboost_iostreams -lhdf5" >> example.mk
echo "LIBS_SE2=-lvcluster -lofpmmemory_se2 -lparmetis -lmetis -lboost_iostreams -lhdf5" >> example.mk
cp example.mk src/example.mk
cp example.mk example/example.mk
make clean
make
if [ $? -ne 0 ]; then
conf_err=1
fi
echo "Command used to configure"
echo ""
echo -e "\033[1m ./configure $options $configure_options \033[0m "
echo ""
if [ x"$platform" = x"linux" ]; then
bash_library="export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH"
else
bash_library="export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH"
fi
bash_path="export PATH=\"\$PATH"
echo -e "\033[1;34;5m --------------------------------------- \033[0m"
echo -e "\033[1;34;5m --------- INSTALLATION REPORT --------- \033[0m"
echo ""
echo -e "\033[1;34;5m ---------- Mandatory packages --------- \033[0m"
echo ""
if [ -d "$i_dir/MPI" ]; then
installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m $i_dir/MPI \033[0m\n"
bash_path="$bash_path:$i_dir/MPI/bin"
bash_library="$bash_library:$i_dir/MPI/lib"
elif [ $MPI_System_prv -eq 1 ]; then
installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m System installation \033[0m\n"
fi
if [ -d "$i_dir/METIS" ]; then
installation_report="$installation_report \033[92;1mMETIS\033[0m Installed: \033[1m $i_dir/METIS \033[0m\n"
bash_library="$bash_library:$i_dir/METIS/lib"
fi
if [ -d "$i_dir/PARMETIS" ]; then
installation_report="$installation_report \033[92;1mPARMETIS\033[0m Installed: \033[1m $i_dir/PARMETIS \033[0m\n"
bash_library="$bash_library:$i_dir/PARMETIS/lib"
fi
if [ -d "$i_dir/BOOST" ]; then
installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m $i_dir/BOOST \033[0m\n"
bash_library="$bash_library:$i_dir/BOOST/lib"
elif [ $BOOST_System_prv -eq 1 ]; then
installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m System installation \033[0m\n"
fi
if [ -d "$i_dir/HDF5" ]; then
installation_report="$installation_report \033[92;1mHDF5\033[0m Installed: \033[1m $i_dir/HDF5 \033[0m\n"
bash_library="$bash_library:$i_dir/HDF5/lib"
fi
echo -e "$installation_report"
echo ""
echo -e "\033[1;34;5m ---------- Optional packages ----------- \033[0m"
echo ""
installation_report=""
if [ -d "$i_dir/PETSC" ]; then
installation_report="$installation_report \033[92;1mPETSC\033[0m Installed: \033[1m $i_dir/PETSC \033[0m\n"
bash_library="$bash_library:$i_dir/PETSC/lib"
else
installation_report="$installation_report \033[91;1mPETSC\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/EIGEN" ]; then
installation_report="$installation_report \033[92;1mEIGEN\033[0m Installed: \033[1m $i_dir/EIGEN \033[0m\n"
fi
echo -e "$installation_report"
echo -e "\033[1;34;5m -------------------------------- \033[0m"
installation_report=""
if [ -d "$i_dir/TRILINOS" ]; then
installation_report="$installation_report \033[92;1mTRILINOS\033[0m Installed: \033[1m $i_dir/TRILINOS \033[0m\n"
bash_library="$bash_library:$i_dir/TRILINOS/lib"
else
installation_report="$installation_report \033[91;1mTRILINOS\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/OPENBLAS" ]; then
installation_report="$installation_report \033[92;1mOPENBLAS\033[0m Installed: \033[1m $i_dir/OPENBLAS \033[0m\n"
bash_library="$bash_library:$i_dir/OPENBLAS/lib"
else
installation_report="$installation_report \033[91;1mOPENBLAS\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/SUITESPARSE" ]; then
installation_report="$installation_report \033[92;1mSUITESPARSE\033[0m Installed: \033[1m $i_dir/SUITESPARSE \033[0m\n"
bash_library="$bash_library:$i_dir/SUITESPARSE/lib"
else
installation_report="$installation_report \033[91;1mSUITESPARSE\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/SCALAPACK" ]; then
installation_report="$installation_report \033[92;1mSCALAPACK\033[0m Installed: \033[1m $i_dir/SCALAPACK \033[0m\n"
bash_library="$bash_library:$i_dir/SCALAPACK/lib"
else
installation_report="$installation_report \033[91;1mSCALAPACK\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/MUMPS" ]; then
installation_report="$installation_report \033[92;1mMUMPS\033[0m Installed: \033[1m $i_dir/MUMPS \033[0m\n"
bash_library="$bash_library:$i_dir/MUMPS/lib"
else
installation_report="$installation_report \033[91;1mMUMPS\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/SUPERLU_DIST" ]; then
installation_report="$installation_report \033[92;1mSUPERLU_DIST\033[0m Installed: \033[1m $i_dir/SUPERLU_DIST \033[0m\n"
bash_library="$bash_library:$i_dir/SUPERLU_DIST/lib"
else
installation_report="$installation_report \033[91;1mSUPERLU_DIST\033[0m Installed: \033[1m NO \033[0m\n"
fi
if [ -d "$i_dir/HYPRE" ]; then
installation_report="$installation_report \033[92;1mHYPRE\033[0m Installed: \033[1m $i_dir/HYPRE \033[0m\n"
bash_library="$bash_library:$i_dir/HYPRE/lib"
else
installation_report="$installation_report \033[91;1mHYPRE\033[0m Installed: \033[1m NO \033[0m\n"
fi
bash_path="$bash_path\""
bash_library="$bash_library\""
##### Writing openfpm_vars file
echo "$bash_path" > $HOME/openfpm_vars
echo "$bash_library" >> $HOME/openfpm_vars
echo -e "$installation_report"
echo ""
echo ""
if [ $conf_err -eq 0 ]; then
echo -e "Install summary\033[92;5;1m SUCCEED \033[0m"
else
echo -e "Install summary\033[91;5;1m FAILED \033[0m"
fi
echo ""
if [ x"$platform" = x"linux" ]; then
echo "Before run any openfpm program you must execute the following command. A simple way would be to append this line at the end of your $HOME/.bashrc"
else
echo "Before run any openfpm program you must execute the following command. A simple way would be to append this line at the end of your $HOME/.bash_profile"
fi
echo ""
echo -e "\033[1m source $HOME/openfpm_vars \033[0m"
echo ""
echo -e "\033[91;1m if you have in your .bashrc or .bash_profile old openfpm setting, please remove it\033[0m"
echo ""
echo ""
if [ $conf_err -ne 0 ]; then
exit 1
fi