Skip to content

Commit

Permalink
Update docker build to use python3.8 and el8 (gwastro#3776)
Browse files Browse the repository at this point in the history
* Update docker build to use python3.8 and el8

* Need the thing to run

* Don't add already present repo.

* Try again

* Try again

* Move around dependencies

* One more update

* Update mpi to use openmpi

* Try this

* Add rsync and wheel/cython

* Don't have a password on PRs, so move this about
  • Loading branch information
spxiwh authored Aug 26, 2021
1 parent c9b5f72 commit d57898a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 38 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: docker build

on: [push]
on: [push, pull_request]

jobs:
build:
build:
runs-on: ubuntu-20.04
steps:
-
steps:
-
uses: actions/checkout@v1
-
-
name: "Set up Python"
uses: actions/setup-python@v1
with:
python-version: 2.7
-
with:
python-version: 3.8
-
name: "Preparing a host container"
run: "docker build -t pycbc-docker-tmp ."
-
-
name: "Installing PyCBC and dependencies"
run: "docker run --privileged --name pycbc_inst -v `pwd`:/scratch:ro pycbc-docker-tmp /bin/bash -c /scratch/docker/etc/docker-install.sh"
-
-
env:
DOCKER_IMG: pycbc/pycbc-el7
DOCKER_IMG: pycbc/pycbc-el8
name: "Running docker commit"
run: "bash -e docker/etc/docker_commit.sh"
-
env:
DOCKER_IMG: pycbc/pycbc-el7
-
env:
DOCKER_IMG: pycbc/pycbc-el8
DOCKER_PASSWORD: "${{secrets.DOCKERHUB_PASSWORD}}"
DOCKER_USERNAME: "${{secrets.DOCKERHUB_USERNAME}}"
name: "Pushing docker image"
Expand Down
29 changes: 15 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:centos7
FROM igwn/base:el8

ADD docker/etc/profile.d/pycbc.sh /etc/profile.d/pycbc.sh
ADD docker/etc/profile.d/pycbc.csh /etc/profile.d/pycbc.csh
Expand All @@ -7,39 +7,40 @@ ADD docker/etc/cvmfs/60-osg.conf /etc/cvmfs/60-osg.conf
ADD docker/etc/cvmfs/config-osg.opensciencegrid.org.conf /etc/cvmfs/config-osg.opensciencegrid.org.conf

# Set up extra repositories
RUN rpm -ivh http://software.ligo.org/lscsoft/scientific/7/x86_64/production/l/lscsoft-production-config-1.3-1.el7.noarch.rpm && yum install -y https://repo.ius.io/ius-release-el7.rpm && yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm && yum install -y cvmfs cvmfs-config-default && yum -y install http://repo.opensciencegrid.org/osg/3.4/osg-3.4-el7-release-latest.rpm && yum clean all && yum makecache && \
yum -y groupinstall "Compatibility Libraries" \
"Development Tools" \
RUN dnf -y install https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm && dnf -y install cvmfs cvmfs-config-default && dnf -y install http://repo.opensciencegrid.org/osg/3.6/osg-3.6-el8-release-latest.rpm && dnf clean all && dnf makecache && \
dnf -y groupinstall "Development Tools" \
"Scientific Support" && \
rpm -e --nodeps git perl-Git && yum -y install python2-pip python-setuptools zlib-devel libpng-devel libjpeg-devel libsqlite3-dev sqlite-devel db4-devel openssl-devel git2u-all fftw-libs-single fftw-devel fftw fftw-libs-long fftw-libs fftw-libs-double gsl gsl-devel libframe-utils libframe-devel libframe libmetaio libmetaio-devel libmetaio-utils hdf5 hdf5-devel python-devel which osg-wn-client osg-ca-certs && pip install --upgrade pip==19.3.1 setuptools==44.0.0 && pip install mkl==2019.0 ipython jupyter
rpm -e --nodeps git perl-Git && dnf -y install @python38 rsync zlib-devel libpng-devel libjpeg-devel sqlite-devel openssl-devel fftw-libs-single fftw-devel fftw fftw-libs-long fftw-libs fftw-libs-double gsl gsl-devel hdf5 hdf5-devel python38-devel which osg-wn-client osg-ca-certs && python3.8 -m pip install --upgrade pip setuptools wheel cython && python3.8 -m pip install mkl ipython jupyter lalsuite && dnf clean all

# set up environment
RUN cd / && \
mkdir -p /cvmfs/config-osg.opensciencegrid.org /cvmfs/oasis.opensciencegrid.org /cvmfs/gwosc.osgstorage.org && echo "config-osg.opensciencegrid.org /cvmfs/config-osg.opensciencegrid.org cvmfs ro,noauto 0 0" >> /etc/fstab && echo "oasis.opensciencegrid.org /cvmfs/oasis.opensciencegrid.org cvmfs ro,noauto 0 0" >> /etc/fstab && echo "gwosc.osgstorage.org /cvmfs/gwosc.osgstorage.org cvmfs ro,noauto 0 0" >> /etc/fstab && mkdir -p /oasis /scratch /projects /usr/lib64/slurm /var/run/munge && \
groupadd -g 1000 pycbc && useradd -u 1000 -g 1000 -d /opt/pycbc -k /etc/skel -m -s /bin/bash pycbc

# Install MPI software needed for pycbc_inference
RUN yum install -y libibverbs libibverbs-devel libibmad libibmad-devel libibumad libibumad-devel librdmacm librdmacm-devel libmlx5 libmlx4 && curl http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.1.tar.gz | tar -C /tmp -zxf - && \
cd /tmp/mvapich2-2.1 && ./configure --prefix=/opt/mvapich2-2.1 && make install && \
cd / && rm -rf /tmp/mvapich2-2.1 && \
pip install schwimmbad && \
MPICC=/opt/mvapich2-2.1/bin CFLAGS='-I /opt/mvapich2-2.1/include -L /opt/mvapich2-2.1/lib -lmpi' pip install --no-cache-dir mpi4py
RUN echo "/opt/mvapich2-2.1/lib" > /etc/ld.so.conf.d/mvapich2-2.1.conf
# at the end.
RUN dnf -y install libibverbs libibverbs-devel libibmad libibmad-devel libibumad libibumad-devel librdmacm librdmacm-devel libmlx5 libmlx4 openmpi openmpi-devel && \
python3.8 -m pip install schwimmbad && \
MPICC=/lib64/openmpi/bin/mpicc CFLAGS='-I /usr/include/openmpi-x86_64/ -L /usr/lib64/openmpi/lib/ -lmpi' python3.8 -m pip install --no-cache-dir mpi4py
RUN echo "/usr/lib64/openmpi/lib/" > /etc/ld.so.conf.d/openmpi.conf

# Now update all of our library installations
RUN rm -f /etc/ld.so.cache && /sbin/ldconfig

# Make python be what we want
RUN alternatives --set python /usr/bin/python3.8

# Explicitly set the path so that it is not inherited from build the environment
ENV PATH "/usr/local/bin:/usr/bin:/bin:/opt/mvapich2-2.1/bin"
ENV PATH "/usr/local/bin:/usr/bin:/bin:/lib64/openmpi/bin/bin"

# Set the default LAL_DATA_PATH to point at CVMFS first, then the container.
# Users wanting it to point elsewhere should start docker using:
# docker <cmd> -e LAL_DATA_PATH="/my/new/path"
ENV LAL_DATA_PATH "/cvmfs/oasis.opensciencegrid.org/ligo/sw/pycbc/lalsuite-extra/current/share/lalsimulation:/opt/pycbc/pycbc-software/share/lal-data"

# When the container is started with
# docker run -it pycbc/pycbc-el7:latest
# docker run -it pycbc/pycbc-el8:latest
# the default is to start a loging shell as the pycbc user.
# This can be overridden to log in as root with
# docker run -it pycbc/pycbc-el7:latest /bin/bash -l
# docker run -it pycbc/pycbc-el8:latest /bin/bash -l
CMD ["/bin/su", "-l", "pycbc"]
4 changes: 2 additions & 2 deletions docker/etc/docker-install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -v
set -e
cd /scratch
pip install -r requirements.txt
pip install .
python3.8 -m pip install -r requirements.txt
python3.8 -m pip install .
cd /
mkdir -p /opt/pycbc/src
cp -a /scratch /opt/pycbc/src/pycbc
Expand Down
3 changes: 2 additions & 1 deletion docker/etc/push_image.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
SOURCE_TAG=`git show-ref | grep ${GITHUB_SHA} | grep -E -o "refs/tags.{0,100}" | cut -c11-`
MASTER_HASH=`git rev-parse origin/master`
if [ "x${SOURCE_TAG}" == "x" ] ; then
if [ "x${MASTER_HASH}" == "x${GITHUB_SHA}" ] ; then
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker tag ${DOCKER_IMG} ${DOCKER_IMG}:latest || exit 1 ;
docker push ${DOCKER_IMG}:latest || exit 1 ;
else
echo "Not on master or a tag, so not pushing the docker image."
fi
else
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker tag ${DOCKER_IMG} ${DOCKER_IMG}:${SOURCE_TAG} || exit 1 ;
docker push ${DOCKER_IMG}:${SOURCE_TAG} || exit 1 ;
fi ;
8 changes: 4 additions & 4 deletions docs/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ The easiest way to start using PyCBC is to install one of our `Docker containers

To start a Docker container with no graphics, type the commands::

docker pull pycbc/pycbc-el7:latest
docker run -it pycbc/pycbc-el7:latest
docker pull pycbc/pycbc-el8:latest
docker run -it pycbc/pycbc-el8:latest

This example downloads current version of the code from the `GitHub master branch. <https://github.com/ligo-cbc/pycbc>`_ Replace the string ``latest`` with one of the `PyCBC release tags <https://github.com/ligo-cbc/pycbc/releases>`_ (e.g. ``v1.7.0``) to install a container containing a released version of PyCBC. The container includes all of the required software and dependencies to run PyCBC, including a compatible version of LALSuite installed into the root filesystem. The command above starts a login shell as the pycbc user. To override this and log in as root, run the command::

docker run -it pycbc/pycbc-el7:latest /bin/bash -l
docker run -it pycbc/pycbc-el8:latest /bin/bash -l

-------------------------------------
Using jupyter notebook within docker
Expand All @@ -21,7 +21,7 @@ Using jupyter notebook within docker
One can start a jupyter notebook within docker and then port forward to your
computer's environment.::

docker run -it -p 8888:8888 --name pycbc_test pycbc/pycbc-el7:latest /bin/su -l pycbc -c "jupyter notebook --no-browser --ip 0.0.0.0"
docker run -it -p 8888:8888 --name pycbc_test pycbc/pycbc-el8:latest /bin/su -l pycbc -c "jupyter notebook --no-browser --ip 0.0.0.0"

Once the image is running, you can connect from your computer's web browser to the address printed to the screen by jupyter. This is typically the local host adddress, e.g. ``127.0.0.1``

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Getting Started
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(){
Typed.new(".element", {
strings: ["^500<strong>docker pull pycbc/pycbc-el7:latest</strong><br>$ ^500<strong>docker run -it pycbc/pycbc-el7:latest</strong><br>&#40;pycbc-software&#41;&#91;pycbc@37184573e664 &#126;&#93;$ ^500<strong>python</strong><br>Python 2.7.5 &#40;default, Nov 6 2016, 00:28:07&#41;<br>&#91;GCC 4.8.5 20150623 &#40;Red Hat 4.8.5-11&#41;&#93; on linux2<br>&gt;&gt;&gt; ^500<strong>execfile&#40;&quot;/opt/pycbc/src/pycbc/examples/waveform/match_waveform.py&quot;&#41;</strong><br>^1000The match is: 0.953<br>&gt;&gt;&gt; ^500<strong>from pycbc.waveform import td_approximants</strong><br>&gt;&gt;&gt; ^500<strong>print td_approximants&#40;&#41;&#91;20:24&#93;</strong><br>['SEOBNRv3', 'SEOBNRv2', 'SpinTaylorT1', 'SEOBNRv4']<br>&gt;&gt;&gt; "],
strings: ["^500<strong>docker pull pycbc/pycbc-el8:latest</strong><br>$ ^500<strong>docker run -it pycbc/pycbc-el8:latest</strong><br>&#40;pycbc-software&#41;&#91;pycbc@37184573e664 &#126;&#93;$ ^500<strong>python</strong><br>Python 2.7.5 &#40;default, Nov 6 2016, 00:28:07&#41;<br>&#91;GCC 4.8.5 20150623 &#40;Red Hat 4.8.5-11&#41;&#93; on linux2<br>&gt;&gt;&gt; ^500<strong>execfile&#40;&quot;/opt/pycbc/src/pycbc/examples/waveform/match_waveform.py&quot;&#41;</strong><br>^1000The match is: 0.953<br>&gt;&gt;&gt; ^500<strong>from pycbc.waveform import td_approximants</strong><br>&gt;&gt;&gt; ^500<strong>print td_approximants&#40;&#41;&#91;20:24&#93;</strong><br>['SEOBNRv3', 'SEOBNRv2', 'SpinTaylorT1', 'SEOBNRv4']<br>&gt;&gt;&gt; "],
typeSpeed: 0
});
});
Expand Down
4 changes: 2 additions & 2 deletions docs/workflow/pycbc_make_coinc_search_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1012,14 +1012,14 @@ It is also through arguments to ``pycbc_submit_dax`` that the workflow is made a
Singularity image to use when running ``pycbc_inspiral``. This is done by including the following
argument to ``pycbc_submit_dax``::

--append-site-profile "osg:condor|+SingularityImage:\"/cvmfs/singularity.opensciencegrid.org/pycbc/pycbc-el7:latest\"" \
--append-site-profile "osg:condor|+SingularityImage:\"/cvmfs/singularity.opensciencegrid.org/pycbc/pycbc-el8:latest\"" \

The precise line above will cause ``pycbc_inspiral`` to run using the code in the latest version of PyCBC
as found on the ``master`` branch. You may well prefer a specific version (for example, for a production
run) and each release will also have a corresponding Singularity image published to CVMFS. For example,
to use the ``1.14.3`` release of PyCBC, use instead the line::

--append-site-profile "osg:condor|+SingularityImage:\"/cvmfs/singularity.opensciencegrid.org/pycbc/pycbc-el7:v1.14.3\"" \
--append-site-profile "osg:condor|+SingularityImage:\"/cvmfs/singularity.opensciencegrid.org/pycbc/pycbc-el8:v1.14.3\"" \

You may also direct the workflow to use a Singularity image of your own, if that has been published to CVMFS.

Expand Down

0 comments on commit d57898a

Please sign in to comment.