-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathcompile_prereqs.sh
More file actions
executable file
·144 lines (95 loc) · 3.37 KB
/
Copy pathcompile_prereqs.sh
File metadata and controls
executable file
·144 lines (95 loc) · 3.37 KB
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
#!/bin/bash
# this script is to help those who must compile everything except the compiler.
# For example, CentOS < 8 users.
# if using Gfortran, Gfortran >= 6 is REQUIRED
# Newer Gfortran versions e.g. Gfortran 8, 9, etc. are recommended for better performance.
# Gfortran 6 is the oldest currently supported version, so stay ahead by using say Gfortran 8 or newer.
#
# Gemini currently has a bug with Ifort, but once that's fixed, Ifort should work. For now use Gfortran.
#
# Flang, PGI and/or NAG support are anticipated soon from vendors, possibly in 2019.
# Ask if desired.
set -e # abort on any error
set -u # abort on undefined variable (a common bash goof)
# ======= user config ====================
# Arbitrary names/locations
# all libraries installed under $PREFIX/libraryname
PREFIX=$HOME/.local
# whatever name you want to name at end of each library directory, arbitrary
SUFFIX=gcc7
# working directory, so you can rebuild later without complete recompilation
WD=$HOME/libs_gemini-$SUFFIX
# for each library, switch "true" to "false" if you don't want it.
BUILDMPI=true
BUILDLAPACK=true
BUILDSCALAPACK=true
BUILDMUMPS=true
# which compilers do you want?
export FC=$(which gfortran)
export CC=$(which gcc)
export CXX=$(which g++)
echo "FC=$FC"
echo "CC=$CC"
echo "CXX=$CXX"
# ================================================
# normally don't adjust parameters below this line
# Library parameters
LAPACKGIT=https://github.com/Reference-LAPACK/lapack
LAPACKPREFIX=$PREFIX/lapack-$SUFFIX
MPIVERSION=3.1.3 # MPI 4 doesn't currently work with ScalaPack
MPIFN=openmpi-$MPIVERSION.tar.bz2
MPIURL=https://download.open-mpi.org/release/open-mpi/v3.1/$MPIFN
MPISHA1=b3c60e2bdd5a8a8e758fd741f9a5bebb84da5e81
MPIPREFIX=$PREFIX/openmpi-$MPIVERSION-$SUFFIX
SCALAPACKGIT=https://github.com/scivision/scalapack
SCALAPACKPREFIX=$PREFIX/scalapack-$SUFFIX
MUMPSGIT=https://github.com/scivision/mumps
[[ $($FC -dumpversion) < 6 ]] && { echo "Gfortran >= 6 required"; exit 1; }
cmake --version
mkdir -p $WD
#==============================================================
# OpenMPI 3.1
# At this time, Scalapack isn't compatible with OpenMPI 4
# https://www.open-mpi.org/software/ompi/v3.1/
if $BUILDMPI
then
cd $WD
[[ -f $MPIFN ]] || curl -L $MPIURL -o $MPIFN
[[ $(sha1sum $MPIFN | cut -f1 -d' ') == $MPISHA1 ]] || { echo "checksum not match $MPIFN"; exit 1; }
tar -xf $MPIFN
cd $WD/openmpi-$MPIVERSION
echo "installing OpenMPI $MPIVERSION to $MPIPREFIX"
./configure --prefix=$MPIPREFIX CC=$CC CXX=$CXX FC=$FC
make -j -l2
make install
fi
#================================================================
# LAPACK
if $BUILDLAPACK
then
cd $WD
[[ -d lapack ]] && { cd lapack; git pull; cd ..; } || git clone --depth 1 $LAPACKGIT
cd lapack
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_LIBDIR=$LAPACKPREFIX ..
cmake --build -j . --target install -- -l 2
fi
#===============
# scalapack
if $BUILDSCALAPACK
then
cd $WD
[[ -d scalapack ]] && { cd scalapack; git pull; cd ..; } || git clone --depth 1 $SCALAPACKGIT
cd scalapack/build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=$SCALAPACKPREFIX -DMPI_ROOT=$MPIPREFIX -DLAPACK_ROOT=$LAPACKPREFIX ..
cmake --build -j . --target install -- -l 2
fi
#=================
# MUMPS
if $BUILDMUMPS; then
cd $WD
[[ -d mumps ]] && { cd mumps; git pull; cd ..; } || git clone --depth 1 $MUMPSGIT mumps
cd mumps
./build_self.sh $PREFIX $SUFFIX $MPIPREFIX $LAPACKPREFIX $SCALAPACKPREFIX
fi