Skip to content

Instantly share code, notes, and snippets.

@omsrisagar
Forked from lukoshkin/Dockerfile
Created May 19, 2022 18:50
Show Gist options
  • Save omsrisagar/7fa274e3f73ef5206530f2aeace672c5 to your computer and use it in GitHub Desktop.
Save omsrisagar/7fa274e3f73ef5206530f2aeace672c5 to your computer and use it in GitHub Desktop.
Recipe of a docker image with Open-MPI 3.1.4 and mpi4py
FROM ubuntu:18.04
ENV USER mpitest
ENV HOME /home/$USER
ENV MPI_DIR=/opt/ompi
ENV PATH="$MPI_DIR/bin:$HOME/.local/bin:$PATH"
ENV LD_LIBRARY_PATH="$MPI_DIR/lib:$LD_LIBRARY_PATH"
WORKDIR $HOME
RUN apt-get -q update \
&& apt-get install -y \
python3 python3-dev python3-pip \
gcc gfortran binutils \
&& pip3 install --upgrade pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.bz2 .
RUN tar xf openmpi-3.1.4.tar.bz2 \
&& cd openmpi-3.1.4 \
&& ./configure --prefix=$MPI_DIR \
&& make -j4 all \
&& make install \
&& cd .. && rm -rf \
openmpi-3.1.4 openmpi-3.1.4.tar.bz2 /tmp/*
RUN groupadd -r mpitest \
&& useradd -r -g mpitest $USER \
&& chown -R mpitest:mpitest $HOME
USER $USER
RUN pip3 install --user -U setuptools \
&& pip3 install --user mpi4py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment