05.11., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 5c29df71 authored by David Frank's avatar David Frank Committed by Tobias Lasser

Update docker images to new versions of Ubuntu, oneDNN, CMake, CUDA;

restructured Docerfiles

- Bump CMake to 3.18.2
- Bump oneDNN to 1.6.2
- Bump to Ubuntu 20.04
- Seperate images for clang-format, clang-tidy, coverage, Cuda build
  with clang, gcc and clang with python bindings
- Dockerfiles for clang and gcc rely on the package manager for the
  compilers
- Updated test scripts, they test more and should error our earlier
- Nightly docker job created
- Docker build script updated
- Include CI job, to build docker images on changes
parent da14b7cd
Pipeline #329743 failed with stages
in 15 minutes and 44 seconds
......@@ -5,16 +5,20 @@ stages:
- sanitizer
- coverage
- docs
- docker
### variables ###
variables:
ANALYSIS_IMAGE: "elsa/static-analysis:8"
GCC_IMAGE: "elsa/gcc:9"
CLANG_IMAGE: "elsa/clang:9"
CLANG_FORMAT_IMAGE: "elsa/clang-format:8"
CLANG_TIDY_IMAGE: "elsa/clang-tidy:8"
GCC_IMAGE: "elsa/gcc-pybinds:10"
CLANG9_IMAGE: "elsa/clang-pybinds:9"
CLANG10_IMAGE: "elsa/clang-pybinds:10"
CUDA_IMAGE: "elsa/cuda:10.2"
UBUNTU_IMAGE: "elsa/ubuntu:18.04"
GPU_ONLY_IMAGE: "elsa/cuda:10.0"
UBUNTU_IMAGE: "elsa/ubuntu:20.04"
GPU_ONLY_IMAGE: "elsa/cuda-clang:10.0"
COVERAGE_IMAGE: "elsa/coverage:10.2"
### Cache setup ###
......@@ -28,47 +32,31 @@ cache:
- thirdparty/
- .git/modules
### job templates ###
#### Schedule jobs ####
# run job only only on schedules
.job_template: &nightly_job
only:
- schedules
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"'
# run job if conntect to a schedule, merge request or some other things
# run job if connected to a schedule, merge request or some other things
.job_template: &run_on_merge_requests
only:
- merge_requests
- schedules
- master
- web
- triggers
- api
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- when: never
# always run this job
.job_template: &run_always
only:
- merge_requests
- branches
- tags
- api
- pushes
- schedules
- triggers
- web
rules:
- when: always
#### Build job templates ####
.job_template: &build_job_artifact
<<: *run_always
stage: compile
cache:
key: "$CI_JOB_NAME"
paths:
- build/
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
......@@ -143,10 +131,7 @@ cache:
clang-format:
<<: *run_always
stage: static-test
image: $ANALYSIS_IMAGE
before_script:
- git submodule sync
- git submodule update --init
image: $CLANG_FORMAT_IMAGE
script:
./tools/ci_scripts/clang-format-test.sh
tags:
......@@ -157,7 +142,7 @@ clang-format:
clang-tidy:
<<: *run_always
stage: static-test
image: $ANALYSIS_IMAGE
image: $CLANG_TIDY_IMAGE
script:
./tools/ci_scripts/clang-tidy.sh
tags:
......@@ -185,9 +170,18 @@ build-gcc:
- elsa
- gcc
build-clang:
build-clang9:
<<: *build_job_artifact
image: $CLANG9_IMAGE
script: *buildjob_clang
tags:
- linux
- elsa
- clang
build-clang10:
<<: *build_job_artifact
image: $CLANG_IMAGE
image: $CLANG10_IMAGE
script: *buildjob_clang
tags:
- linux
......@@ -244,12 +238,23 @@ test-gcc:
- elsa
- gcc
test-clang:
test-clang9:
<<: *test_job_artifact
stage: test
image: $CLANG_IMAGE
image: $CLANG9_IMAGE
dependencies:
- build-clang
- build-clang9
tags:
- linux
- elsa
- clang
test-clang10:
<<: *test_job_artifact
stage: test
image: $CLANG10_IMAGE
dependencies:
- build-clang10
tags:
- linux
- elsa
......@@ -291,12 +296,24 @@ install-gcc:
- elsa
- gcc
install-clang:
install-clang9:
<<: *install_job
stage: test
image: $CLANG_IMAGE
image: $CLANG9_IMAGE
dependencies:
- build-clang
- build-clang9
script: *installjob_script_clang
tags:
- linux
- elsa
- clang
install-clang10:
<<: *install_job
stage: test
image: $CLANG10_IMAGE
dependencies:
- build-clang10
script: *installjob_script_clang
tags:
- linux
......@@ -350,7 +367,7 @@ cuda-memcheck:
- gcc
- cuda
# Be sure to run this job as a privaledged one
# Be sure to run this job with container which has privaledge mode set
asan-ubsan:
<<: *run_on_merge_requests
stage: sanitizer
......@@ -374,7 +391,7 @@ asan-ubsan:
test-coverage:
<<: *run_on_merge_requests
stage: coverage
image: $CUDA_IMAGE
image: $COVERAGE_IMAGE
dependencies: []
script:
- mkdir -p build
......@@ -421,39 +438,41 @@ deploy-docs:
### build, test and deploy docker images ###
.deploy-docker:
image: elsa/base:latest
<<: *nightly_job
stage: docker
dependencies: []
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"'
- changes:
- tools/docker/*
script:
- cd tools/docker
- ./buildDockerContainers.sh
tags:
- elsa
- shell
### Test jobs ###
# These jobs, are for local build and test all in one job, should not be run with pipeline
.all-clang:
image: $CLANG_IMAGE
image: $CLANG9_IMAGE
rules:
- when: never
script:
- mkdir -p build
- cd build
- cmake .. -GNinja -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja install
- git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
- cd /tmp/elsa_testing
- mkdir -p build/ && cd build/
- cmake .. -GNinja -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja
- ninja tests
.all-gcc:
image: $GCC_IMAGE
rules:
- when: never
script:
- mkdir -p build
- cd build
- cmake .. -GNinja
- ninja install
- git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
- cd /tmp/elsa_testing
- mkdir -p build/ && cd build/
- cmake .. -GNinja
- ninja
- *buildjob_normal
- ninja tests
- *installjob_script
......@@ -2,6 +2,9 @@
# Applies clang-format
# set exit on error
set -e
# check that we are in a clean state in order to prevent accidential changes
git status --untracked-files=no
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]; then
......
FROM ubuntu:18.04 as base
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION} as base
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <dfrank@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="Base image for elsa build system (git, wget, ninja)"
ADD scripts/ /tmp/scripts/
ADD tests/ /tmp/tests/
ENV DEBIAN_FRONTEND=noninteractive
# Print some infos about the os
RUN cat /etc/os-release
# Add install scripts
ADD scripts/install_base.sh /tmp/scripts/install_base.sh
# Run the base install script (installing stuff like git, gcc, ninja, numpy and others)
RUN /tmp/scripts/install_base.sh
RUN apt update && apt upgrade -qqy
# Add tests scripts at the end
ADD tests/test_base.sh /tmp/tests/test_base.sh
CMD bash
FROM elsa/base:latest as builder
ARG UBUNTU_VERSION=20.04
FROM elsa/base:${UBUNTU_VERSION} as builder
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <dfrank@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="CMake-Base image for elsa build system"
# Add install scripts
ADD scripts/install_cmake.sh /tmp/scripts/install_cmake.sh
# install CMAKE
ARG CMAKE_VERSION=3.16
ARG CMAKE_VERSION_PATCH=4
ARG CMAKE_VERSION
ARG CMAKE_VERSION_PATCH
ARG CMAKE_DIR=cmake-${CMAKE_VERSION}.${CMAKE_VERSION_PATCH}
RUN bash /tmp/scripts/install_cmake.sh "${CMAKE_VERSION}" "${CMAKE_DIR}"
FROM elsa/base:latest
COPY --from=builder /tmp/cmake-install /usr/local
ADD tests/test_cmake.sh /tmp/tests/test_cmake.sh
CMD bash
# Docker image relies on Ubuntu 20.04 packages
# Provide the flag COMPILER_VERSION on the command line using --build-arg
FROM elsa/cmake:20.04 as copy-cmake
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="Clang image with cmake/git"
# Copy CMake from the cmake image over to here
FROM elsa/base:20.04 as base
COPY --from=copy-cmake /tmp/cmake-install /usr/local
# Install the compiler, libc++, libc++-abi and OpenMP
ARG COMPILER_VERSION
RUN apt update && apt upgrade -qqy \
&& apt --no-install-recommends install build-essential software-properties-common -qqy \
&& apt --no-install-recommends install clang-${COMPILER_VERSION} libc++-${COMPILER_VERSION}-dev \
libc++abi-${COMPILER_VERSION}-dev libomp-${COMPILER_VERSION}-dev -qqy \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${COMPILER_VERSION} 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${COMPILER_VERSION} \
&& rm -rf /var/lib/apt/lists/*
# Setup enviorment variables, PATH first then C and C++ compilers to clang
ENV PATH="$PATH:/usr/lib/llvm-${COMPILER_VERSION}/bin/"
ENV CC="clang"
ENV CXX="clang++"
# Stage to build oneDNN
FROM base as build-onednn
# Add oneDNN install script
ADD scripts/install_intel-oneDNN.sh /tmp/scripts/install_intel-oneDNN.sh
ARG ONEDNN_VERSION=1.6.2
RUN /tmp/scripts/install_intel-oneDNN.sh ${ONEDNN_VERSION}
# Copy oneDNN over to base image
FROM base as onednn
COPY --from=build-onednn /tmp/onednn_install/ /usr/local/
# Add all the test scripts
ADD tests/test_elsa.sh /tmp/tests/test_elsa.sh
CMD bash
### Clone step of LLVM/clang ###
FROM elsa/base-cmake:latest as clone
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <dfrank@in.tum.de>
LABEL Description="Clang image based on Ubuntu"
# Provide an argument to choose the compiler version from the command line
ARG COMPILER_VERSION
ARG CLANG_TAG=llvmorg-${COMPILER_VERSION}
# Clone llvm-project with the specific tag
RUN git clone --depth 1 --branch ${CLANG_TAG} https://github.com/llvm/llvm-project.git /tmp/llvm_project/
### Configuration step of LLVM/clang ###
FROM elsa/base-cmake:latest as configure
COPY --from=clone /tmp/llvm_project/ /tmp/llvm_project/
RUN mkdir -p /tmp/llvm_build/ && mkdir -p /tmp/llvm_install/ \
&& cmake -S /tmp/llvm_project/llvm/ -B /tmp/llvm_build/ -GNinja -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;openmp" \
-DCMAKE_INSTALL_PREFIX=/tmp/llvm_install/ -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BUILD_LLVM_DYLIB=ON
### Build LLVM/clang
FROM elsa/base-cmake:latest as build
COPY --from=configure /tmp/llvm_project/ /tmp/llvm_project/
COPY --from=configure /tmp/llvm_build/ /tmp/llvm_build/
# install clang and some related libraries and tools
WORKDIR /tmp/llvm_build/
RUN ninja install
WORKDIR /
### Set base for clang ###
FROM elsa/base-cmake:latest as base
COPY --from=build /tmp/llvm_install/ /usr/local/
# Set environment variables
ENV CC="/usr/local/bin/clang"
ENV CXX="/usr/local/bin/clang++"
ENV PATH="$PATH:/usr/local/bin/"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/:/usr/local/lib/"
### Download, configure, build and install Intel DNNL
FROM base as build-dnnl
# Intel DNNL Versions
ARG DNNL_VERSION=1.1.1
# Add test scripts
ADD scripts/ /tmp/scripts/
# Run install script for DNNL
RUN ./tmp/scripts/install_inteldnnl.sh ${DNNL_VERSION}
### Final stage ###
FROM base
# Copy Intel DNNL over
COPY --from=build-dnnl /tmp/dnnl_install /usr/local/
# setup conan home directory, to be in the cache of our CI pipeline
ENV CONAN_USER_HOME=/cache
# setup conan for clang
RUN conan profile new default --detect \
&& conan profile update settings.compiler.libcxx=libc++ default \
&& conan profile update settings.compiler.cppstd=17 default \
&& conan profile update env.CC=clang default \
&& conan profile update env.CXX=clang++ default \
&& conan profile update env.CONAN_CMAKE_GENERATOR=Ninja default \
&& conan profile show default
# Add test scripts
ADD tests/ /tmp/tests/
CMD bash
FROM ubuntu:20.04 as base
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="Image only containing clang-format"
ARG CLANG_FORMAT_VERSION=10
RUN apt update && apt upgrade -qqy && apt install git clang-format-${CLANG_FORMAT_VERSION} -qqy \
&& rm -rf /var/lib/apt/lists/*
# Append llvm directory to path, that we can use clang-format instead of clang-format-<some-version>
ENV PATH="$PATH:/usr/lib/llvm-${CLANG_FORMAT_VERSION}/bin/"
# Add Test script
ADD tests/test_clang-format.sh /tmp/tests/test_clang-format.sh
CMD bash
ARG BASE_IMAGE
FROM elsa/${BASE_IMAGE} as base
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="Image only containing clang-tidy"
ARG CLANG_TIDY_VERSION=9
RUN set -eux && apt update && apt upgrade -qqy && apt install clang-tidy-${CLANG_TIDY_VERSION} -qqy \
&& rm -rf /var/lib/apt/lists/*
# Append llvm directory to path, that we can use clang-tidyinstead of clang-tidy-<some-version>
ENV PATH="$PATH:/usr/lib/llvm-${CLANG_TIDY_VERSION}/bin/"
# Add Test script
ADD tests/test_clang-tidy.sh /tmp/tests/test_clang-tidy.sh
CMD bash
FROM staging/cuda:10.2 as base
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frank <frankd@in.tum.de>
LABEL Description="Image building code coverage ontop of the CUDA image"
# lcov 1.13 is broken for GCC 8 (see https://github.com/linux-test-project/lcov/issues/38), which is fixed in
# lcov 1.15, so install it from source, got nothing better to do anyway...
RUN set -eux \
&& git clone https://github.com/linux-test-project/lcov.git --single-branch --branch v1.15 /tmp/lcov \
&& cd /tmp/lcov && make install && rm -rf /tmp/lcov \
&& update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-8 100 \
&& apt autoremove -qqy && apt autoclean -qqy \
&& rm -rf /var/lib/apt/lists/*
# Add Test script
ADD tests/test_elsa.sh /tmp/tests/test_elsa.sh
CMD bash
# Provide an argument to choose the compiler version from the command line
ARG CUDA_VERSION=10.2
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu18.04 as base
ARG UBUNTU_VERSION=18.04
# Start with our CMake image
FROM elsa/cmake:${UBUNTU_VERSION} AS copy-cmake
MAINTAINER Tobias Lasser <lasser@in.tum.de>
MAINTAINER David Frannk <frankd@in.tum.de>
LABEL Description="Cuda develop with cmake/git and clang"
ADD scripts/ /tmp/scripts/
RUN /tmp/scripts/install_base.sh
RUN apt-get update -qq && apt-get --no-install-recommends install -qq swig libncurses5-dev libedit-dev libpthread-stubs0-dev lcov \
&& rm -rf /var/lib/apt/lists/*
FROM base as build-cmake
# CMake version
ARG CMAKE_VERSION=3.16
ARG CMAKE_VERSION_PATCH=4
ARG CMAKE_DIR=cmake-${CMAKE_VERSION}.${CMAKE_VERSION_PATCH}
RUN bash /tmp/scripts/install_cmake.sh "${CMAKE_VERSION}" "${CMAKE_DIR}"
FROM base as cmake
COPY --from=build-cmake /tmp/cmake-install /usr/local
FROM cmake as clone-clang
ARG CLANG_VERSION=9.0.1
ARG CLANG_TAG=llvmorg-${CLANG_VERSION}
RUN git clone --depth 1 --branch ${CLANG_TAG} https://github.com/llvm/llvm-project.git /tmp/llvm_project/
FROM cmake as configure-clang
COPY --from=clone-clang /tmp/llvm_project/ /tmp/llvm_project/
RUN mkdir -p /tmp/llvm_build/ && mkdir -p /tmp/llvm_install/ \
&& cmake -S /tmp/llvm_project/llvm/ -B /tmp/llvm_build/ -GNinja -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;openmp" \
-DCMAKE_INSTALL_PREFIX=/tmp/llvm_install/ -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON
### Build LLVM/clang
FROM cmake as build-clang
COPY --from=configure-clang /tmp/llvm_project/ /tmp/llvm_project/
COPY --from=configure-clang /tmp/llvm_build/ /tmp/llvm_build/
# install a reduced version of clang (due to LLVM_INSTALL_TOOLCHAIN_ONLY=ON)
WORKDIR /tmp/llvm_build/
RUN ninja install
WORKDIR /
### Set base for clang ###
FROM cmake as clang
COPY --from=build-clang /tmp/llvm_install/ /usr/local/
ARG CUDA_VERSION
ARG UBUNTU_VERSION
# Take the cuda ubuntu devel image from the cuda repo
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} AS base
# Copy the CMake install over to this image
COPY --from=copy-cmake /tmp/cmake-install /usr/local
# Add scripts so we can install using them
ADD scripts/install_base.sh /tmp/scripts/install_base.sh
# Install our base image here
RUN /tmp/scripts/install_base.sh
ARG UBUNTU_VERSION
ARG GCC_VERSION=8
# This avoid trouble configuring tzdata, which requires user input but fails in docker build step
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# For Ubuntu 18, we hadd the ubuntu-toolchain repo and then install GCC-9 for both Ubuntu 20 and 18
RUN set -ex; \
echo "Version: ${UBUNTU_VERSION}" && \
apt update && apt upgrade -qqy \
&& apt --no-install-recommends install build-essential software-properties-common -qqy; \
if (test "${UBUNTU_VERSION}" = "18.04" ); then \
add-apt-repository ppa:ubuntu-toolchain-r/test -qqy && apt update; \
fi; \
apt --no-install-recommends install gcc-${GCC_VERSION} g++-${GCC_VERSION} -qqy \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} \
&& update-alternatives --config gcc && ldconfig \
&& apt autoremove && apt autoclean \
&& rm -rf /var/lib/apt/lists/*
# Set enviorment variables
ENV CC="/usr/local/bin/clang"
ENV CXX="/usr/local/bin/clang++"
ENV PATH="$PATH:/usr/local/bin/"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/:/usr/local/lib/"
FROM clang as build-dnnl
ARG DNNL_VERSION=1.1.1
RUN /tmp/scripts/install_inteldnnl.sh ${DNNL_VERSION}
FROM clang as dnnl
COPY --from=build-dnnl /tmp/dnnl_install/ /usr/local/
ADD tests/ /tmp/tests/
# setup conan home directory, to be in the cache of our CI pipeline
ENV CONAN_USER_HOME=/cache
# setup conan for clang
RUN conan profile new default --detect \
&& conan profile update settings.compiler.libcxx=libc++ default \
&& conan profile update settings.compiler.cppstd=17 default \
&& conan profile update env.CC=clang default \
&& conan profile update env.CXX=clang++ default \
&& conan profile update env.CONAN_CMAKE_GENERATOR=Ninja default \
&& conan profile show default
ENV CC="gcc"
ENV CXX="g++"
# Install oneDNN using the compiler we'll be using with elsa
FROM base AS build-onednn
# Add oneDNN install script
ADD scripts/install_intel-oneDNN.sh /tmp/scripts/install_intel-oneDNN.sh
ARG ONEDNN_VERSION=1.6.2
RUN /tmp/scripts/install_intel-oneDNN.sh ${ONEDNN_VERSION}
# Copy it to our base image
FROM base as onednn
COPY --from=build-onednn /tmp/onednn_install/ /usr/local/
# Add the test scripts
ADD tests/test_elsa.sh /tmp/tests/test_elsa.sh
CMD bash
# Provide an argument to choose the compiler version from the command line
ARG CUDA_VERSION=10.0
ARG UBUNTU_VERSION=18.04
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} AS init
MAINTAINER Tobias Lasser <lasser@in.tum.de>
LABEL Description="Cuda develop with cmake/git and clang"
ADD scripts/install_base.sh /tmp/scripts/install_base.sh
RUN /tmp/scripts/install_base.sh
RUN apt-get update -qq && apt-get --no-install-recommends install -qq swig \
libncurses5-dev libedit-dev libpthread-stubs0-dev lcov \
&& rm -rf /var/lib/apt/lists/*
# Copy CMake from the cmake image over to here
ARG UBUNTU_VERSION
FROM elsa/cmake:${UBUNTU_VERSION} AS cmake