Skip to content

Commit

Permalink
Merge pull request #1044 from kholland-intel/dockerfile_script
Browse files Browse the repository at this point in the history
Added a SOS Dockerfile script and a README
  • Loading branch information
David Ozog authored Mar 23, 2022
2 parents 2545682 + 8d32088 commit f360114
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 0 deletions.
122 changes: 122 additions & 0 deletions scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
FROM ubuntu:20.04

#For OneAPI compilers, the compilers must be added to the builders path
#FROM intel/oneapi-basekit:devel-ubuntu18.04
#ENV PATH=/opt/intel/oneapi/compiler/latest/linux/bin:$PATH

ENV SOS_INSTALL=/home/sos
RUN mkdir /home/sos
ENV DEBIAN_FRONTEND=noninteractive
ENV CC=gcc
ENV CXX=g++
# For OneAPI compilers use clang and clang++
# ENV CC=icx
# ENV CXX=icpx

RUN apt-get update -y && apt-get install -y \
git \
vim \
build-essential \
wget \
automake \
libtool \
flex \
python \
libhwloc-dev

#Packages added on Travis
RUN apt-get install -y libev-libevent-dev \
libev-dev \
mpich

# Build Libevent
WORKDIR $SOS_INSTALL
RUN wget -c https://github.com/libevent/libevent/releases/download/release-2.1.10-stable/libevent-2.1.10-stable.tar.gz
RUN tar -xzvf libevent-2.1.10-stable.tar.gz
WORKDIR libevent-2.1.10-stable
RUN ./autogen.sh
RUN ./configure --prefix=$SOS_INSTALL/libevent-2.1.10-stable/install
RUN make clean all install

# Build Hydra
WORKDIR $SOS_INSTALL
RUN wget -c https://www.mpich.org/static/downloads/4.0/hydra-4.0.tar.gz
RUN tar -xzvf hydra-4.0.tar.gz
WORKDIR hydra-4.0
RUN ./autogen.sh
RUN ./configure --prefix=$SOS_INSTALL/hydra-4.0/install
RUN make all install

# Build PMIx
WORKDIR $SOS_INSTALL
RUN git clone -b v4.1.1rc6 --depth 10 https://github.com/pmix/pmix pmix
WORKDIR pmix
RUN ./autogen.pl
RUN ./configure --prefix=$SOS_INSTALL/pmix/install --with-libevent=$SOS_INSTALL/libevent-2.1.10-stable/install --without-libev --disable-debug CFLAGS=-O3 --disable-shared --enable-static
RUN make -j
RUN make install

# Build PRRTE
WORKDIR $SOS_INSTALL
RUN git clone -b v2.0.0 --depth 10 https://github.com/pmix/prrte prrte
WORKDIR prrte
RUN ./autogen.pl
RUN ./configure --prefix=$SOS_INSTALL/prrte/install --with-pmix=$SOS_INSTALL/pmix/install --without-slurm --with-libevent=$SOS_INSTALL/libevent-2.1.10-stable/install --without-libev --disable-shared --enable-static
RUN make -j
RUN make install

# Build Libfabric
WORKDIR $SOS_INSTALL
RUN git clone -b v1.7.x --depth 10 https://github.com/ofiwg/libfabric.git libfabric
WORKDIR libfabric
RUN ./autogen.sh
# To build basic Libfabric
RUN ./configure --prefix=$SOS_INSTALL/libfabric/install
# To build Libfabric to use GNI provider:
#RUN ./configure --prefix=$SOS_INSTALL/libfabric/install-gni --enable-gni --disable-verbs --disable-sockets --disable-udp --disable-psm --disable-tcp
RUN make -j
RUN make install

# Build Portals 4
WORKDIR $SOS_INSTALL
RUN git clone --depth 10 https://github.com/regrant/portals4.git portals4
WORKDIR portals4
RUN ./autogen.sh
RUN ./configure --prefix=$SOS_INSTALL/portals4/install --enable-zero-mrs --enable-reliable-udp --disable-pmi-from-portals
RUN make -j
RUN make install

# Build UCX
#WORKDIR $SOS_INSTALL
#RUN git clone -b v1.9.0 --depth 10 https://github.com/openucx/ucx.git
#WORKDIR ucx
#RUN ./autogen.sh
#RUN ./configure --prefix=$SOS_INSTALL/ucx/install --enable-mt --disable-numa --without-java
#RUN make -j
#RUN make install

# Build SOS
WORKDIR $SOS_INSTALL
RUN git clone https://github.com/Sandia-OpenSHMEM/SOS.git
WORKDIR SOS
RUN ./autogen.sh
# To build SOS w/ basic Libfabric
RUN ./configure --prefix=$SOS_INSTALL/SOS/install --with-ofi=$SOS_INSTALL/libfabric/install --without-ucx --without-portals4 --enable-pmi-simple --disable-fortran
# To build SOS to use GNI provider
#RUN ./configure --prefix=$SOS_INSTALL/SOS/install-gni --with-ofi=$SOS_INSTALL/libfabric/install-gni --without-ucx --without-portals4 --enable-pmi-simple --enable-ofi-mr=basic --enable-completion-polling --disable-fortran
# To build SOS w/ Libfabric & PMIx
#RUN ./configure --prefix=$SOS_INSTALL/SOS/install --with-ofi=$SOS_INSTALL/libfabric/install --without-ucx --without-portals4 --with-pmix=$SOS_INSTALL/pmix/install --disable-shared --enable-static
# To build SOS w/ Portals 4
#RUN ./configure --prefix=$SOS_INSTALL/SOS/install-portals --with-ofi=$SOS_INSTALL/portals4/install --without-ucx --without-ofi --enable-pmi-simple
# To build SOS w/ UCX
#RUN ./configure --prefix=$SOS_INSTALL/SOS/install-ucx --with-ucx=$SOS_INSTALL/ucx/install --without-ofi --without-portals4 --enable-pmi-simple
RUN make -j
RUN make install
RUN make check TESTS= -j

#Start PRRTE server and use prun to run tests
#RUN make check TESTS= -j
#ENV PATH=$SOS_INSTALL/prrte/install/bin:$PATH
#RUN prte --daemonize --host localhost:4 --allow-run-as-root
#RUN SHMEM_INFO=1 make VERBOSE=1 TEST_RUNNER="prun -np 2" check
#RUN pterm
80 changes: 80 additions & 0 deletions scripts/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Sandia OpenSHMEM Docker Image
Sandia OpenSHMEM (SOS) utlizes Docker images to provide users a means to create
containers that provide a configurable Ubuntu sandbox for running SOS
applications and benchmarks.

## Creating SOS Containers from the Prebuilt Docker Images
Coming Soon: Information regarding the SOS public Docker Hub repos and prebuilt
images.

## Creating SOS Containers from the Dockerfile
This Dockerfile provides a configurable Ubuntu sandbox for running SOS
applications and benchmarks.

### Building the Image from the Dockerfile
To build the image from the Dockerfile, run the following command in the
directory that contains the Dockerfile:

```
$ docker build -t <name-of-image> .
```

Where `<name-of-image>` represents the name being used to label the image.
The "docker build" command will use the Dockerfile to build the docker image
from which containers can be created.
To create an interactive container from the image run the following command:

```
$ docker run -it <name-of-image>
```

Where the `-it` option makes the container interactive and allows the user to
actually step into the container and execute commands in the new environment.

### Dockerfile Options
Throughout the Dockerfile there are lines that can be commented/uncommented to
configure a particular testing environment and SOS build.

#### Ubuntu Image
The first option this file provides is the type of Ubuntu image docker
should pull from.

By default the Dockerfile pulls a lightweight Ubuntu 20.04 image.
The other option (which is commnented out) is for OneAPI image which uses
Ubunutu 18.04. The idea for this image was to allow users to test/run SOS
applications with non-gcc compilers.

Note: Currently, building the UCX libraries with the `icx` compiler leads to a
build error. When starting from the OneAPI image and using the `icx` compiler,
the Dockerfile lines which build UCX (the lines directly under "Build UCX") must
be commented out.

#### Building Libfabric
The next set of options are presented when it comes time to build Libfabric.

By default, a basic Libfabric configuration is built and installed to an
"install" directory (This option is currently uncommented).
The other option is to enable the GNI provider while building Libfabric. (For
this option uncomment the line of code under "To build Libfabric to use GNI provider")

#### Building SOS
Another set of options are presented when Building SOS.

By default, SOS is built with a basic Libfabric provider.
The next few options are:
* Build SOS with the GNI provider
* Build SOS with the Libfabric provider and PMIx
* Build SOS with Portals 4
* Build SOS with UCX

As a reminder, the chosen SOS configuration option must be uncommented, while
the other options must be commented out.

#### Enabling the PRRTE Server
The last portion of code that is optional in this Dockerfile is that which
enables the PRRTE Server.
This is mostly used to run SOS tests when the GNI provider has been enabled in
the Libfabric build.
When testing on the GNI provider uncomment the lines under "Start PRRTE server
and use prun to run tests" to build a container which runs "make check" on the
PRRTE server.

0 comments on commit f360114

Please sign in to comment.