forked from PPPLDeepLearning/plasma-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-mpi.sh
executable file
·44 lines (36 loc) · 1.18 KB
/
install-mpi.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
#!/bin/sh
set -e
DOWNLOAD_DIR="${HOME}/tmp"
INSTALL_PREFIX="${HOME}/opt"
PACKAGE_NAME="${MPI_LIBRARY:?"MPI_LIBRARY not set!"}-${MPI_LIBRARY_VERSION:?"MPI_LIBRARY_VERSION not set!"}"
INSTALL_PREFIX="${INSTALL_PREFIX}/${PACKAGE_NAME}"
TARBALL_NAME="${PACKAGE_NAME}.tar.gz"
if [ -d "${INSTALL_PREFIX}" ]
then
echo "MPI library already installed: ${PACKAGE_NAME}"
exit 0
fi
case "$MPI_LIBRARY" in
openmpi)
OPENMPI_SHORTVERSION=$(expr "${MPI_LIBRARY_VERSION}" ":" "\(.\{1,\}\..\{1,\}\)\..\{1,\}")
SOURCE_URL="http://www.open-mpi.org/software/ompi/v${OPENMPI_SHORTVERSION}/downloads/${TARBALL_NAME}"
;;
mpich)
SOURCE_URL="http://www.mpich.org/static/downloads/${MPI_LIBRARY_VERSION}/${TARBALL_NAME}"
;;
esac
echo "Installing MPI library: ${PACKAGE_NAME}"
echo "into: ${INSTALL_PREFIX}"
echo "Download URL: ${SOURCE_URL}"
echo "Tarball name: ${TARBALL_NAME}"
mkdir -p "${DOWNLOAD_DIR}"
cd "${DOWNLOAD_DIR}"
rm -rf "${TARBALL_NAME}"
wget --no-check-certificate -O "${TARBALL_NAME}" "${SOURCE_URL}"
rm -rf "${PACKAGE_NAME}"
tar -xzf "${TARBALL_NAME}"
cd "${PACKAGE_NAME}"
mkdir -p "${INSTALL_PREFIX}"
./configure --enable-shared --prefix="${INSTALL_PREFIX}"
make -j 2
make -j 2 install