forked from chainer/chainermn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis_build_mpi.sh
77 lines (63 loc) · 1.98 KB
/
.travis_build_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
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
#!/bin/bash
# Prepare various MPI installations
BUILD_DIR=$HOME/mpi-build
mkdir -p ~/mpi
mkdir -p $BUILD_DIR
function install_mpich {
MPI=$1
VER=$(echo "$MPI" | grep -Eo "[0-9.]+$")
DIST="http://www.mpich.org/static/downloads/${VER}/mpich-${VER}.tar.gz"
PREFIX=$HOME/mpi/$MPI
FILE=$(basename $DIST)
echo PREFIX=$PREFIX
echo DIST=$DIST
echo "-------------------------------------------------"
echo "Installing $1"
echo "-------------------------------------------------"
if [ ! -x $PREFIX/bin/mpicxx ]; then
rm -rf $BUILD_DIR/*
cd $BUILD_DIR
mkdir -p $PREFIX
curl $DIST >$FILE
tar -xf $FILE
cd $(find . -maxdepth 1 -mindepth 1 -type d)
./configure --prefix=$PREFIX \
--disable-fortran \
--enable-cxx \
--enable-shared=yes
make -j4 && make install
fi
$PREFIX/bin/mpicxx -show
}
function install_ompi {
MPI=$1
VER=$(echo "$MPI" | grep -Eo "[0-9.]+$")
MAJOR=$(echo "$VER" | grep -Eo "^[0-9]+\.[0-9]+")
DIST="https://www.open-mpi.org/software/ompi/v${MAJOR}/downloads/openmpi-${VER}.tar.bz2"
PREFIX=$HOME/mpi/$MPI
FILE=$(basename $DIST)
echo PREFIX=$PREFIX
echo DIST=$DIST
echo "-------------------------------------------------"
echo "Installing $1"
echo "-------------------------------------------------"
if [ ! -x $PREFIX/bin/mpicxx ]; then
rm -rf $BUILD_DIR/*
cd $BUILD_DIR
mkdir -p $PREFIX
curl $DIST >$FILE
tar -xf $FILE
cd $(find . -maxdepth 1 -mindepth 1 -type d)
./configure --prefix=$PREFIX \
--disable-mpi-fortran \
--enable-mpi-cxx \
--enable-shared=yes
make -j4 && make install
fi
$PREFIX/bin/mpicxx --showme:version
}
if echo $MPI | grep -iq "openmpi"; then
install_ompi $MPI
elif echo $MPI | grep -iq "mpich"; then
install_mpich $MPI
fi