diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index d46e929c..482b1b61 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -3,7 +3,7 @@ name: CI Test on: [push, pull_request] jobs: - bst1-86-0: + bst1-87-0: runs-on: ubuntu-latest env: METALL_LIMIT_MAKE_PARALLELS: 8 @@ -12,9 +12,9 @@ jobs: - name: Test run: | pushd /dev/shm - wget -q https://boostorg.jfrog.io/artifactory/main/release/1.86.0/source/boost_1_86_0.tar.gz + wget -q https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz mkdir boost - tar xf boost_1_86_0.tar.gz -C boost --strip-components 1 + tar xf boost_1_87_0.tar.gz -C boost --strip-components 1 export BOOST_ROOT=${PWD}/boost popd export METALL_TEST_DIR=${GITHUB_JOB} @@ -32,7 +32,7 @@ jobs: - name: Test run: | pushd /dev/shm - wget -q https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz + wget -q https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz mkdir boost tar xf boost_1_80_0.tar.gz -C boost --strip-components 1 export BOOST_ROOT=${PWD}/boost diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcb7ba43..bd98f5f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,12 @@ -# GitLab CI YML file dedicated for LC environment (Quartz) +# GitLab CI YML file dedicated for LC environment (Ruby) # # Spack must be available # It would be better to install all Boost versions manually, # as it causes errors often and could exceed the timelimit of the system. +# For '--reserv=ci' option in Slurm, see: +# https://lc.llnl.gov/confluence/spaces/GITLAB/pages/785285769/Special+partitions+for+CI+batch+jobs + include: [component: $CI_SERVER_FQDN/lc-components/id_tokens/id_tokens-component@main] stages: @@ -25,21 +28,20 @@ install_boost: - shell script: - hostname - - srun -N1 -ppci spack install boost@1.86.0 boost@1.85.0 boost@1.84.0 boost@1.83.0 boost@1.82.0 boost@1.81.0 boost@1.80.0 - - spack clean + - srun -N1 --reserv=ci -A seq sh -c 'for p in "boost@1.86.0" "boost@1.85.0" "boost@1.84.0" "boost@1.83.0" "boost@1.82.0" "boost@1.81.0" "boost@1.80.0"; do spack install --reuse $p; done; spack clean' .build: stage: build tags: - - quartz + - ruby - shell script: - echo "=== build section ===" - module load gcc/${GCC_VERSION} - spack load --first boost@${BOOST_VERSION} arch=$(spack arch) - export METALL_TEST_DIR="/dev/shm/metall_test-${CI_CONCURRENT_ID}-${CI_PIPELINE_IID}" - - srun -N1 -ppci bash ./scripts/CI/build_and_test.sh + - srun -N1 --reserv=ci -A seq bash ./scripts/CI/build_and_test.sh build_gcc12.1.1_bst1.86.0: extends: .build diff --git a/CMakeLists.txt b/CMakeLists.txt index baf0c2bb..a5988e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ endif () # Metall general configuration # -------------------------------------------------------------------------------- # project(Metall - VERSION 0.29 + VERSION 0.30 DESCRIPTION "A persistent memory allocator for data-centric analytics" HOMEPAGE_URL "https://github.com/LLNL/metall") @@ -207,7 +207,8 @@ find_boost_headers(1.80 FALSE) if (NOT Boost_FOUND) message(STATUS "Fetching Boost") FetchContent_Declare(Boost - URL https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2) + URL https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.bz2 + SYSTEM) FetchContent_MakeAvailable(Boost) set(BOOST_ROOT ${boost_SOURCE_DIR}) find_package(Boost 1.80 REQUIRED) diff --git a/cmake/find_boost_headers.cmake b/cmake/find_boost_headers.cmake index eec5ed79..2517c58c 100644 --- a/cmake/find_boost_headers.cmake +++ b/cmake/find_boost_headers.cmake @@ -17,6 +17,8 @@ function(find_boost_headers min_version required) if (Boost_FOUND) set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} PARENT_SCOPE) set(Boost_FOUND ${Boost_FOUND} PARENT_SCOPE) + message(STATUS "Found Boost at ${Boost_INCLUDE_DIRS}") + message(STATUS "Boost version: ${Boost_VERSION}") return() endif () diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index c0e8bf31..ecde06bb 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = "Metall" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.29 +PROJECT_NUMBER = v0.30 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/include/metall/detail/in_place_interface.hpp b/include/metall/detail/in_place_interface.hpp deleted file mode 100644 index e0736d22..00000000 --- a/include/metall/detail/in_place_interface.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2019 Lawrence Livermore National Security, LLC and other Metall -// Project Developers. See the top-level COPYRIGHT file for details. -// -// SPDX-License-Identifier: (Apache-2.0 OR MIT) - -#ifndef METALL_DETAIL_UTILITY_IN_PLACE_INTERFACE_HPP -#define METALL_DETAIL_UTILITY_IN_PLACE_INTERFACE_HPP - -#include - -namespace metall::mtlldetail { - -/// \brief Abstract interface for placement construction and destruction -using in_place_interface = boost::interprocess::ipcdetail::in_place_interface; - -} // namespace metall::mtlldetail - -#endif // METALL_DETAIL_UTILITY_IN_PLACE_INTERFACE_HPP diff --git a/include/metall/detail/named_proxy.hpp b/include/metall/detail/named_proxy.hpp index 1b8acdbb..ac48175b 100644 --- a/include/metall/detail/named_proxy.hpp +++ b/include/metall/detail/named_proxy.hpp @@ -1,8 +1,14 @@ -// Copyright 2019 Lawrence Livermore National Security, LLC and other Metall +// Copyright 2024 Lawrence Livermore National Security, LLC and other Metall // Project Developers. See the top-level COPYRIGHT file for details. // // SPDX-License-Identifier: (Apache-2.0 OR MIT) +// This file contains some code from Boost.Interprocess. +// Here is the original license: +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef METALL_UTILITY_DETAIL_NAMED_PROXY_HPP #define METALL_UTILITY_DETAIL_NAMED_PROXY_HPP @@ -12,13 +18,47 @@ /// \brief Namespace for implementation details namespace metall::mtlldetail { +template +using CtorArgN = + boost::interprocess::ipcdetail::CtorArgN; + /// \brief Proxy class that implements named allocation syntax. /// \tparam segment_manager segment manager to construct the object /// \tparam T type of object to build /// \tparam is_iterator passing parameters are normal object or iterators? template -using named_proxy = boost::interprocess::ipcdetail::named_proxy; +class named_proxy { + public: + using char_type = typename segment_manager::char_type; + + named_proxy(segment_manager *mngr, const char_type *name, bool find, + bool dothrow) + : m_name(name), + m_mngr(mngr), + m_num(1), + m_find(find), + m_dothrow(dothrow) {} + + template + T *operator()(Args &&...args) const { + CtorArgN ctor_obj(std::forward(args)...); + return m_mngr->template generic_construct( + m_name, m_num, m_find, m_dothrow, ctor_obj); + } + + // This operator allows --> named_new("Name")[3]; <-- syntax + const named_proxy &operator[](const std::size_t num) const { + m_num *= num; + return *this; + } + + private: + const char_type *const m_name; + segment_manager *const m_mngr; + mutable std::size_t m_num; + const bool m_find; + const bool m_dothrow; +}; } // namespace metall::mtlldetail diff --git a/include/metall/kernel/manager_kernel.hpp b/include/metall/kernel/manager_kernel.hpp index 4052d64e..b1266381 100644 --- a/include/metall/kernel/manager_kernel.hpp +++ b/include/metall/kernel/manager_kernel.hpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -328,11 +327,11 @@ class manager_kernel { /// the same name. \param do_throw Ignored. This method does not throw its own /// exception --- this function throws an exception thrown by the constructor /// of the object. This is how Boost.Interprocess treats this parameter. - /// \param table Reference to an in_place_interface object. + /// \param pr Reference to a CtorArgN object. /// \return Returns a pointer to the constructed object(s). - template + template T *generic_construct(char_ptr_holder_type name, size_type num, bool try2find, - bool do_throw, mdtl::in_place_interface &table); + bool do_throw, proxy &pr); /// \brief Return a reference to the segment header. /// \return A reference to the segment header. @@ -500,9 +499,9 @@ class manager_kernel { static bool priv_unmark_properly_closed(const path_type &base_path); // ---------- For constructed objects ---------- // - template + template T *priv_generic_construct(char_ptr_holder_type name, size_type length, - bool try2find, mdtl::in_place_interface &table); + bool try2find, proxy &pr); template bool priv_register_attr_object_no_mutex(char_ptr_holder_type name, diff --git a/include/metall/kernel/manager_kernel_impl.ipp b/include/metall/kernel/manager_kernel_impl.ipp index 1cdb0a0c..06ba798d 100644 --- a/include/metall/kernel/manager_kernel_impl.ipp +++ b/include/metall/kernel/manager_kernel_impl.ipp @@ -419,12 +419,12 @@ manager_kernel::anonymous_end() const { } template -template +template T *manager_kernel::generic_construct( char_ptr_holder_type name, const size_type num, const bool try2find, - [[maybe_unused]] const bool do_throw, mdtl::in_place_interface &table) { + [[maybe_unused]] const bool do_throw, proxy &pr) { priv_check_sanity(); - return priv_generic_construct(name, num, try2find, table); + return priv_generic_construct(name, num, try2find, pr); } template @@ -694,15 +694,9 @@ bool manager_kernel::priv_unmark_properly_closed( } template -template +template T *manager_kernel::priv_generic_construct( - char_ptr_holder_type name, size_type length, bool try2find, - mdtl::in_place_interface &table) { - // Check overflow for security - if (length > ((std::size_t)-1) / table.size) { - return nullptr; - } - + char_ptr_holder_type name, size_type length, bool try2find, proxy &pr) { void *ptr = nullptr; try { #ifdef METALL_ENABLE_MUTEX_IN_MANAGER_KERNEL @@ -754,7 +748,7 @@ T *manager_kernel::priv_generic_construct( }); #if BOOST_VERSION >= 108500 - table.construct_n(ptr, length); + pr.construct_n(ptr, length); #else // Constructs each object in the allocated memory // When one of objects of T in the array throws exception, @@ -762,10 +756,10 @@ T *manager_kernel::priv_generic_construct( // rethrows the exception std::size_t constructed = 0; try { - table.construct_n(ptr, length, constructed); + pr.construct_n(ptr, length, constructed); } catch (...) { std::size_t destroyed = 0; - table.destroy_n(ptr, constructed, destroyed); + pr.destroy_n(ptr, constructed, destroyed); throw; } #endif diff --git a/include/metall/version.hpp b/include/metall/version.hpp index 2aeec4db..3555510c 100644 --- a/include/metall/version.hpp +++ b/include/metall/version.hpp @@ -14,7 +14,7 @@ /// METALL_VERSION / 100 % 1000 // the minor version. /// METALL_VERSION % 100 // the patch level. /// \endcode -#define METALL_VERSION 2900 +#define METALL_VERSION 3000 namespace metall { /// \brief Variable type to handle a version data.