-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-openmpi.sh
executable file
·56 lines (44 loc) · 1.21 KB
/
build-openmpi.sh
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
#!/usr/bin/env bash
set -ex
: ${SOURCE_ROOT:?} ${INSTALL_ROOT:?} ${OPENMPI_VERSION:?}
DIR_SRC=${SOURCE_ROOT}/openmpi
DIR_BUILD=${INSTALL_ROOT}/openmpi/build
DIR_INSTALL=${INSTALL_ROOT}/openmpi
FILE_MODULE=${INSTALL_ROOT}/modules/openmpi/${OPENMPI_VERSION}
get_download_url()
{
echo "https://download.open-mpi.org/release/open-mpi/v${OPENMPI_VERSION::-2}/openmpi-${OPENMPI_VERSION}.tar.gz"
}
if [[ ! -d ${DIR_SRC} ]]; then
(
mkdir -p ${DIR_SRC}
cd ${DIR_SRC}
wget -O- $(get_download_url) | tar xz --strip-components=1
)
fi
(
unset HWLOC_VERSION
mkdir -p ${DIR_BUILD}
cd ${DIR_BUILD}
${DIR_SRC}/configure --prefix=${DIR_INSTALL}
make -j${PARALLEL_BUILD}
make install
)
mkdir -p $(dirname ${FILE_MODULE})
cat >${FILE_MODULE} <<EOF
#%Module
proc ModulesHelp { } {
puts stderr {openmpi}
}
module-whatis {openmpi}
set root ${DIR_INSTALL}
conflict openmpi
module load gcc/${GCC_VERSION}
prereq gcc/${GCC_VERSION}
prepend-path CPATH \$root/include
prepend-path LD_LIBRARY_PATH \$root/lib
prepend-path LIBRARY_PATH \$root/lib
prepend-path MANPATH \$root/share/man
prepend-path PATH \$root/bin
prepend-path PKG_CONFIG_PATH \$root/lib/pkgconfig
EOF