From d60e2937aa2f86f7c447234369d1c7b6ec05934a Mon Sep 17 00:00:00 2001 From: Harmen Stoppels <harmenstoppels@gmail.com> Date: Tue, 14 Apr 2020 16:24:41 +0200 Subject: [PATCH] CI on Daint via Sarus (#1006) * Add Dockerfiles for MPI + CUDA test builds on Daint * Add bors.toml for CI on Daint * Add the separate ci repo as submodule for convenience * Add a CI badge for master to the top of the readme --- .gitmodules | 3 +++ README.md | 2 +- bors.toml | 4 ++++ ci | 1 + docker/build-env/Dockerfile | 32 +++++++++++++++++++++++++ docker/deploy/Dockerfile | 48 +++++++++++++++++++++++++++++++++++++ 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 bors.toml create mode 160000 ci create mode 100644 docker/build-env/Dockerfile create mode 100644 docker/deploy/Dockerfile diff --git a/.gitmodules b/.gitmodules index 5c440195..39d8dd17 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "python/pybind11"] path = python/pybind11 url = https://github.com/pybind/pybind11.git +[submodule "ci"] + path = ci + url = https://gitlab.com/cscs-ci/arbor-sim/arbor-ci.git diff --git a/README.md b/README.md index 58c79241..f6264228 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[](https://gitpod.io/#https://github.com/arbor-sim/arbor) +[](https://gitlab.com/cscs-ci/arbor-sim/arbor/-/commits/master) [](https://gitpod.io/#https://github.com/arbor-sim/arbor) # Arbor Library diff --git a/bors.toml b/bors.toml new file mode 100644 index 00000000..adceaa7a --- /dev/null +++ b/bors.toml @@ -0,0 +1,4 @@ +status = [ + "ci/gitlab/%", +] +delete_merged_branches = true diff --git a/ci b/ci new file mode 160000 index 00000000..042c9ed9 --- /dev/null +++ b/ci @@ -0,0 +1 @@ +Subproject commit 042c9ed94a681cbaf2b2d1fcae4b9942cdb2f720 diff --git a/docker/build-env/Dockerfile b/docker/build-env/Dockerfile new file mode 100644 index 00000000..873f1768 --- /dev/null +++ b/docker/build-env/Dockerfile @@ -0,0 +1,32 @@ +FROM nvidia/cuda:10.1-devel-ubuntu18.04 + +WORKDIR /root + +ARG MPICH_VERSION=3.1.4 + +ENV DEBIAN_FRONTEND noninteractive +ENV FORCE_UNSAFE_CONFIGURE 1 +ENV MPICH_VERSION ${MPICH_VERSION} + +# Install basic tools +RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \ + build-essential \ + python \ + git tar wget curl && \ + rm -rf /var/lib/apt/lists/* + +# Install cmake +RUN wget -qO- "https://cmake.org/files/v3.17/cmake-3.17.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local + +# Install MPICH ABI compatible with Cray's lib on Piz Daint +RUN wget -q https://www.mpich.org/static/downloads/${MPICH_VERSION}/mpich-${MPICH_VERSION}.tar.gz && \ + tar -xzf mpich-${MPICH_VERSION}.tar.gz && \ + cd mpich-${MPICH_VERSION} && \ + ./configure --disable-fortran && \ + make install -j$(nproc) && \ + rm -rf mpich-${MPICH_VERSION}.tar.gz mpich-${MPICH_VERSION} + +# Install bundle tooling for creating small Docker images +RUN wget -q https://github.com/haampie/libtree/releases/download/v1.0.3/libtree_x86_64.tar.gz && \ + tar -xzf libtree_x86_64.tar.gz && \ + rm libtree_x86_64.tar.gz diff --git a/docker/deploy/Dockerfile b/docker/deploy/Dockerfile new file mode 100644 index 00000000..6b1da7ee --- /dev/null +++ b/docker/deploy/Dockerfile @@ -0,0 +1,48 @@ +# Multistage build: here we import the current source code +# into build environment image, build the project, bundle it +# and then extract it into a small image that just contains +# the binaries we need to run + +ARG BUILD_ENV + +FROM $BUILD_ENV as builder + +# Build arbor +COPY . /arbor + +# Build and bundle binaries +RUN mkdir /arbor/build && cd /arbor/build && \ + CC=mpicc CXX=mpicxx cmake .. \ + -DARB_VECTORIZE=ON \ + -DARB_ARCH=broadwell \ + -DARB_WITH_PYTHON=OFF \ + -DARB_WITH_MPI=ON \ + -DARB_WITH_GPU=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr && \ + make -j$(nproc) tests && \ + /root/libtree/libtree --chrpath --strip \ + -d /root/arbor.bundle \ + /arbor/build/bin/modcc \ + /arbor/build/bin/unit \ + /arbor/build/bin/unit-local \ + /arbor/build/bin/unit-modcc \ + /arbor/build/bin/unit-mpi && \ + rm -rf /arbor + +FROM ubuntu:18.04 + +# This is the only thing necessary really from nvidia/cuda's ubuntu18.04 runtime image +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility +ENV NVIDIA_REQUIRE_CUDA "cuda>=10.1 brand=tesla,driver>=384,driver<385 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411" + +COPY --from=builder /root/arbor.bundle /root/arbor.bundle + +# Make it easy to call our binaries. +ENV PATH="/root/arbor.bundle/usr/bin:$PATH" + +RUN echo "/root/arbor.bundle/usr/lib/" > /etc/ld.so.conf.d/arbor.conf && ldconfig + +WORKDIR /root/arbor.bundle/usr/bin + -- GitLab