-
Notifications
You must be signed in to change notification settings - Fork 27
/
suitesparse-4.5.5-gcc_install
executable file
·72 lines (59 loc) · 2.11 KB
/
suitesparse-4.5.5-gcc_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
#!/usr/bin/env bash
set -o errexit -o nounset
for i in ${includes_dir:=$(dirname $0 2>/dev/null)/includes}/{module_maker,require}_inc.sh; do . $i; done
package_name="suitesparse"
package_version="4.5.5"
src_urls="http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${package_version}.tar.gz"
# Optional:
# package_variant=""
package_description="SuiteSparse is a suite of sparse matrix algorithms."
package_variant="threaded"
actual_file_name="SuiteSparse-${package_version}.tar.gz"
actual_file_sha256=b9a98de0ddafe7659adffad8a58ca3911c1afa8b509355e7aa58b02feb35d9b6
module purge
_env_setup() {
owd=$(pwd)
package_label="${package_name}/${package_version}${package_variant:+-${package_variant}}-gcc-4.9.2"
install_prefix=${INSTALL_PREFIX:-/shared/ucl/apps/$package_label}
build_dir=${BUILD_DIR:-$(mktemp -d -t ${package_name}-build.XXXXXXXX)}
module_dir=${MODULE_DIR:-$(mktemp -d -t ${package_name}-modules.XXXXXXXX)}
cd $build_dir
}
_fetch_files() {
wget ${actual_file_name:+-O $actual_file_name} $src_urls
sha256sum -c <<<"$actual_file_sha256 $actual_file_name"
}
_setup_files() {
basename=$(tar -tf $actual_file_name | head -n 1 | sed -e 's_/__')
tar -xf $actual_file_name
}
_build() {
cd SuiteSparse
require gcc-libs
require compilers/gnu/4.9.2
require openblas/0.3.2-native-threads/gnu-4.9.2
# Note: 4.5.5 builds METIS without OpenMP. That's probably okay, because this should just be doing MPI.
make BLAS="-L/shared/ucl/apps/openblas/0.3.2-serial/gnu-4.9.2/lib -lopenblas" LAPACK="-L/shared/ucl/apps/openblas/0.3.2-serial/gnu-4.9.2/lib -lopenblas"
make install INSTALL="$install_prefix"
echo "Installed to: $install_prefix"
}
_prepare_module() {
make_module -p "$install_prefix" \
-c "${package_name}" \
-o "$module_dir/$package_label" \
-w "Adds ${package_name} ${package_version} to your environment. $package_description"
echo "Module files put in: $module_dir" >&2
chmod a+rx $module_dir
}
_clean_up() {
cd $owd
if [ -n "$build_dir" ]; then
rm -Rf ${build_dir}
fi
}
_env_setup
_fetch_files
_setup_files
_build
_prepare_module
_clean_up