extra/boost to 1.76.0-1

This commit is contained in:
Kevin Mihelich 2021-06-10 12:48:30 +00:00
parent f0c70ede5f
commit c2a4b48b63
3 changed files with 88 additions and 350 deletions

View file

@ -1,216 +0,0 @@
From 5bd5bfb978df5f345518d2444d8f2ddba849d8d6 Mon Sep 17 00:00:00 2001
From: Hans Dembinski <HDembinski@users.noreply.github.com>
Date: Mon, 7 Dec 2020 15:12:20 +0100
Subject: [PATCH] Bug-fix for one-sided cropping and clarify how cropping works
(#302)
---
boost/histogram/algorithm/reduce.hpp | 28 +++++++--
libs/histogram/test/algorithm_reduce_test.cpp | 63 ++++++++++++++++----
2 files changed, 77 insertions(+), 14 deletions(-)
diff --git a/include/boost/histogram/algorithm/reduce.hpp b/include/boost/histogram/algorithm/reduce.hpp
index a5d2fffa6..0646db34e 100644
--- a/boost/histogram/algorithm/reduce.hpp
+++ b/boost/histogram/algorithm/reduce.hpp
@@ -111,7 +111,14 @@ inline reduce_command crop(unsigned iaxis, double lower, double upper) {
Command is applied to corresponding axis in order of reduce arguments.
Works like `shrink` (see shrink documentation for details), but counts in removed bins
- are discarded, whether underflow and overflow bins are present or not.
+ are discarded, whether underflow and overflow bins are present or not. If the cropped
+ range goes beyond the axis range, then the content of the underflow
+ or overflow bin which overlaps with the range is kept.
+
+ If the counts in an existing underflow or overflow bin are discared by the crop, the
+ corresponding memory cells are not physically removed. Only their contents are set to
+ zero. This technical limitation may be lifted in the future, then crop may completely
+ remove the cropped memory cells.
@param lower bin which contains lower is first to be kept.
@param upper bin which contains upper is last to be kept, except if upper is equal to
@@ -323,6 +330,8 @@ inline reduce_command slice_and_rebin(axis::index_type begin, axis::index_type e
exception. Histograms with non-reducible axes can still be reduced along the
other axes that are reducible.
+ An overload allows one to pass reduce_command as positional arguments.
+
@param hist original histogram.
@param options iterable sequence of reduce commands: `shrink`, `slice`, `rebin`,
`shrink_and_rebin`, or `slice_and_rebin`. The element type of the iterable should be
@@ -343,14 +352,16 @@ Histogram reduce(const Histogram& hist, const Iterable& options) {
auto& o = opts[iaxis];
o.is_ordered = axis::traits::ordered(a_in);
if (o.merge > 0) { // option is set?
- o.use_underflow_bin = !o.crop && AO::test(axis::option::underflow);
- o.use_overflow_bin = !o.crop && AO::test(axis::option::overflow);
+ o.use_underflow_bin = AO::test(axis::option::underflow);
+ o.use_overflow_bin = AO::test(axis::option::overflow);
return detail::static_if_c<axis::traits::is_reducible<A>::value>(
[&o](const auto& a_in) {
if (o.range == reduce_command::range_t::none) {
+ // no range restriction, pure rebin
o.begin.index = 0;
o.end.index = a_in.size();
} else {
+ // range striction, convert values to indices as needed
if (o.range == reduce_command::range_t::values) {
const auto end_value = o.end.value;
o.begin.index = axis::traits::index(a_in, o.begin.value);
@@ -359,7 +370,14 @@ Histogram reduce(const Histogram& hist, const Iterable& options) {
if (axis::traits::value_as<double>(a_in, o.end.index) != end_value)
++o.end.index;
}
- // limit [begin, end] to [0, size()]
+
+ // crop flow bins if index range does not include them
+ if (o.crop) {
+ o.use_underflow_bin &= o.begin.index < 0;
+ o.use_overflow_bin &= o.end.index > a_in.size();
+ }
+
+ // now limit [begin, end] to [0, size()]
if (o.begin.index < 0) o.begin.index = 0;
if (o.end.index > a_in.size()) o.end.index = a_in.size();
}
@@ -435,6 +453,8 @@ Histogram reduce(const Histogram& hist, const Iterable& options) {
the other axes. Trying to reducing a non-reducible axis triggers an invalid_argument
exception.
+ An overload allows one to pass an iterable of reduce_command.
+
@param hist original histogram.
@param opt first reduce command; one of `shrink`, `slice`, `rebin`,
`shrink_and_rebin`, or `slice_or_rebin`.
diff --git a/test/algorithm_reduce_test.cpp b/test/algorithm_reduce_test.cpp
index 6ea42fadf..c6b4df4a4 100644
--- a/libs/histogram/test/algorithm_reduce_test.cpp
+++ b/libs/histogram/test/algorithm_reduce_test.cpp
@@ -105,15 +105,16 @@ void run_tests() {
BOOST_TEST_EQ(reduce(h, crop(0, 1.999)).axis(), ID(0, 2));
}
+ // shrink and rebin
{
auto h = make_s(Tag(), std::vector<int>(), R(4, 1, 5, "1"), R(3, -1, 2, "2"));
/*
matrix layout:
- x
+ x ->
y 1 0 1 0
- 1 1 0 0
- 0 2 1 3
+ | 1 1 0 0
+ v 0 2 1 3
*/
h.at(0, 0) = 1;
h.at(0, 1) = 1;
@@ -122,11 +123,13 @@ void run_tests() {
h.at(2, 0) = 1;
h.at(2, 2) = 1;
h.at(3, 2) = 3;
+ h.at(-1, -1) = 1; // underflow
+ h.at(4, 3) = 1; // overflow
// should do nothing, index order does not matter
auto hr = reduce(h, shrink(1, -1, 2), rebin(0, 1));
BOOST_TEST_EQ(hr.rank(), 2);
- BOOST_TEST_EQ(sum(hr), 10);
+ BOOST_TEST_EQ(sum(hr), 12);
BOOST_TEST_EQ(hr.axis(0), R(4, 1, 5, "1"));
BOOST_TEST_EQ(hr.axis(1), R(3, -1, 2, "2"));
BOOST_TEST_EQ(hr, h);
@@ -138,7 +141,7 @@ void run_tests() {
// shrinking along first axis
hr = reduce(h, shrink(0, 2, 4));
BOOST_TEST_EQ(hr.rank(), 2);
- BOOST_TEST_EQ(sum(hr), 10);
+ BOOST_TEST_EQ(sum(hr), 12);
BOOST_TEST_EQ(hr.axis(0), R(2, 2, 4, "1"));
BOOST_TEST_EQ(hr.axis(1), R(3, -1, 2, "2"));
BOOST_TEST_EQ(hr.at(-1, 0), 1); // underflow
@@ -164,7 +167,7 @@ void run_tests() {
hr = reduce(h, shrink_and_rebin(0, 2, 5, 2), rebin(1, 3));
BOOST_TEST_EQ(hr.rank(), 2);
- BOOST_TEST_EQ(sum(hr), 10);
+ BOOST_TEST_EQ(sum(hr), 12);
BOOST_TEST_EQ(hr.axis(0), R(1, 2, 4, "1"));
BOOST_TEST_EQ(hr.axis(1), R(1, -1, 2, "2"));
BOOST_TEST_EQ(hr.at(-1, 0), 2); // underflow
@@ -184,16 +187,16 @@ void run_tests() {
BOOST_TEST_EQ(hr4, hr);
}
- // crop
+ // crop and rebin
{
auto h = make_s(Tag(), std::vector<int>(), R(4, 1, 5), R(3, 1, 4));
/*
matrix layout:
- x
+ x ->
y 1 0 1 0
- 1 1 0 0
- 0 2 1 3
+ | 1 1 0 0
+ v 0 2 1 3
*/
h.at(0, 0) = 1;
h.at(0, 1) = 1;
@@ -202,6 +205,9 @@ void run_tests() {
h.at(2, 0) = 1;
h.at(2, 2) = 1;
h.at(3, 2) = 3;
+ h.at(-1, -1) = 1; // underflow
+ h.at(4, 3) = 1; // overflow
+
/*
crop first and last column in x and y
@@ -231,6 +237,43 @@ void run_tests() {
BOOST_TEST_EQ(hr, hr4);
}
+ // one-sided crop
+ {
+ auto h = make_s(Tag(), std::vector<int>(), ID(1, 4));
+ std::fill(h.begin(), h.end(), 1);
+ // underflow: 1
+ // index 0, x 1: 1
+ // index 1, x 2: 1
+ // index 2, x 3: 1
+ // overflow: 1
+ BOOST_TEST_EQ(sum(h), 5);
+ BOOST_TEST_EQ(h.size(), 5);
+
+ // keep underflow
+ auto hr1 = reduce(h, crop(0, 3));
+ BOOST_TEST_EQ(hr1, reduce(h, slice(-1, 2, slice_mode::crop)));
+ BOOST_TEST_EQ(sum(hr1), 3);
+ BOOST_TEST_EQ(hr1.size(), 4); // flow bins are not physically removed, only zeroed
+
+ // remove underflow
+ auto hr2 = reduce(h, crop(1, 3));
+ BOOST_TEST_EQ(hr2, reduce(h, slice(0, 2, slice_mode::crop)));
+ BOOST_TEST_EQ(sum(hr2), 2);
+ BOOST_TEST_EQ(hr2.size(), 4); // flow bins are not physically removed, only zeroed
+
+ // keep overflow
+ auto hr3 = reduce(h, crop(2, 5));
+ BOOST_TEST_EQ(hr3, reduce(h, slice(1, 4, slice_mode::crop)));
+ BOOST_TEST_EQ(sum(hr3), 3);
+ BOOST_TEST_EQ(hr3.size(), 4); // flow bins are not physically removed, only zeroed
+
+ // remove overflow
+ auto hr4 = reduce(h, crop(2, 4));
+ BOOST_TEST_EQ(hr4, reduce(h, slice(1, 3, slice_mode::crop)));
+ BOOST_TEST_EQ(sum(hr4), 2);
+ BOOST_TEST_EQ(hr4.size(), 4); // flow bins are not physically removed, only zeroed
+ }
+
// mixed axis types
{
R r(5, 0.0, 5.0);

View file

@ -1,4 +1,5 @@
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Marius Knaust <marius.knaust@gmail.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
@ -12,146 +13,116 @@
# - build armv6h with -march=armv6k
# - specify arm architecture to b2 for aarch64
pkgbase=boost
pkgname=('boost-libs' 'boost')
pkgver=1.75.0
_boostver=${pkgver//./_}
pkgrel=5
pkgdesc='Free peer-reviewed portable C++ source libraries'
url='https://www.boost.org/'
pkgname=('boost' 'boost-libs')
pkgver=1.76.0
pkgrel=1
_srcname=boost_${pkgver//./_}
pkgdesc="Free peer-reviewed portable C++ source libraries"
arch=('x86_64')
url="https://www.boost.org/"
license=('custom')
makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd' 'findutils')
source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/boost_$_boostver.tar.gz
${pkgbase}-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch
5bd5bfb9.patch
b29603fa.patch)
sha256sums=('aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a'
'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee'
'fbb27a583a6c61c4fe50621d08a8b4fd5b4a0563a48f47185fc462cb29a38540'
'3e431e5f7f023feb8e7c4d64e8d9989315dfcd4e36cdb965043ac5221497746c')
b2sums=('98f8bb2d3198a74044e7db1549f6f2e68a9f381febac36aa976f7ed4d1cc7be47e79f86cde0b13e3b5d1109fc1792408c9dc78b01198b53690449d5842f1fe2d'
'e5f6d4884eaa557d5547e7e079c2edb4ed9f2f4cd8579aa32a2150f824a5d04413f2a91e79b3139d5b915da6a46f7835f1438ad53f33096973f1a99f378ec1d3'
'e54c2939c8f965294c4d3726c97965725890cabd09d25cfc177c316c8a072bbc1e272ce127f1352be83c668116d70992e52ab24b41d19aaccd89fb1701235c48'
'9b336d8726e2636112724f19510cf1fe02c8306854d386308b77dd2c318f78e0c6cb4412a916e2e69544b218e9e455d50550c086c88c49736c5f551bda777132')
makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd')
source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$_srcname.tar.gz
$pkgname-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch)
sha256sums=('7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca'
'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee')
prepare() {
cd ${pkgbase}_${_boostver}
cd $_srcname
# https://github.com/boostorg/ublas/pull/97
patch -Np2 -i ../${pkgbase}-ublas-c++20-iterator.patch
patch -p1 < ../5bd5bfb9.patch # https://github.com/boostorg/histogram/pull/302
patch -d tools/build -p1 < ../b29603fa.patch # https://github.com/boostorg/build/issues/650
# https://github.com/boostorg/ublas/pull/97
patch -Np2 -i ../$pkgname-ublas-c++20-iterator.patch
}
build() {
CFLAGS=`echo $CFLAGS | sed -e 's/armv6/armv6k/'` && CXXFLAGS="$CFLAGS"
export _stagedir="${srcdir}/stagedir"
local JOBS="$(sed -e 's/.*\(-j *[0-9]\+\).*/\1/' <<< ${MAKEFLAGS})"
CFLAGS=`echo $CFLAGS | sed -e 's/armv6/armv6k/'` && CXXFLAGS="$CFLAGS"
local JOBS="$(sed 's/.*\(-j *[0-9]\+\).*/\1/' <<<$MAKEFLAGS)"
pushd ${pkgbase}_${_boostver}/tools/build
./bootstrap.sh
./b2 install --prefix="${_stagedir}"
popd
pushd $_srcname/tools/build
./bootstrap.sh --cxxflags="$CXXFLAGS $LDFLAGS"
./b2 install --prefix="$srcdir"/fakeinstall
ln -s b2 "$srcdir"/fakeinstall/bin/bjam
popd
cd ${pkgbase}_${_boostver}
cd $_srcname
./bootstrap.sh --with-toolset=gcc --with-icu --with-python=python3
./bootstrap.sh \
--with-toolset=gcc \
--with-icu \
--with-python=/usr/bin/python3 \
# support for OpenMPI
echo "using mpi ;" >>project-config.jam
# Support for OpenMPI
echo "using mpi ;" >> project-config.jam
# boostbook is needed by quickbook
install -dm755 "$srcdir"/fakeinstall/share/boostbook
cp -a tools/boostbook/{xsl,dtd} "$srcdir"/fakeinstall/share/boostbook/
# boostbook is needed by quickbook
install -dm755 "${_stagedir}"/share/boostbook
cp -a tools/boostbook/{xsl,dtd} "${_stagedir}"/share/boostbook/
# default "minimal" install: "release link=shared,static
# runtime-link=shared threading=single,multi"
# --layout=tagged will add the "-mt" suffix for multithreaded libraries
# and installs includes in /usr/include/boost.
# --layout=system no longer adds the -mt suffix for multi-threaded libs.
# install to ${_stagedir} in preparation for split packaging
"${_stagedir}"/bin/b2 \
architecture=arm \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
python=3.9 \
cflags="${CPPFLAGS} ${CFLAGS} -fPIC -O3" \
cxxflags="${CPPFLAGS} ${CXXFLAGS} -std=c++14 -fPIC -O3" \
linkflags="${LDFLAGS}" \
--layout=system \
${JOBS} \
\
--prefix="${_stagedir}" \
install
# install to $srcdir/fakeinstall in preparation for split packaging
./b2 install \
architecture=arm \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
python=3.9 \
cflags="$CPPFLAGS $CFLAGS -fPIC -O3" \
cxxflags="$CPPFLAGS $CXXFLAGS -fPIC -O3" \
linkflags="$LDFLAGS" \
--layout=system \
$JOBS \
\
--prefix="$srcdir"/fakeinstall
}
package_boost() {
pkgdesc+=' - development headers'
depends=("boost-libs=${pkgver}")
optdepends=('python: for python bindings')
options=('staticlibs')
pkgdesc+=' (development headers)'
depends=("boost-libs=$pkgver")
optdepends=('python: for python bindings')
options=('staticlibs')
install -dm755 "${pkgdir}"/usr
cp -a "${_stagedir}"/{bin,include,share} "${pkgdir}"/usr
install -d "$pkgdir"/usr/lib
cp -a fakeinstall/lib/*.a "$pkgdir"/usr/lib/
cp -a fakeinstall/lib/cmake "$pkgdir"/usr/lib/
cp -a fakeinstall/{bin,include,share} "$pkgdir"/usr/
install -d "${pkgdir}"/usr/lib
cp -a "${_stagedir}"/lib/*.a "${pkgdir}"/usr/lib/
cp -a "${_stagedir}"/lib/cmake "${pkgdir}"/usr/lib/
install -Dm644 "${srcdir}/"${pkgbase}_${_boostver}/LICENSE_1_0.txt \
"${pkgdir}"/usr/share/licenses/boost/LICENSE_1_0.txt
ln -s /usr/bin/b2 "$pkgdir"/usr/bin/bjam
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt
}
package_boost-libs() {
pkgdesc+=' - runtime libraries'
depends=('bzip2' 'zlib' 'icu' 'zstd')
optdepends=('openmpi: for mpi support')
provides=(libboost_atomic.so libboost_chrono.so libboost_container.so
libboost_context.so libboost_contract.so libboost_coroutine.so
libboost_date_time.so libboost_fiber.so libboost_filesystem.so
libboost_graph.so libboost_graph_parallel.so libboost_iostreams.so
libboost_locale.so libboost_log.so libboost_log_setup.so
libboost_math_c99.so libboost_math_c99f.so libboost_math_c99l.so
libboost_math_tr1.so libboost_math_tr1f.so libboost_math_tr1l.so
libboost_mpi.so libboost_numpy39.so
libboost_prg_exec_monitor.so libboost_program_options.so
libboost_python39.so libboost_random.so
libboost_regex.so libboost_serialization.so
libboost_stacktrace_addr2line.so libboost_stacktrace_basic.so
libboost_stacktrace_noop.so libboost_system.so libboost_thread.so
libboost_timer.so libboost_type_erasure.so libboost_unit_test_framework.so
libboost_wave.so libboost_wserialization.so)
pkgdesc+=' (runtime libraries)'
depends=('bzip2' 'zlib' 'icu' 'zstd')
optdepends=('openmpi: for mpi support')
provides=(libboost_atomic.so libboost_chrono.so libboost_container.so
libboost_context.so libboost_contract.so libboost_coroutine.so
libboost_date_time.so libboost_fiber.so libboost_filesystem.so
libboost_graph.so libboost_graph_parallel.so libboost_iostreams.so
libboost_json.so libboost_locale.so libboost_log.so libboost_log_setup.so
libboost_math_c99.so libboost_math_c99f.so libboost_math_c99l.so
libboost_math_tr1.so libboost_math_tr1f.so libboost_math_tr1l.so
libboost_mpi.so libboost_numpy39.so
libboost_prg_exec_monitor.so libboost_program_options.so
libboost_python39.so libboost_random.so
libboost_regex.so libboost_serialization.so
libboost_stacktrace_addr2line.so libboost_stacktrace_basic.so
libboost_stacktrace_noop.so libboost_system.so libboost_thread.so
libboost_timer.so libboost_type_erasure.so libboost_unit_test_framework.so
libboost_wave.so libboost_wserialization.so)
install -dm755 "${pkgdir}"/usr
cp -a "${_stagedir}"/lib "${pkgdir}"/usr
rm "${pkgdir}"/usr/lib/*.a
rm -r "${pkgdir}"/usr/lib/cmake
install -dm755 "$pkgdir"/usr/lib
cp -a fakeinstall/lib/*.so* "$pkgdir"/usr/lib/
# https://github.com/boostorg/mpi/issues/112
install -d "${pkgdir}/usr/lib/python3.9/site-packages/boost"
touch "${pkgdir}/usr/lib/python3.9/site-packages/boost/__init__.py"
python -m compileall -o 0 -o 1 -o 2 "${pkgdir}/usr/lib/python3.9/site-packages/boost"
mv "${pkgdir}"/usr/lib/boost-python3.9/mpi.so \
"${pkgdir}/usr/lib/python3.9/site-packages/boost/mpi.so"
# https://github.com/boostorg/mpi/issues/112
install -d "$pkgdir"/usr/lib/python3.9/site-packages/boost
touch "$pkgdir"/usr/lib/python3.9/site-packages/boost/__init__.py
python -m compileall -o 0 -o 1 -o 2 "$pkgdir"/usr/lib/python3.9/site-packages/boost
cp fakeinstall/lib/boost-python3.9/mpi.so \
"$pkgdir"/usr/lib/python3.9/site-packages/boost/mpi.so
# https://github.com/boostorg/python/issues/203#issuecomment-391477685
for _lib in python numpy; do
ln -srL "${pkgdir}"/usr/lib/libboost_${_lib}3{9,}.so
done
# https://github.com/boostorg/python/issues/203#issuecomment-391477685
for _lib in python numpy; do
ln -srL "$pkgdir"/usr/lib/libboost_${_lib}3{9,}.so
done
install -Dm644 "${srcdir}/"${pkgbase}_${_boostver}/LICENSE_1_0.txt \
"${pkgdir}"/usr/share/licenses/boost-libs/LICENSE_1_0.txt
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt
}
# vim: ts=2 sw=2 et:
# vim:set ts=2 sw=2 et:

View file

@ -1,17 +0,0 @@
From b29603fa88a614835359168e70b5a44eae8e642c Mon Sep 17 00:00:00 2001
From: Rene Rivera <grafikrobot@gmail.com>
Date: Sat, 26 Sep 2020 18:02:59 -0500
Subject: [PATCH] Fix path to bootstrap for back compat.
fixes #650
--- a/src/engine/startup.cpp
+++ b/src/engine/startup.cpp
@@ -195,7 +195,7 @@ bool b2::startup::bootstrap(FRAME *frame)
{
const std::string path{
b2::paths::normalize(
- b2_exe_path + "/../../share/boost-build/" + boost_build_jam)};
+ b2_exe_path + "/../../share/boost-build/src/kernel/" + boost_build_jam)};
if (b2::filesys::is_file(path))
b2_file_path = path;
}