Commit 48a65127 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Merge branch 'development/fix-dockers' into 'development/ranges'

Switch to Fedora for containers.

See merge request !67
parents c206bb3e 4bed6812
......@@ -4,15 +4,18 @@ stages:
- bench
- deploy
before_script:
- export CMAKE_BUILD_PARALLEL_LEVEL=$(( (${NBPROC} + 1) / 2 ))
variables:
DOCKER_IMAGE: "${CI_REGISTRY}/olena/pylene/build-toolset"
FEDORA_30: "${CI_REGISTRY}/olena/pylene/fedora-rawhide" # stdlibc++ 9.1.1-2 not yet in fedora-30
FEDORA_29: "${CI_REGISTRY}/olena/pylene/fedora-29"
BUILD_DOCKER: 'false'
PACKAGE_NAME: "pylene" # Conan package name
PACKAGE_TAG: "testing" # Conan tag
PACKAGE_VERSION: "head" # Version to build
CONAN_USER: "lrde"
#########
# Build #
#########
......@@ -20,8 +23,10 @@ variables:
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t ${DOCKER_IMAGE} -f utils/docker/Dockerfile --no-cache .
- docker push ${DOCKER_IMAGE}
- docker build -t ${FEDORA_30} -f utils/docker-fedora/ --build-arg VERSION=30 --no-cache .
- docker build -t ${FEDORA_29} -f utils/docker-fedora/ --build-arg VERSION=29 --no-cache .
- docker push ${FEDORA_30}
- docker push ${FEDORA_29}
build-docker-manual:
<<: *build-docker-base
......@@ -39,17 +44,16 @@ build-docker-automatic:
########
.job-build-linux-base: &distcheck-linux-base
image: ${DOCKER_IMAGE}
stage: test
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- conan install .. -pr pylene_default --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_CODE_COVERAGE=OFF -DSANITIZE_ADDRESS=$ASAN -DSANITIZE_MEMORY=$MSAN -DSANITIZE_UNDEFINED=$UBSAN $OTHER_CMAKE_ARGS
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION
- ctest -L UnitTests --schedule-random --output-on-failure
- cmake --build . --target dist --config $PYLENE_CONFIGURATION
dependencies: []
......@@ -59,17 +63,16 @@ build-docker-automatic:
expire_in: 15 days
.job-build-linux-coverage: &distcheck-linux-coverage
image: ${DOCKER_IMAGE}
stage: test
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_CODE_COVERAGE=ON -DGCOV_PATH=$(which $COV) -DSANITIZE_ADDRESS=$ASAN -DSANITIZE_MEMORY=$MSAN -DSANITIZE_UNDEFINED=$UBSAN $OTHER_CMAKE_ARGS
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- conan install .. -pr pylene_default --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_CODE_COVERAGE=ON -DGCOV_PATH=$COV -DSANITIZE_ADDRESS=$ASAN -DSANITIZE_MEMORY=$MSAN -DSANITIZE_UNDEFINED=$UBSAN $OTHER_CMAKE_ARGS
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION
- ctest -L UnitTests --schedule-random --output-on-failure
- cmake --build . --target run-tests_coverage-gcovr-html --config $PYLENE_CONFIGURATION
- cmake --build . --target run-tests_coverage-lcov --config $PYLENE_CONFIGURATION
......@@ -91,101 +94,101 @@ build-docker-automatic:
# Asan and ubsan can work together
distcheck-linux-gcc7-release:
distcheck-linux-gcc8-release:
<<: *distcheck-linux-base
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "gcc7"
CXX: "g++-7"
CC: "gcc-7"
CXX: "g++"
CC: "gcc"
ASAN: "OFF"
MSAN: "OFF"
UBSAN: "OFF"
OTHER_CMAKE_ARGS: "-DCMAKE_CXX_EXTENSIONS=OFF" # This fixes a GCC ICE
distcheck-linux-gcc7-debug-cov-asan-ubsan:
distcheck-linux-gcc8-debug-cov-asan-ubsan:
<<: *distcheck-linux-coverage
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "gcc7"
CXX: "g++-7"
CC: "gcc-7"
COV: "gcov-7"
CXX: "g++"
CC: "gcc"
COV: "/usr/bin/gcov"
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
OTHER_CMAKE_ARGS: "-DCMAKE_CXX_EXTENSIONS=OFF" # This fixes a GCC ICE
distcheck-linux-gcc8-release:
distcheck-linux-gcc9-release:
<<: *distcheck-linux-base
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "gcc8"
CXX: "g++-8"
CC: "gcc-8"
CXX: "g++"
CC: "gcc"
ASAN: "OFF"
MSAN: "OFF"
UBSAN: "OFF"
OTHER_CMAKE_ARGS: "-DCMAKE_CXX_EXTENSIONS=OFF" # This fixes a GCC ICE
distcheck-linux-gcc8-debug-cov-asan-ubsan:
distcheck-linux-gcc9-debug-cov-asan-ubsan:
<<: *distcheck-linux-coverage
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "gcc8"
CXX: "g++-8"
CC: "gcc-8"
COV: "gcov-8"
CXX: "g++"
CC: "gcc"
COV: "/usr/bin/gcov"
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
OTHER_CMAKE_ARGS: "-DCMAKE_CXX_EXTENSIONS=OFF" # This fixes a GCC ICE
distcheck-linux-clang6-release:
distcheck-linux-clang7-release:
<<: *distcheck-linux-base
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "clang6"
CXX: "clang++-6.0"
CC: "clang-6.0"
CXX: "clang++"
CC: "clang"
ASAN: "OFF"
MSAN: "OFF"
UBSAN: "OFF"
OTHER_CMAKE_ARGS: ""
distcheck-linux-clang6-debug-cov-asan-ubsan:
distcheck-linux-clang7-debug-cov-asan-ubsan:
<<: *distcheck-linux-coverage
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "clang6"
CXX: "clang++-6.0"
CC: "clang-6.0"
COV: "../utils/coverage/llvm-gcov-6.0.sh"
CXX: "clang++"
CC: "clang"
COV: "/usr/local/bin/llvm/gcov"
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
OTHER_CMAKE_ARGS: ""
distcheck-linux-clang7-release:
distcheck-linux-clang8-release:
<<: *distcheck-linux-base
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "clang7"
CXX: "clang++-7"
CC: "clang-7"
CXX: "clang++"
CC: "clang"
ASAN: "OFF"
MSAN: "OFF"
UBSAN: "OFF"
OTHER_CMAKE_ARGS: ""
distcheck-linux-clang7-debug-cov-asan-ubsan:
distcheck-linux-clang8-debug-cov-asan-ubsan:
<<: *distcheck-linux-coverage
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "clang7"
CXX: "clang++-7"
CC: "clang-7"
COV: "../utils/coverage/llvm-gcov-7.sh"
CXX: "clang++"
CC: "clang"
COV: "/usr/local/bin/llvm/gcov"
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
......@@ -197,14 +200,14 @@ distcheck-linux-clang7-debug-cov-asan-ubsan:
#########
.job-bench-linux-base: &distbench-linux-base
image: ${DOCKER_IMAGE}
image: ${FEDORA_30}
stage: bench
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION
- cmake --build . --target fetch-external-data --config $PYLENE_CONFIGURATION
- cmake --build . --target build-bench --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-bench --config $PYLENE_CONFIGURATION
- cmake --build . --target run-all-benchmarks --config $PYLENE_CONFIGURATION
- ctest -L SpeedTests -V
tags: [ "pylene-benchmarks" ]
......@@ -216,37 +219,37 @@ distcheck-linux-clang7-debug-cov-asan-ubsan:
- build/bench/*.json
expire_in: 15 days
distbench-linux-gcc7-release:
distbench-linux-gcc8-release:
<<: *distbench-linux-base
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "gcc7"
CXX: "g++-7"
CC: "gcc-7"
CXX: "g++"
CC: "gcc"
distbench-linux-clang6-release:
distbench-linux-clang7-release:
<<: *distbench-linux-base
image: ${FEDORA_29}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "clang6"
CXX: "clang++-6.0"
CC: "clang-6.0"
CXX: "clang++"
CC: "clang"
distbench-linux-gcc8-release:
distbench-linux-gcc9-release:
<<: *distbench-linux-base
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "gcc8"
CXX: "g++-8"
CC: "gcc-8"
CXX: "g++"
CC: "gcc"
distbench-linux-clang7-release:
distbench-linux-clang8-release:
<<: *distbench-linux-base
image: ${FEDORA_30}
variables:
PYLENE_CONFIGURATION: "Release"
BUILD_PROFILE: "clang6"
CXX: "clang++-7"
CC: "clang-7"
CXX: "clang++"
CC: "clang"
#################
......@@ -254,13 +257,13 @@ distbench-linux-clang7-release:
#################
.documentation-base: &documentation-base
image: ${DOCKER_IMAGE}
image: ${FEDORA_30}
stage: test
script:
- mkdir build && cd build
- conan install .. -pr pylene_default --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . --target build-doc --config Release -- -j $(($NBPROC / 2))
- cmake --build . --target build-doc --config Release
- mkdir ../public && mv doc/sphinx/* ../public/
artifacts:
name: "documentation"
......@@ -285,7 +288,7 @@ pages:
- dev
package:
image: ${DOCKER_IMAGE}
image: ${FEDORA_30}
stage: deploy
dependencies: []
script:
......
......@@ -2,14 +2,10 @@
#include <mln/core/algorithm/fill.hpp>
#include <mln/core/algorithm/iota.hpp>
#include <mln/core/domain/where.hpp>
#include <mln/core/grays.hpp>
#include <mln/core/image/image2d.hpp>
#include <mln/core/image/image_ops.hpp>
#include <mln/core/image/view/operators.hpp>
#include <mln/core/image/view/transform.hpp>
#include <mln/io/imprint.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <gtest/gtest.h>
......@@ -28,70 +24,29 @@ struct rgb
bool operator==(const rgb& other) const { return r == other.r and g == other.g and b == other.b; }
};
std::ostream& operator<<(std::ostream& ss, const rgb& x)
{
return ss << boost::make_tuple(x.r, x.g, x.b);
}
TEST(Core, Image2d_LValueOperator)
{
using namespace mln;
using namespace mln::view::ops;
image2d<rgb> ima(5, 5);
mln::image2d<rgb> ima(5, 5);
rgb zero = {0, 0, 0};
rgb douze = {12, 0, 0};
mln::fill(ima, zero);
auto x = view::transform(ima, &rgb::r);
auto x = mln::view::transform(ima, &rgb::r);
mln::fill(x, 12);
ASSERT_TRUE(mln::all_of(ima == douze));
ASSERT_TRUE(mln::all_of(x == 12));
}
TEST(Core, Image2d_Operators)
{
using namespace mln;
using namespace mln::view::ops;
image2d<int> ima(5, 5);
image2d<int> ref(5, 5);
mln::iota(ima, 0);
int i = 0;
mln_viter(v, ref);
mln_forall (v)
*v = i--;
ASSERT_TRUE(mln::all_of(-ima == ref));
}
TEST(Core, Image2d_MixedOperator)
{
using namespace mln;
using namespace mln::view::ops;
image2d<char> x(5, 5);
image2d<short> y(5, 5);
mln::iota(x, 0);
mln::iota(y, 0);
static_assert(std::is_same_v<typename decltype(x + x)::value_type, char>);
ASSERT_TRUE(mln::all_of((x + y) == (2 * y)));
}
TEST(Core, UnaryOperator)
{
using namespace mln;
using namespace mln::view::ops;
image2d<int> ima = {{1, 2, 3}, {4, 5, 6}};
image2d<int> ref = {{-1, -2, -3}, {-4, -5, -6}};
mln::image2d<int> ima = {{1, 2, 3}, {4, 5, 6}};
mln::image2d<int> ref = {{-1, -2, -3}, {-4, -5, -6}};
auto g = -ima;
ASSERT_TRUE(mln::all_of(g == ref));
......@@ -99,11 +54,10 @@ TEST(Core, UnaryOperator)
TEST(Core, BinaryOperator_SameTypes)
{
using namespace mln;
using namespace mln::view::ops;
image2d<uint8_t> ima = {{1, 2, 3}, {4, 5, 6}};
image2d<uint8_t> ref = {{2, 4, 6}, {8, 10, 12}};
mln::image2d<uint8_t> ima = {{1, 2, 3}, {4, 5, 6}};
mln::image2d<uint8_t> ref = {{2, 4, 6}, {8, 10, 12}};
auto g1 = ima + ima;
auto g2 = uint8_t(2) * ima;
......@@ -120,11 +74,10 @@ TEST(Core, BinaryOperator_SameTypes)
TEST(Core, BinaryOperator_EqualFP)
{
using namespace mln;
using namespace mln::view::ops;
image2d<double> ima = {{1.015, 2.015, 3.015}, {4.015, 5.015, 6.015}};
image2d<double> ref = {{1.016, 2.016, 3.016}, {4.016, 5.016, 6.016}};
mln::image2d<double> ima = {{1.015, 2.015, 3.015}, {4.015, 5.015, 6.015}};
mln::image2d<double> ref = {{1.016, 2.016, 3.016}, {4.016, 5.016, 6.016}};
ASSERT_TRUE(mln::all_of(equalFP(ima, ref, 10e-3)));
ASSERT_TRUE(mln::all_of(not equalFP(ima, ref, 10e-5)));
......@@ -132,12 +85,11 @@ TEST(Core, BinaryOperator_EqualFP)
TEST(Core, BinaryOperators_MixedTypes)
{
using namespace mln;
using namespace mln::view::ops;
image2d<uint8_t> ima1 = {{1, 2, 3}, {4, 5, 6}};
image2d<uint16_t> ima2 = {{1, 2, 3}, {4, 5, 6}};
image2d<uint16_t> ref = {{2, 4, 6}, {8, 10, 12}};
mln::image2d<uint8_t> ima1 = {{1, 2, 3}, {4, 5, 6}};
mln::image2d<uint16_t> ima2 = {{1, 2, 3}, {4, 5, 6}};
mln::image2d<uint16_t> ref = {{2, 4, 6}, {8, 10, 12}};
auto g1 = ima1 + ima2;
auto g2 = uint16_t(2) * ima1;
......@@ -157,21 +109,20 @@ TEST(Core, BinaryOperators_MixedTypes)
TEST(Core, IfElse)
{
using namespace mln;
using namespace mln::view::ops;
image2d<uint8_t> x = {{1, 2, 3}, //
mln::image2d<uint8_t> x = {{1, 2, 3}, //
{4, 5, 6}};
image2d<uint8_t> y = {{4, 5, 6}, //
mln::image2d<uint8_t> y = {{4, 5, 6}, //
{1, 2, 3}};
image2d<uint8_t> ref_f1 = {{12, 12, 12}, //
mln::image2d<uint8_t> ref_f1 = {{12, 12, 12}, //
{4, 5, 6}};
image2d<uint8_t> ref_f2 = {{4, 5, 6}, //
mln::image2d<uint8_t> ref_f2 = {{4, 5, 6}, //
{4, 5, 6}};
image2d<uint8_t> ref_f3 = {{1, 2, 3}, //
mln::image2d<uint8_t> ref_f3 = {{1, 2, 3}, //
{12, 12, 12}};
image2d<uint8_t> ref_f4 = {{1, 1, 1}, //
mln::image2d<uint8_t> ref_f4 = {{1, 1, 1}, //
{0, 0, 0}};
auto f1 = mln::view::ifelse(x > 3, x, uint8_t(12)); // RValue image + LValue image + scalar
......@@ -179,10 +130,10 @@ TEST(Core, IfElse)
auto f3 = mln::view::ifelse(x > 3, uint8_t(12), x); // RValue image + Scalar + LValue image
auto f4 = mln::view::ifelse(x > 3, uint8_t(0), uint8_t(1)); // RValue image + Scalar + Scalar
static_assert(std::is_same_v<image_reference_t<decltype(f1)>, uint8_t>);
static_assert(std::is_same_v<image_reference_t<decltype(f2)>, uint8_t&>);
static_assert(std::is_same_v<image_reference_t<decltype(f3)>, uint8_t>);
static_assert(std::is_same_v<image_reference_t<decltype(f4)>, uint8_t>);
static_assert(std::is_same_v<mln::image_reference_t<decltype(f1)>, uint8_t>);
static_assert(std::is_same_v<mln::image_reference_t<decltype(f2)>, uint8_t&>);
static_assert(std::is_same_v<mln::image_reference_t<decltype(f3)>, uint8_t>);
static_assert(std::is_same_v<mln::image_reference_t<decltype(f4)>, uint8_t>);
ASSERT_TRUE(mln::all_of(f1 == ref_f1));
#ifndef PYLENE_GCC8_WORKAROUND
......@@ -192,9 +143,9 @@ TEST(Core, IfElse)
ASSERT_TRUE(mln::all_of(f4 == ref_f4));
image2d<uint8_t> ref_x = {{1, 2, 3}, //
mln::image2d<uint8_t> ref_x = {{1, 2, 3}, //
{42, 42, 42}};
image2d<uint8_t> ref_y = {{42, 42, 42}, //
mln::image2d<uint8_t> ref_y = {{42, 42, 42}, //
{1, 2, 3}};
mln::fill(f2, 42);
......
ARG VERSION=latest
FROM fedora:${VERSION}
LABEL maintainer="Edwin Carlinet <edwin.carlinet@lrde.epita.fr>"
# Install packages
RUN dnf install --refresh -y -q --nodocs \
git cmake make ninja-build \
lcov gcovr libasan libubsan \
gcc llvm clang clang-tools-extra \
boost-devel tbb-devel freeimage-devel gtest-devel qt5-devel \
doxygen python3-numpy python3-matplotlib && \
dnf clean all
RUN pip3 install --no-cache-dir -q \
conan sphinx pandas breathe sphinx_rtd_theme
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# Install conan default profile
WORKDIR /tmp
COPY conanfile.py .
COPY utils/docker-fedora/conan_config/ ./conan_config
RUN conan config install ./conan_config &&\
conan install . -pr pylene_default --build missing
# Post-install script
COPY ./utils/docker-fedora/post-install.sh .
RUN ./post-install.sh
# Clean tmp dir
RUN rm -Rf *
WORKDIR /workspace
CMD ["/bin/bash"]
include(default)
[settings]
compiler.libcxx=libstdc++11
[build_requires]
[options]
benchmark = True
freeimage = False
gtest = True
boost_program_options = False
boost = False
benchmark:shared = True
gtest:shared = True
conan-center https://conan.bintray.com True
dutiona-lrde https://api.bintray.com/conan/dutiona/lrde True
lrde-public https://artifactory.lrde.epita.fr/artifactory/api/conan/lrde-public True
#! /bin/sh
# install a shortcut for llvm-cov gcov
mkdir -p /usr/local/bin/llvm/
ln -s /usr/bin/llvm-cov /usr/local/bin/llvm/gcov
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment