install 18.2 KB
Newer Older
Pietro Incardona's avatar
Pietro Incardona committed
1
#! /bin/bash
Pietro Incardona's avatar
Pietro Incardona committed
2

Pietro Incardona's avatar
Pietro Incardona committed
3
4
5
6
7
source script/help
source script/discover_os
source script/show_solutions
source script/pre_req
source script/remove_old
incardon's avatar
incardon committed
8
source script/set_mpi
incardon's avatar
incardon committed
9
source script/conf_PETSC
incardon's avatar
incardon committed
10
source script/update_openfpm
11
source script/solve_python
12

incardon's avatar
incardon committed
13
### switch to the branch
incardon's avatar
incardon committed
14
15
#b_switch=`git rev-parse --abbrev-ref HEAD`
#b_switch=
incardon's avatar
incardon committed
16
17
18
b_switch=$(cat switch_branch)
if [ x"$b_switch" != x"" ]; then
        git checkout $b_switch
incardon's avatar
incardon committed
19
20
21
	rm switch_branch
	./install "$@"
	exit 0
incardon's avatar
incardon committed
22
23
fi

Pietro Incardona's avatar
Pietro Incardona committed
24
25
26
27
## Check that your home is not empty

if [ x"$HOME" == x"" ]; then
	 echo -e "Your $HOME folder is empty \033[91;5;1m FAILED \033[0m"
Pietro Incardona's avatar
Pietro Incardona committed
28
	 exit 1
Pietro Incardona's avatar
Pietro Incardona committed
29
30
fi

incardon's avatar
incardon committed
31
32
## If 

Pietro Incardona's avatar
Pietro Incardona committed
33
install_req=1
incardon's avatar
incardon committed
34
i_dir=""
Pietro Incardona's avatar
Pietro Incardona committed
35
sq=0
incardon's avatar
incardon committed
36
nomake=0
incardon's avatar
incardon committed
37
38
update_openfpm=0
upgrade_openfpm=0
Pietro Incardona's avatar
Pietro Incardona committed
39

incardon's avatar
incardon committed
40
while getopts di:smhc:nu FLAG; do
Pietro Incardona's avatar
Pietro Incardona committed
41
	case $FLAG in
Pietro Incardona's avatar
Pietro Incardona committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	    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
	      ;;
58
59
60
61
        m)
          echo "Skip to make the testing"
          nomake=1
          ;;
incardon's avatar
incardon committed
62
63
64
65
66
	    u)
	      echo "Updating openfpm"
	      update_openfpm=1
	      ;;
	    n)
67
          echo "Upgrading openfpm"
incardon's avatar
incardon committed
68
69
	      upgrade_openfpm=1
	      ;;
Pietro Incardona's avatar
Pietro Incardona committed
70
	    h)  #show help
71
72
73
74
      	  HELP
          ;;
    	\?) #unrecognized option - are fowarded to configure
          ;;
Pietro Incardona's avatar
Pietro Incardona committed
75
	esac
incardon's avatar
incardon committed
76
77
done

incardon's avatar
incardon committed
78
79
80
81
82
### Configure options

i_dir_old=$i_dir
configure_options_old=$configure_options

incardon's avatar
incardon committed
83
84
discover_os

85
86
## Remove old dependencies and installations

incardon's avatar
incardon committed
87
if [ x"$i_dir" == x"" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
88
89
90
 i_dir="$HOME"
fi

incardon's avatar
incardon committed
91
92
93
## Check and try to install the prerequisites


incardon's avatar
incardon committed
94
95
96
97
98
99
if [ $update_openfpm -eq 1 -a  $upgrade_openfpm -eq 1 ]; then
	echo -e "\033[1;5;31m It is not possible to update and upgrade at the same time \033[0m"
	exit 1
fi

if [ $update_openfpm -eq 1 ]; then
incardon's avatar
incardon committed
100
	update_openfpm update
incardon's avatar
incardon committed
101
	exit 0
incardon's avatar
incardon committed
102
103
104
fi

if [ $upgrade_openfpm -eq 1 ]; then
incardon's avatar
incardon committed
105
	update_openfpm upgrade
incardon's avatar
incardon committed
106
	exit 0
incardon's avatar
incardon committed
107
108
fi

109
remove_old $i_dir $configure_options
incardon's avatar
incardon committed
110
111
112
113
114

## Check and try to install the prerequisites

pre_req

incardon's avatar
incardon committed
115
## clone the dependencies
incardon's avatar
incardon committed
116
git submodule init
Yaser Afshar's avatar
Yaser Afshar committed
117
118
119
120
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
121

incardon's avatar
incardon committed
122
git submodule update
Yaser Afshar's avatar
Yaser Afshar committed
123
124
125
126
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
127

incardon's avatar
incardon committed
128
129
130
131
132
133
#### Eventualy remove garbage from old installation

rm -rf openfpm_numerics/src/.deps
rm -rf src/.deps


incardon's avatar
incardon committed
134
135
# Create config directory in each submodule
cd openfpm_data
incardon's avatar
incardon committed
136
137
138
if [ ! -d src/config  ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
139
140
141
cd ..

cd openfpm_devices
incardon's avatar
incardon committed
142
143
144
if [ ! -d src/config  ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
145
146
147
cd ..

cd openfpm_vcluster
incardon's avatar
incardon committed
148
149
150
if [ ! -d src/config  ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
151
152
153
cd ..

cd openfpm_io
incardon's avatar
incardon committed
154
155
156
if [ ! -d src/config  ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
157
158
cd ..

incardon's avatar
incardon committed
159
160
161
162
163
164
cd openfpm_numerics
if [ ! -d src/config  ]; then
  mkdir src/config
fi
cd ..

incardon's avatar
incardon committed
165
# Create config directory
incardon's avatar
incardon committed
166

incardon's avatar
incardon committed
167
168
169
if [ ! -d src/config ]; then
  mkdir src/config
fi
incardon's avatar
incardon committed
170

incardon's avatar
incardon committed
171
## generate configure script
incardon's avatar
incardon committed
172

incardon's avatar
incardon committed
173
sh ./autogen.sh
Incardona Pietro's avatar
Incardona Pietro committed
174
175
176
177
if [ $? -ne 0 ]; then
  echo -e "Configure\033[91;5;1m FAILED \033[0m"
  exit 1
fi
incardon's avatar
incardon committed
178

incardon's avatar
incardon committed
179
## check for options
incardon's avatar
incardon committed
180
181
182
183

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"
incardon's avatar
incardon committed
184
185
186
187
if [ x"$configure_options" == x"" ]; then
    echo -e "OpenFPM will be installed into: \033[1;34;5m/usr/local\033[0m"
    echo "if you want to install in a different place use ./install -c \"--prefix=/where/you/want/to/install\""
fi
incardon's avatar
incardon committed
188
if [ $sq -eq 0 ]; then
189
  unset commands
190
#  commands[0]="continue"
incardon's avatar
incardon committed
191
192
  possible_solutions "${commands[@]}"
fi
incardon's avatar
incardon committed
193

Pietro Incardona's avatar
Pietro Incardona committed
194
ncore=4
incardon's avatar
incardon committed
195
echo -e "\033[1mHow many core you want to use to install the dependencies?\033[0m"
196
197
198
if [ $sq -eq 0 ]; then
  read ncore
fi
incardon's avatar
incardon committed
199

incardon's avatar
incardon committed
200
201
202
203
echo -e "Installing requirements into: $i_dir "

##

incardon's avatar
incardon committed
204
## Take all the options with the exception of -d -i -s
incardon's avatar
incardon committed
205
206
207

## call the configure script

incardon's avatar
incardon committed
208
209
### Installing PETSC

incardon's avatar
incardon committed
210
if [ ! -d "$i_dir/PETSC" -o ! -d "$i_dir/EIGEN" ]; then
incardon's avatar
incardon committed
211
212
213
    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)"
214
215
216
    if [ $sq -eq 0 ]; then
      read inst_lin_alg
    else
incardon's avatar
incardon committed
217
      inst_lin_alg="y"
218
    fi
219
220
221
222
223
224
225

    ### PETSC require Python

    command -v python
    if [ $? -ne 0 ]; then
      ### We have to install python
      echo "OpenFPM require python but it's not installed, searching a solution... "
226
      solve_python $platform
227
228
229
      command -v python
      if [ $? -ne 0 ]; then
	echo -e "python\033[91;5;1m FAILED \033[0m"
incardon's avatar
incardon committed
230
        exit 1
231
232
      fi
    fi
incardon's avatar
incardon committed
233
234
235
236
237
238

    if haveProg python2; then
      python_command=python2
    else
      # we check that python is python2
      py_ver=$(python --version 2>&1 | grep Python | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1/g')
incardon's avatar
incardon committed
239
      
incardon's avatar
incardon committed
240
241
      if [ $py_ver -eq 3 ]; then
        # we have to install python2
incardon's avatar
incardon committed
242
	echo -e "\033[1mPETSC require python2 installed, searching a solution to install python2 ... \033[0m"
incardon's avatar
incardon committed
243
244
245
246
247
        solve_python $platform
      fi
      python_command=python
    fi

incardon's avatar
incardon committed
248
249
fi

incardon's avatar
incardon committed
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#### License and Copyright disclamer

echo -e "\033[1;34m Licenses  \033[0m"
echo -e "\033[1;34m OpenFPM install several dependencies automatically. Some of them impose restriction and the user must explicitly accept it \033[0m"
echo -e "\033[1;33m PARMETIS: \033[0m \033[1m http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download  (Copyright and License) \033[0m"
echo -e ""

if [ $sq -eq 0 ]; then
  unset commands
  commands[0]="Accept and continue"
  possible_solutions_no_continue "${commands[@]}"
fi

####

265
266
lin_alg_dir=""
lin_alg_lib=""
Pietro Incardona's avatar
Pietro Incardona committed
267
lin_alg_inc=""
incardon's avatar
incardon committed
268
269
270
271
272
273
274
275
276
277
278
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 "
incardon's avatar
incardon committed
279
fi
Pietro Incardona's avatar
Pietro Incardona committed
280
281
282
if [ -d "$i_dir/LIBHILBERT" ]; then
    configure_options=" $configure_options --with-libhilbert=$i_dir/LIBHILBERT "
fi
incardon's avatar
incardon committed
283

Pietro Incardona's avatar
Pietro Incardona committed
284
285
286
### if we are on linux we have to add -rt

if [ x"$platform" = x"linux" ]; then
Pietro Incardona's avatar
Pietro Incardona committed
287
	lin_alg_lib="$lin_alg_lib -lrt"
Pietro Incardona's avatar
Pietro Incardona committed
288
289
fi

incardon's avatar
incardon committed
290
291
### MPI compilers must be in your PATH folder

292
set_mpi $i_dir $ncore $CC $CXX $F77 $FC
incardon's avatar
incardon committed
293

294
295
### METIS and ParMETIS must be installed independently from sistem wide installation

incardon's avatar
incardon committed
296
./script/install_Parmetis.sh $i_dir $ncore
297
configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
incardon's avatar
incardon committed
298

incardon's avatar
incardon committed
299
./script/install_Metis.sh $i_dir $CC $CXX $ncore
300
configure_options=" $configure_options --with-metis=$i_dir/METIS "
301

incardon's avatar
incardon committed
302
MPI_installed=0
incardon's avatar
incardon committed
303
MPI_System_prv=1
304
305
METIS_installed=1
PARMETIS_installed=1
incardon's avatar
incardon committed
306
BOOST_installed=0
incardon's avatar
incardon committed
307
BOOST_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
308
LAPACK_installed=0
incardon's avatar
incardon committed
309
LAPACK_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
310
SUITESPARSE_installed=0
incardon's avatar
incardon committed
311
SUITESPARSE_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
312
EIGEN_installed=0
incardon's avatar
incardon committed
313
EIGEN_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
314
HDF5_installed=0
incardon's avatar
incardon committed
315
HDF5_System_prv=1
Pietro Incardona's avatar
Pietro Incardona committed
316
LIBHILBERT_installed=0
incardon's avatar
incardon committed
317
318
conf_err=1

319

incardon's avatar
incardon committed
320
if [ $install_req -eq 0 ]; then
incardon's avatar
incardon committed
321
    ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
322
323
324
else
    while [ $conf_err -ne 0 ]
    do
325
        ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
326
327
        conf_err=$?

328
        echo "Configure script terminated with $conf_err"
incardon's avatar
incardon committed
329
330
331

        ## if MPI or METIS installation required install it
        if [ $conf_err -eq 200  ]; then
332
            echo "MPI not found try to install, $MPI_installed"
incardon's avatar
incardon committed
333
334
335
336
            if [ $MPI_installed -eq 1 ]; then
                echo "Error the installation of MPI failed"
                exit 1
            fi
337
            ./script/install_MPI.sh $i_dir $ncore $CC $CXX $F77 $FC
incardon's avatar
incardon committed
338
            MPI_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
339
            export PATH="$i_dir/MPI/bin:$PATH"
340
            configure_options="$configure_options CXX=mpic++ "
incardon's avatar
incardon committed
341
342
343
344
345
346
        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
incardon's avatar
incardon committed
347
            ./script/install_Metis.sh $i_dir $CC $CXX
incardon's avatar
incardon committed
348
            METIS_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
349
            configure_options=" $configure_options --with-metis=$i_dir/METIS "
incardon's avatar
incardon committed
350
        elif [ $conf_err -eq 202 ]; then
351
            echo "Boost not found try to install in $i_dir with $compiler_opt"
incardon's avatar
incardon committed
352
            if [ $BOOST_installed -eq 1  ]; then
incardon's avatar
incardon committed
353
354
355
                echo "Error the installation of Boost failed"
                exit 1
            fi
incardon's avatar
incardon committed
356
            if [ x"$CXX" == x"icpc" ]; then
incardon's avatar
incardon committed
357
              ./script/install_BOOST.sh $i_dir $ncore intel-linux
incardon's avatar
incardon committed
358
359
            elif [ x"$CXX" == x"clang++" ]; then
              ./script/install_BOOST.sh $i_dir $ncore darwin
incardon's avatar
incardon committed
360
361
362
            else
              ./script/install_BOOST.sh $i_dir $ncore gcc
            fi
incardon's avatar
incardon committed
363
            BOOST_installed=1
Yaser Afshar's avatar
Yaser Afshar committed
364
            configure_options=" $configure_options --with-boost=$i_dir/BOOST "
365
        elif [ $conf_err -eq 208 ]; then
366
367
368
369
370
            echo "ParMetis not found try to install"
            if [ $PARMETIS_installed -eq 1  ]; then
                echo "Error the installation of ParMETIS failed"
                exit 1
            fi
incardon's avatar
incardon committed
371
            ./script/install_Parmetis.sh $i_dir $ncore
372
373
            PARMETIS_installed=1
            configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS "
Pietro Incardona's avatar
Pietro Incardona committed
374
375
376
        elif [ $conf_err -eq 207 ]; then
            echo "HDF5 not found try to install"
            if [ $HDF5_installed -eq 1 ]; then
Pietro Incardona's avatar
Pietro Incardona committed
377
                echo "Error the installation of HDF5 failed"
378
                exit 1
Pietro Incardona's avatar
Pietro Incardona committed
379
            fi
incardon's avatar
incardon committed
380
            ./script/install_HDF5.sh $i_dir $ncore
Pietro Incardona's avatar
Pietro Incardona committed
381
            configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
Pietro Incardona's avatar
Pietro Incardona committed
382
            HDF5_installed=1
Pietro Incardona's avatar
Pietro Incardona committed
383
384
385
386
387
388
389
390
391
        elif [ $conf_err -eq 210 ]; then
            echo "LIBHILBERT not found try to install"
            if [ $LIBHILBERT_installed -eq 1 ]; then
                echo "Error the installation of LIBHILBERT failed"
                exit 1
            fi
            ./script/install_LIBHILBERT.sh $i_dir $ncore
            configure_options=" $configure_options --with-libhilbert=$i_dir/LIBHILBERT "
            LIBHILBERT_installed=1
incardon's avatar
incardon committed
392
393
394
395
396
        elif [ $conf_err -ne 0 ]; then
            echo "I do not know how to recover from this error"
            exit 1
        fi
    done
incardon's avatar
incardon committed
397

incardon's avatar
incardon committed
398
    if [ x"$inst_lin_alg" == x"y" ]; then
incardon's avatar
incardon committed
399
        ./script/install_EIGEN.sh $i_dir $ncore
incardon's avatar
incardon committed
400
        ./script/install_PETSC.sh $i_dir $ncore $CC $CXX $F77 $FC
incardon's avatar
incardon committed
401
402
    fi

403
404
    ### collect PETSC configuration options
    conf_PETSC
incardon's avatar
incardon committed
405
406

    ./configure $options $configure_options "$configure_blas_option"
incardon's avatar
incardon committed
407
408
fi

Pietro Incardona's avatar
Pietro Incardona committed
409
### Create example.mk
410
install_base=$(cat install_dir)
411
412
openmp_flags="$(cat openmp_flags) $(cat openfpm_flags)"

incardon's avatar
incardon committed
413
414
415
416
417
418
if [ -d "$i_dir/HDF5/lib" ]; then
  hdf5_lib=$i_dir/HDF5/lib
elif [ -d "$i_dir/HDF5/lib64" ]; then
  hdf5_lib=$i_dir/HDF5/lib64
fi

incardon's avatar
incardon committed
419
echo "INCLUDE_PATH= $openmp_flags  -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 -I$i_dir/LIBHILBERT/include  $lin_alg_inc" > example.mk
incardon's avatar
incardon committed
420
echo "LIBS_PATH= $openmp_flags -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$hdf5_lib -L$i_dir/LIBHILBERT/lib  $lin_alg_dir" >> example.mk
Pietro Incardona's avatar
Pietro Incardona committed
421
422
echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lhdf5 -llibhilbert  $lin_alg_lib" >> example.mk
echo "LIBS_SE2=-lvcluster -lofpmmemory_se2 -lparmetis -lmetis -lboost_iostreams -lhdf5 -llibhilbert $lin_alg_lib" >> example.mk
Pietro Incardona's avatar
Pietro Incardona committed
423
424
cp example.mk src/example.mk
cp example.mk example/example.mk
425

incardon's avatar
incardon committed
426
if [ $nomake -eq 0 ]; then
incardon's avatar
incardon committed
427
  make clean
incardon's avatar
incardon committed
428
  make -j $ncore
incardon's avatar
incardon committed
429
fi
incardon's avatar
incardon committed
430
431
432
433
434

if [ $? -ne 0 ]; then
  conf_err=1
fi

incardon's avatar
incardon committed
435
436
echo "Command used to configure"
echo ""
incardon's avatar
incardon committed
437
echo -e "\033[1m ./configure $options $configure_options \033[0m "
incardon's avatar
incardon committed
438
echo ""
incardon's avatar
incardon committed
439
440

if [ x"$platform" = x"linux" ]; then
incardon's avatar
incardon committed
441
  bash_library="export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:/$install_base/openfpm_devices/lib:/$install_base/openfpm_vcluster/lib"
incardon's avatar
incardon committed
442
else
incardon's avatar
incardon committed
443
  bash_library="export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:/$install_base/openfpm_devices/lib:/$install_base/openfpm_vcluster/lib"
incardon's avatar
incardon committed
444
445
fi

incardon's avatar
incardon committed
446
bash_path="export PATH=\""
incardon's avatar
incardon committed
447
448
449
450

echo -e "\033[1;34;5m ---------------------------------------  \033[0m"
echo -e "\033[1;34;5m --------- INSTALLATION REPORT ---------  \033[0m"
echo ""
incardon's avatar
incardon committed
451
452
echo -e "\033[1;34;5m ---------- Mandatory packages ---------  \033[0m"
echo ""
incardon's avatar
incardon committed
453

incardon's avatar
incardon committed
454
455
if [ -d "$i_dir/MPI" ]; then
  installation_report="$installation_report \033[92;1mMPI\033[0m Installed: \033[1m $i_dir/MPI \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
456
  bash_path="$bash_path:$i_dir/MPI/bin:"
incardon's avatar
incardon committed
457
458
459
  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"
incardon's avatar
incardon committed
460
fi
incardon's avatar
incardon committed
461

Pietro Incardona's avatar
Pietro Incardona committed
462
if [ -d "$i_dir/METIS" ]; then
incardon's avatar
incardon committed
463
  installation_report="$installation_report \033[92;1mMETIS\033[0m Installed: \033[1m $i_dir/METIS \033[0m\n"
incardon's avatar
incardon committed
464
  bash_library="$bash_library:$i_dir/METIS/lib"
465
466
fi

Pietro Incardona's avatar
Pietro Incardona committed
467
if [ -d "$i_dir/PARMETIS" ]; then
incardon's avatar
incardon committed
468
469
470
471
  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

Pietro Incardona's avatar
Pietro Incardona committed
472
if [ -d "$i_dir/BOOST" ]; then
incardon's avatar
incardon committed
473
  installation_report="$installation_report \033[92;1mBOOST\033[0m Installed: \033[1m $i_dir/BOOST \033[0m\n"
incardon's avatar
incardon committed
474
  bash_library="$bash_library:$i_dir/BOOST/lib"
incardon's avatar
incardon committed
475
476
477
478
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

Pietro Incardona's avatar
Pietro Incardona committed
479
if [ -d "$i_dir/HDF5" ]; then
incardon's avatar
incardon committed
480
  installation_report="$installation_report \033[92;1mHDF5\033[0m Installed: \033[1m $i_dir/HDF5 \033[0m\n"
incardon's avatar
incardon committed
481
  bash_library="$bash_library:$hdf5_lib"
incardon's avatar
incardon committed
482
fi
incardon's avatar
incardon committed
483

Pietro Incardona's avatar
Pietro Incardona committed
484
485
486
487
488
if [ -d "$i_dir/LIBHILBERT" ]; then
  installation_report="$installation_report \033[92;1mLibHilbert\033[0m Installed: \033[1m $i_dir/LIBHILBERT \033[0m\n"
  bash_library="$bash_library:$i_dir/LIBHILBERT/lib"
fi

incardon's avatar
incardon committed
489
490
491
492
493
494
495
echo -e "$installation_report"

echo ""
echo -e "\033[1;34;5m ---------- Optional packages -----------  \033[0m"
echo ""

installation_report=""
incardon's avatar
incardon committed
496
lin_alg_installed=""
incardon's avatar
incardon committed
497
498
499
500

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"
incardon's avatar
incardon committed
501
  lin_alg_installed="y"
incardon's avatar
incardon committed
502
503
else
  installation_report="$installation_report \033[91;1mPETSC\033[0m Installed: \033[1m NO \033[0m\n"
incardon's avatar
incardon committed
504
fi
incardon's avatar
incardon committed
505

incardon's avatar
incardon committed
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
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"
Pietro Incardona's avatar
Pietro Incardona committed
528
fi
incardon's avatar
incardon committed
529
530
531

if [ -d "$i_dir/SUITESPARSE" ]; then
  installation_report="$installation_report \033[92;1mSUITESPARSE\033[0m Installed: \033[1m $i_dir/SUITESPARSE \033[0m\n"
incardon's avatar
incardon committed
532
  bash_library="$bash_library:$i_dir/SUITESPARSE/lib"
incardon's avatar
incardon committed
533
534
else
  installation_report="$installation_report \033[91;1mSUITESPARSE\033[0m Installed: \033[1m NO \033[0m\n"
Pietro Incardona's avatar
Pietro Incardona committed
535
fi
incardon's avatar
incardon committed
536
537
538
539
540
541

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"
Pietro Incardona's avatar
Pietro Incardona committed
542
fi
incardon's avatar
incardon committed
543

incardon's avatar
incardon committed
544
545
546
547
548
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"
Pietro Incardona's avatar
Pietro Incardona committed
549
fi
incardon's avatar
incardon committed
550
551
552
553
554
555

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"
556
557
fi

incardon's avatar
incardon committed
558
559
560
561
562
563
564
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

565
bash_path="$bash_path\$PATH\""
incardon's avatar
incardon committed
566
bash_library="$bash_library\""
incardon's avatar
incardon committed
567
568
569
570
571
572

##### Writing openfpm_vars file

echo "$bash_path" > $HOME/openfpm_vars
echo "$bash_library" >> $HOME/openfpm_vars

incardon's avatar
incardon committed
573
574
575
576
if [ x"$platform" = x"osx" ]; then
    echo "TMPDIR=/tmp/" >> $HOME/openfpm_vars
fi

incardon's avatar
incardon committed
577
echo -e "$installation_report"
incardon's avatar
incardon committed
578
579
580
581
echo ""
echo ""
if [ $conf_err -eq 0  ]; then
  echo -e "Install summary\033[92;5;1m SUCCEED \033[0m"
incardon's avatar
incardon committed
582
583
  
  ## Save dependencies dir and foward options
incardon's avatar
incardon committed
584
585
  printf "%s" "$i_dir_old" > dependencies_dir
  printf "%s" "$configure_options_old" > foward_options
incardon's avatar
incardon committed
586

incardon's avatar
incardon committed
587
588
589
590
else
  echo -e "Install summary\033[91;5;1m FAILED \033[0m"
fi

incardon's avatar
incardon committed
591
592
echo ""
if [ x"$platform" = x"linux" ]; then
incardon's avatar
incardon committed
593
  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"
incardon's avatar
incardon committed
594
else
incardon's avatar
incardon committed
595
  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"
incardon's avatar
incardon committed
596
597
fi
echo ""
incardon's avatar
incardon committed
598
echo -e "\033[1m source $HOME/openfpm_vars \033[0m"
incardon's avatar
incardon committed
599
echo ""
incardon's avatar
incardon committed
600
echo -e "\033[91;1m if you have in your .bashrc or .bash_profile old openfpm setting, please remove it\033[0m"
incardon's avatar
incardon committed
601
602
echo ""
echo ""
incardon's avatar
incardon committed
603
if [ x"$inst_lin_alg" == "y" -a x"$lin_alg_installed" == x"" ]; then
incardon's avatar
incardon committed
604
605
  conf_err=1
fi
606
607
608
if [ $conf_err -ne 0 ]; then
  exit 1
fi