Skip to content

Commit

Permalink
Merge branch 'master' into flattened-iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Feb 17, 2025
2 parents 667d777 + 0a861b2 commit 8e7bf88
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 43 deletions.
46 changes: 28 additions & 18 deletions .gitlab-ci-correaa.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Alfredo A. Correa
# Copyright 2020-2025 Alfredo A. Correa

# Install docker (for local CI or to set up CI machine)
# sudo apt install docker.io
Expand Down Expand Up @@ -323,61 +323,71 @@ vs2019-windows:
- .\vcpkg\bootstrap-vcpkg.bat
- .\vcpkg\vcpkg install boost-multi-array boost-timer
- mkdir build
- $env:Path += ";${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin"
- cmake --version
- cmake -S . -B build -DCMAKE_CXX_STANDARD=23
- cmake --build build --config Release --parallel 2 --verbose
- $env:Path += ";${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin"
- ctest --test-dir build --output-on-failure -C Release
tags:
- saas-windows-medium-amd64
needs: ["clang++", "g++"]
timeout: 30 minutes

#winget install Microsoft.PowerShell
#winget install -e --id Kitware.CMake
# cd C:\
# git clone --depth=1 https://github.com/microsoft/vcpkg.git
# C:\vcpkg\bootstrap-vcpkg.bat
# C:\vcpkg\vcpkg install boost-multi-array boost-timer
# install Boost binaries from here https://sourceforge.net/projects/boost/

vs2022-shell c++17:
stage: build
allow_failure: true
interruptible: true
variables:
BOOST_ROOT: ${CI_PROJECT_DIR}/vcpkg/installed/x64-windows
#BOOST_ROOT: ${CI_PROJECT_DIR}/vcpkg/installed/x64-windows
BOOST_ROOT: C:/vcpkg/installed/x64-windows
script:
# - choco --version
# - choco install -y visualstudio2019community poshgit
- git clone --depth=1 https://github.com/microsoft/vcpkg.git
- .\vcpkg\bootstrap-vcpkg.bat
- .\vcpkg\vcpkg install boost-multi-array boost-timer
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
#- git clone --depth=1 https://github.com/microsoft/vcpkg.git
#- .\vcpkg\bootstrap-vcpkg.bat
#- .\vcpkg\vcpkg install boost-multi-array boost-timer
- mkdir build
- cmake --version
- cmake -S . -B build -DCMAKE_CXX_STANDARD=17
- cmake --build build --config Release --parallel 4 --verbose
- $env:Path += ";${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin"
- ctest -j 4 --test-dir build --output-on-failure -C Release
- cmake -S . -B build -DCMAKE_CXX_STANDARD=17 # -DBoost_DIR="C:\local\boost_1_86_0" -DBOOST_LIBRARYDIR="C:\local\boost_1_86_0\lib64-msvc-14.3"
- cmake --build build --config Debug --parallel 4 --verbose
- ctest -j 4 --test-dir build --output-on-failure -C Debug
tags:
- windows, shell
needs: ["clang++", "g++"]
timeout: 10 minutes
timeout: 20 minutes

vs2022-shell c++23:
stage: build
allow_failure: true
interruptible: true
variables:
BOOST_ROOT: ${CI_PROJECT_DIR}/vcpkg/installed/x64-windows
#BOOST_ROOT: ${CI_PROJECT_DIR}/vcpkg/installed/x64-windows
BOOST_ROOT: C:/vcpkg/installed/x64-windows
script:
# - choco --version
# - choco install -y visualstudio2019community poshgit
- git clone --depth=1 https://github.com/microsoft/vcpkg.git
- .\vcpkg\bootstrap-vcpkg.bat
- .\vcpkg\vcpkg install boost-multi-array boost-timer
- $env:Path += ";C:/vcpkg/installed/x64-windows/bin;${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin;C:\Program Files\CMake\bin;C:\Program Files\7-Zip;C:\local\boost_1_86_0\lib"
#- git clone --depth=1 https://github.com/microsoft/vcpkg.git
#- .\vcpkg\bootstrap-vcpkg.bat
#- .\vcpkg\vcpkg install boost-multi-array boost-timer
- mkdir build
- cmake --version
- cmake -S . -B build -DCMAKE_CXX_STANDARD=23
- cmake -S . -B build -DCMAKE_CXX_STANDARD=23 # -DBoost_DIR="C:\local\boost_1_86_0" -DBOOST_LIBRARYDIR="C:\local\boost_1_86_0\lib64-msvc-14.3"
- cmake --build build --config Release --parallel 4 --verbose
- $env:Path += ";${CI_PROJECT_DIR}/vcpkg/installed/x64-windows/bin"
- ctest -j 4 --test-dir build --output-on-failure -C Release
tags:
- windows, shell
needs: ["clang++", "g++"]
timeout: 10 minutes
timeout: 20 minutes

clang++-m32:
stage: build
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
-->
# [Boost.] Multi

> **Disclosure: This is not an official or accepted Boost library and is unrelated to the std::mdspan proposal. It is in the process of being proposed for inclusion in [Boost](https://www.boost.org/).**
> **Disclosure: This is not an official or accepted Boost library and is unrelated to the std::mdspan proposal. It is in the process of being proposed for inclusion in [Boost](https://www.boost.org/) and it doesn't depend on Boost libraries.**
_© Alfredo A. Correa, 2018-2024_
_© Alfredo A. Correa, 2018-2025_

_Multi_ is a modern C++ library that provides manipulation and access of data in multidimensional arrays for both CPU and GPU memory.

Expand Down Expand Up @@ -37,7 +37,7 @@ it doesn't make algebraic or geometric assumptions about the arrays and their el
The library does not throw exceptions and provides basic guarantees (such as no memory leaks) in their presence (e.g., thrown from allocations).
Indexing and other logical errors result in undefined behavior, which this library attempts to reflect via assertions.

The library requires C++17 or higher.
The library requires C++17 or higher, and it has no external dependencies.

**Contents:**

Expand Down Expand Up @@ -1643,16 +1643,16 @@ Here it is a comparison of speeds when (de)serializing a 134 MB 4-dimensional ar

| Archive format (Library) | file size | speed (read - write) | time (read - write) |
| ---------------------------- | ------------- | ------------------------------ |-----------------------|
| JSON (Cereal) | 684 MB | 3.9 MB/sec - 8.4 MB/sec | 32.1 sec - 15.1 sec |
| XML (Cereal) | 612 MB | 2. MB/sec - 4. MB/sec | 56 sec - 28 sec |
| XML (Boost) | 662 MB | 11. MB/sec - 13. MB/sec | 11 sec - 9 sec |
| YAML ([custom archive)](https://gitlab.com/correaa/boost-archive-yml) | 702 MB | 10. MB/sec - 4.4 MB/sec | 12 sec - 28 sec |
| Portable Binary (Cereal) | 134 MB | 130. MB/sec - 121. MB/sec | 9.7 sec - 10.6 sec |
| Text (Boost) | 411 MB | 15. MB/sec - 16. MB/sec | 8.2 sec - 7.6 sec |
| JSON (Cereal) | 684 MB | 3.9 MB/sec - 8.4 MB/sec | 32.1 sec - 15.1 sec |
| XML (Cereal) | 612 MB | 2.0 MB/sec - 4.0 MB/sec | 56.0 sec - 28.0 sec |
| XML (Boost) | 662 MB | 11.0 MB/sec - 13.0 MB/sec | 11.0 sec - 9.0 sec |
| YAML ([custom archive)](https://gitlab.com/correaa/boost-archive-yml) | 702 MB | 10.0 MB/sec - 4.4 MB/sec | 12.0 sec - 28.0 sec |
| Portable Binary (Cereal) | 134 MB | 130 MB/sec - 121 MB/sec | 9.7 sec - 10.6 sec |
| Text (Boost) | 411 MB | 15.0 MB/sec - 16.0 MB/sec | 8.2 sec - 7.6 sec |
| Binary (Cereal) | 134 MB | 134.4 MB/sec - 126. MB/sec | 0.9 sec - 0.9 sec |
| Binary (Boost) | 134 MB | 5200. MB/sec - 1600. MB/sec | 0.02 sec - 0.1 sec |
| gzip-XML (Cereal) | 191 MB | 2. MB/sec - 4. MB/sec | 61 sec - 32 sec |
| gzip-XML (Boost) | 207 MB | 8. MB/sec - 8. MB/sec | 16.1 sec - 15.9 sec |
| Binary (Boost) | 134 MB | 5200 MB/sec - 1600 MB/sec | 0.02 sec - 0.1 sec |
| gzip-XML (Cereal) | 191 MB | 2.0 MB/sec - 4.0 MB/sec | 61 sec - 32 sec |
| gzip-XML (Boost) | 207 MB | 8.0 MB/sec - 8.0 MB/sec | 16.1 sec - 15.9 sec |

## Range-v3

Expand All @@ -1668,6 +1668,7 @@ In this way, `d2D.transposed()` is interpreted as a range of columns (of the ori

```cpp
#include <range/v3/all.hpp>

int main(){

multi::array<int, 2> const d2D = {
Expand Down
14 changes: 8 additions & 6 deletions include/boost/multi/adaptors/fftw/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ if(ENABLE_CUDA OR DEFINED CXXCUDA)
endif()
endif()

if(ENABLE_CIRCLE)
find_package(BLAS REQUIRED)
find_path(
BLAS_INCLUDE_DIRS
cblas.h
/usr/include
/usr/local/include
$ENV{BLAS_HOME}/include
BLAS_INCLUDE_DIRS
cblas.h
/usr/include
/usr/local/include
$ENV{BLAS_HOME}/include
)
# include_directories(${TEST_EXE} PRIVATE ${BLAS_INCLUDE_DIRS})
include_directories(${TEST_EXE} PRIVATE ${BLAS_INCLUDE_DIRS})
link_libraries(${BLAS_LIBRARIES})
endif()

enable_testing()

Expand Down
2 changes: 1 addition & 1 deletion include/boost/multi/adaptors/fftw/test/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro
BOOST_TEST( out == in );
}

BOOST_AUTO_TEST_CASE(fftw_2D_many) { // , *boost::unit_test::tolerance(0.0001)) {
BOOST_AUTO_TEST_CASE(fftw_2D_many) {
using complex = std::complex<double>;

auto const I = complex{0.0, 1.0}; // NOLINT(readability-identifier-length) imag unit
Expand Down
2 changes: 1 addition & 1 deletion include/boost/multi/adaptors/fftw/test/so_shift.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 Alfredo A. Correa
// Copyright 2022-2025 Alfredo A. Correa
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

Expand Down
2 changes: 2 additions & 0 deletions include/boost/multi/detail/index_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,13 @@ struct extension_t : public range<IndexType, IndexTypeLast> {
}
};

#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703)
template<class IndexType, class IndexTypeLast>
extension_t(IndexType, IndexTypeLast) -> extension_t<IndexType, IndexTypeLast>;

template<class IndexType>
extension_t(IndexType) -> extension_t<IndexType>;
#endif

template<class IndexType = std::ptrdiff_t, class IndexTypeLast = decltype(std::declval<IndexType>() + 1)>
constexpr auto make_extension_t(IndexType first, IndexTypeLast last) -> extension_t<IndexType, IndexTypeLast> {
Expand Down
8 changes: 4 additions & 4 deletions include/boost/multi/detail/layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ

template<class T1, class T = void, class = decltype(base_{tuple<T1>{}}), std::enable_if_t<sizeof(T*) && D == 1, int> = 0> // NOLINT(modernize-use-constraints) TODO(correaa)
// cppcheck-suppress noExplicitConstructor ; to allow passing tuple<int, int> // NOLINTNEXTLINE(runtime/explicit)
constexpr extensions_t(tuple<T1> extensions) : base_{std::move(extensions)} {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
constexpr extensions_t(detail::tuple<T1> extensions) : base_{std::move(extensions)} {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)

template<class T1, class T = void, class = decltype(base_{::std::tuple<T1>{}}), std::enable_if_t<sizeof(T*) && D == 1, int> = 0> // NOLINT(modernize-use-constraints) TODO(correaa)
// cppcheck-suppress noExplicitConstructor ; to allow passing tuple<int, int> // NOLINTNEXTLINE(runtime/explicit)
constexpr extensions_t(::std::tuple<T1> extensions) : base_{std::move(extensions)} {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)

template<class T1, class T2, class T = void, class = decltype(base_{tuple<T1, T2>{}}), std::enable_if_t<sizeof(T*) && D == 2, int> = 0> // NOLINT(modernize-use-constraints) TODO(correaa)
// cppcheck-suppress noExplicitConstructor ; to allow passing tuple<int, int> // NOLINTNEXTLINE(runtime/explicit)
constexpr extensions_t(tuple<T1, T2> extensions) : base_{std::move(extensions)} {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
constexpr extensions_t(detail::tuple<T1, T2> extensions) : base_{std::move(extensions)} {} // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)

template<class T1, class T2, class T = void, class = decltype(base_{::std::tuple<T1, T2>{}}), std::enable_if_t<sizeof(T*) && D == 2, int> = 0> // NOLINT(modernize-use-constraints) TODO(correaa)
// cppcheck-suppress noExplicitConstructor ; to allow passing tuple<int, int> // NOLINTNEXTLINE(runtime/explicit)
Expand Down Expand Up @@ -206,8 +206,8 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
template<class... Indices>
constexpr auto prev_canonical(index& idx, Indices&... rest) const -> bool { // NOLINT(google-runtime-references) idx is mutated
if(extensions_t<D-1>{this->base().tail()}.prev_canonical(rest...)) { --idx; }
if(idx < this->base().head().first()) {
idx = this->base().head().back();
if(idx < static_cast<index>(this->base().head().first())) {
idx = static_cast<index>(this->base().head().back());
return true;
}
return false;
Expand Down
3 changes: 2 additions & 1 deletion include/boost/multi/detail/tuple_zip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ template<class T0, class... Ts> constexpr auto tie(T0& head, Ts&... tail) {
return tuple<T0&, Ts&...>(head, tail...);
}

template<class T0, class... Ts> constexpr auto ht_tuple(T0 head, tuple<Ts...> tail) {
template<class T0, class... Ts> constexpr auto ht_tuple(T0 head, tuple<Ts...> tail)
-> tuple<T0, Ts...> {
return tuple<T0, Ts...>(std::move(head), std::move(tail));
}

Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ else()
/wd4868 # compiler may not enforce left-to-right evaluation order in braced initializer list
/wd5026 # move constructor was implicitly defined as deleted
/wd5027 # move assignment operator was implicitly defined as deleted
/wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
>
)

Expand Down

0 comments on commit 8e7bf88

Please sign in to comment.