Skip to content

Commit 78cba7d

Browse files
committed
base: manually compile OpenMPI
Problem: the OpenMPI packaged with centos 7 does not include the PMI plugin, which is required to boot under Flux. The OpenMPI version packaged with centos 8 (4.0.5) has a bug that causes a segfault on finalization, which is fixed in the next patch version. PR that fixes the bug: (open-mpi/ompi#8380) Solution: for centos 7, hand compile the same version of OpenMPI (1.10), but with the `--with-pmi` flag. For centos 8, hand compile the version of OpenMPI with the patch (4.0.6). Since this is an involved process, add a helper script that will also make adding other MPIs much easier.
1 parent 27e58b1 commit 78cba7d

File tree

5 files changed

+70
-9
lines changed

5 files changed

+70
-9
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
docker build \
2222
-t exaworks/sdk-base:${{ matrix.dockerbase }} \
2323
--cache-from exaworks/sdk-base:${{ matrix.dockerbase }} \
24-
docker/base/${{ matrix.dockerbase }}
24+
-f docker/base/${{ matrix.dockerbase }}/Dockerfile \
25+
docker/base/
2526
docker build \
2627
-t rp:${{ matrix.dockerbase }} \
2728
--build-arg BASE_IMAGE=exaworks/sdk-base:${{ matrix.dockerbase }} \

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ jobs:
3737
id: docker_build
3838
uses: docker/build-push-action@v2
3939
with:
40-
context: ./docker/base/${{ matrix.dockerbase }}
40+
context: ./docker/base/
41+
file: ./docker/base/${{ matrix.dockerbase }}/Dockerfile
4142
push: true
4243
tags: |
4344
exaworks/sdk-base:${{ matrix.dockerbase }}

docker/base/centos7/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM centos:7
22

33
ARG MPI=openmpi-devel
4-
ARG MPI_PREFIX=/usr/lib64/openmpi/
4+
ARG MPI_PREFIX=/usr/local/
55
ENV VIRTUAL_ENV=/ve_exaworks
6-
ENV PATH="$VIRTUAL_ENV/bin:$MPI_PREFIX/bin:$PATH"
6+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
77
ENV MPI_PREFIX=${MPI_PREFIX}
88
ENV MPICC=$MPI_PREFIX/bin/mpicc
99

@@ -70,8 +70,6 @@ RUN yum -y update \
7070
# Radical Pilot Deps
7171
python3-pip \
7272
mongodb-org \
73-
# MPI Dep
74-
${MPI} \
7573
&& yum clean all \
7674
&& python3 -m venv ${VIRTUAL_ENV} \
7775
&& pip install --upgrade pip setuptools pytest \
@@ -86,3 +84,5 @@ RUN wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.15-bin.tar.
8684
&& ln -s /opt/apache-ant-1.9.15 /opt/ant \
8785
&& sudo ln -s /opt/ant/bin/ant /usr/bin/ant
8886

87+
COPY ./scripts/install-mpi.sh /install-mpi.sh
88+
RUN bash install-mpi.sh ${MPI}

docker/base/centos8/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM centos:8
22

33
ARG MPI=openmpi-devel
4-
ARG MPI_PREFIX=/usr/lib64/openmpi/
4+
ARG MPI_PREFIX=/usr/local/
55
ENV VIRTUAL_ENV=/ve_exaworks
66
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
77
ENV MPI_PREFIX=${MPI_PREFIX}
@@ -71,8 +71,6 @@ RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.n
7171
# RADICAL-Pilot Dependencies
7272
python3-pip \
7373
mongodb-org \
74-
# MPI Dep
75-
${MPI} \
7674
&& dnf clean all \
7775
&& python3 -m venv ${VIRTUAL_ENV} \
7876
&& pip install --upgrade pip setuptools pytest \
@@ -87,3 +85,5 @@ RUN wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.15-bin.tar.
8785
&& ln -s /opt/apache-ant-1.9.15 /opt/ant \
8886
&& sudo ln -s /opt/ant/bin/ant /usr/bin/ant
8987

88+
COPY ./scripts/install-mpi.sh /install-mpi.sh
89+
RUN bash install-mpi.sh ${MPI}

docker/base/scripts/install-mpi.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
if [[ -z $1 ]]; then
4+
echo "Must provide MPI that you want to install" 1>&2
5+
exit 1
6+
fi
7+
8+
function centos_major_version() {
9+
cat /etc/centos-release | cut -f 4 -d " " | cut -f 1 -d .
10+
}
11+
12+
# Install only the dependencies for a given package
13+
# Source: https://serverfault.com/questions/429123/howto-get-yum-to-install-only-dependencies-for-a-given-pakage
14+
yum_install_only_deps () {
15+
if [[ -z "$1" ]]; then
16+
echo "Package required for installing deps" 1>&2
17+
exit 1
18+
fi
19+
yum deplist $1 | grep provider | awk '{print $2}' | sort | uniq | grep -v $PACKAGE | sed ':a;N;$!ba;s/\n/ /g' | xargs yum -y install
20+
}
21+
22+
if [[ "$1" == "openmpi-devel" ]]; then
23+
if [[ $(centos_major_version) == "7" ]]; then
24+
yum install -y slurm-pmi-devel
25+
MAJOR_MINOR=1.10
26+
PATCH=7
27+
CONFIGURE_ARGS="--with-pmi --with-pmi-libdir=/usr/lib64"
28+
elif [[ $(centos_major_version) == "8" ]]; then
29+
yum_install_only_deps $1
30+
MAJOR_MINOR=4.0
31+
PATCH=6
32+
CONFIGURE_ARGS=""
33+
else
34+
echo "Unknown CentOS version. Exiting" 1>&2
35+
exit 1
36+
fi
37+
38+
OPENMPI=openmpi-${MAJOR_MINOR}.${PATCH}
39+
40+
wget https://download.open-mpi.org/release/open-mpi/v${MAJOR_MINOR}/${OPENMPI}.tar.gz
41+
tar -xf ./${OPENMPI}.tar.gz
42+
rm ./${OPENMPI}.tar.gz
43+
44+
cd ${OPENMPI}
45+
./configure ${CONFIGURE_ARGS}
46+
make -j 4
47+
make install
48+
cd ..
49+
rm -rf ${OPENMPI}
50+
51+
if [[ $(centos_major_version) == "7" ]]; then
52+
yum remove -y slurm-pmi-devel
53+
yum autoremove -y
54+
yum clean all
55+
fi
56+
else
57+
echo "Unknown/unsupported MPI. Existing without installing."
58+
exit 1
59+
fi

0 commit comments

Comments
 (0)