diff --git a/.jenkins/lsu/env-clang-17.sh b/.jenkins/lsu/env-clang-17.sh index ac4ab8e51d9..ec573ec6e23 100644 --- a/.jenkins/lsu/env-clang-17.sh +++ b/.jenkins/lsu/env-clang-17.sh @@ -15,6 +15,9 @@ module load openmpi export HPXRUN_RUNWRAPPER=srun export CXX_STD="20" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH +if [[ ! -v CXXFLAGS ]]; then + export CXXFLAGS="" +fi export CXXFLAGS="-fopenmp -Wno-pass-failed ${CXXFLAGS}" configure_extra_options+=" -DCMAKE_BUILD_TYPE=${build_type}" diff --git a/.jenkins/lsu/env-gcc-13.sh b/.jenkins/lsu/env-gcc-13.sh index 42a783a8d21..2602da252e4 100644 --- a/.jenkins/lsu/env-gcc-13.sh +++ b/.jenkins/lsu/env-gcc-13.sh @@ -15,6 +15,9 @@ module load openmpi export HPXRUN_RUNWRAPPER=srun export CXX_STD="20" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH +if [[ ! -v CXXFLAGS ]]; + then export CXXFLAGS="" +fi export CXXFLAGS="-fopenmp ${CXXFLAGS}" configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}" diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_decl.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_decl.hpp index ebf0bd72920..b5df8afa480 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_decl.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_decl.hpp @@ -94,9 +94,8 @@ namespace hpx::server { /// size 0. partitioned_vector(); - explicit partitioned_vector(std::size_t partnum, - std::vector const& partition_sizes, - traits::create_mode = traits::create_mode::resize); + explicit partitioned_vector( + std::size_t partnum, std::vector const& partition_sizes); /// Constructor which create and initialize partitioned_vector_partition /// with all elements as \a val. diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_impl.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_impl.hpp index e5ba4ed3919..3ca38b9d46d 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_impl.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_component_impl.hpp @@ -37,17 +37,10 @@ namespace hpx::server { template HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT - partitioned_vector::partitioned_vector(std::size_t partnum, - std::vector const& partition_sizes, traits::create_mode mode) + partitioned_vector::partitioned_vector( + std::size_t partnum, std::vector const& partition_sizes) { - if (mode == traits::create_mode::resize) - { - partitioned_vector_partition_.resize(partition_sizes[partnum]); - } - else - { - partitioned_vector_partition_.reserve(partition_sizes[partnum]); - } + partitioned_vector_partition_.resize(partition_sizes[partnum]); } template diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_decl.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_decl.hpp index c10b952f7bf..145149ecbee 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_decl.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_decl.hpp @@ -180,8 +180,6 @@ namespace hpx { using partitioned_vector_partition_client = hpx::partitioned_vector_partition; - using create_mode = traits::create_mode; - struct partition_data : server::partitioned_vector_config_data::partition_data { @@ -333,7 +331,7 @@ namespace hpx { template static hpx::future> create_helper1( DistPolicy const& policy, std::size_t count, - std::vector const& sizes, create_mode mode); + std::vector const& sizes); template static hpx::future> create_helper2( @@ -343,8 +341,7 @@ namespace hpx { // This function is called when we are creating the vector. It // initializes the partitions based on the give parameters. template - void create(DistPolicy const& policy, Create&& creator, - create_mode mode = create_mode::resize); + void create(DistPolicy const& policy, Create&& creator); template void create(DistPolicy const& policy); diff --git a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_impl.hpp b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_impl.hpp index 83dc215b476..d946fba3ec7 100644 --- a/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_impl.hpp +++ b/components/containers/partitioned_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_impl.hpp @@ -317,14 +317,12 @@ namespace hpx { HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT hpx::future< std::vector::bulk_locality_result>> partitioned_vector::create_helper1(DistPolicy const& policy, - std::size_t count, std::vector const& sizes, - create_mode mode) + std::size_t count, std::vector const& sizes) { using component_type = typename partitioned_vector_partition_client::server_component_type; - return policy.template bulk_create( - count, sizes, mode); + return policy.template bulk_create(count, sizes); } template */> @@ -344,7 +342,7 @@ namespace hpx { template */> template void partitioned_vector::create( - DistPolicy const& policy, Create&& creator, create_mode mode) + DistPolicy const& policy, Create&& creator) { std::size_t num_parts = traits::num_container_partitions::call(policy); @@ -353,7 +351,7 @@ namespace hpx { // create as many partitions as required hpx::future> f = - HPX_FORWARD(Create, creator)(policy, num_parts, part_sizes, mode); + HPX_FORWARD(Create, creator)(policy, num_parts, part_sizes); // now initialize our data structures std::uint32_t const this_locality = get_locality_id(); @@ -413,8 +411,7 @@ namespace hpx { HPX_PARTITIONED_VECTOR_SPECIALIZATION_EXPORT void partitioned_vector::create(DistPolicy const& policy) { - create(policy, &partitioned_vector::create_helper1, - traits::allocation_mode::call(policy)); + create(policy, &partitioned_vector::create_helper1); } template */> @@ -424,7 +421,7 @@ namespace hpx { { create(policy, [&val](DistPolicy const& policy, std::size_t num_parts, - std::vector const& part_sizes, create_mode) { + std::vector const& part_sizes) { return create_helper2(policy, num_parts, part_sizes, val); }); } diff --git a/libs/full/actions_base/include/hpx/actions_base/traits/is_distribution_policy.hpp b/libs/full/actions_base/include/hpx/actions_base/traits/is_distribution_policy.hpp index 07e82d3b309..bc356c42cf5 100644 --- a/libs/full/actions_base/include/hpx/actions_base/traits/is_distribution_policy.hpp +++ b/libs/full/actions_base/include/hpx/actions_base/traits/is_distribution_policy.hpp @@ -47,21 +47,4 @@ namespace hpx::traits { num_parts, (size + num_parts - 1) / num_parts); } }; - - // By default, the container distribution policy resizes the underlying - // vectors. - enum class create_mode : std::uint8_t - { - resize = 0, - reserve = 1 - }; - - template - struct allocation_mode - { - static create_mode call(Policy const&) - { - return create_mode::resize; - } - }; } // namespace hpx::traits diff --git a/libs/full/distribution_policies/include/hpx/distribution_policies/container_distribution_policy.hpp b/libs/full/distribution_policies/include/hpx/distribution_policies/container_distribution_policy.hpp index 2e2e3e118dc..f765c33370f 100644 --- a/libs/full/distribution_policies/include/hpx/distribution_policies/container_distribution_policy.hpp +++ b/libs/full/distribution_policies/include/hpx/distribution_policies/container_distribution_policy.hpp @@ -33,57 +33,48 @@ namespace hpx { { container_distribution_policy() = default; - container_distribution_policy operator()(std::size_t num_partitions, - traits::create_mode mode = traits::create_mode::resize) const - { - return {num_partitions, get_localities(), mode}; - } - - container_distribution_policy operator()(traits::create_mode mode) const + container_distribution_policy operator()( + std::size_t num_partitions) const { - return container_distribution_policy(mode); + return {num_partitions, get_localities()}; } - container_distribution_policy operator()(hpx::id_type const& locality, - traits::create_mode mode = traits::create_mode::resize) const + container_distribution_policy operator()( + hpx::id_type const& locality) const { - return {locality, mode}; + return {locality}; } container_distribution_policy operator()( - std::vector const& localities, - traits::create_mode mode = traits::create_mode::resize) const + std::vector const& localities) const { if (num_partitions_ != static_cast(-1)) { - return {num_partitions_, localities, mode}; + return {num_partitions_, localities}; } - return {localities.size(), localities, mode}; + return {localities.size(), localities}; } container_distribution_policy operator()( - std::vector&& localities, - traits::create_mode mode = traits::create_mode::resize) const + std::vector&& localities) const { if (num_partitions_ != static_cast(-1)) { - return {num_partitions_, HPX_MOVE(localities), mode}; + return {num_partitions_, HPX_MOVE(localities)}; } - return {localities.size(), HPX_MOVE(localities), mode}; + return {localities.size(), HPX_MOVE(localities)}; } container_distribution_policy operator()(std::size_t num_partitions, - std::vector const& localities, - traits::create_mode mode = traits::create_mode::resize) const + std::vector const& localities) const { - return {num_partitions, localities, mode}; + return {num_partitions, localities}; } - container_distribution_policy operator()(std::size_t num_partitions, - std::vector&& localities, - traits::create_mode mode = traits::create_mode::resize) const + container_distribution_policy operator()( + std::size_t num_partitions, std::vector&& localities) const { - return {num_partitions, HPX_MOVE(localities), mode}; + return {num_partitions, HPX_MOVE(localities)}; } /////////////////////////////////////////////////////////////////////// @@ -113,11 +104,6 @@ namespace hpx { return *localities_; } - [[nodiscard]] constexpr traits::create_mode get_create_mode() const - { - return mode_; - } - private: friend class hpx::serialization::access; @@ -125,41 +111,31 @@ namespace hpx { void serialize(Archive& ar, const unsigned int /* version */) { // clang-format off - ar & localities_ & num_partitions_ & mode_; + ar & localities_ & num_partitions_; // clang-format on } - container_distribution_policy(std::size_t num_partitions, - std::vector const& localities, traits::create_mode mode) + container_distribution_policy( + std::size_t num_partitions, std::vector const& localities) : components::default_distribution_policy(localities) , num_partitions_(num_partitions) - , mode_(mode) { } - container_distribution_policy(std::size_t num_partitions, - std::vector&& localities, traits::create_mode mode) + container_distribution_policy( + std::size_t num_partitions, std::vector&& localities) : components::default_distribution_policy(HPX_MOVE(localities)) , num_partitions_(num_partitions) - , mode_(mode) { } - container_distribution_policy( - hpx::id_type const& locality, traits::create_mode mode) + container_distribution_policy(hpx::id_type const& locality) : components::default_distribution_policy(locality) - , mode_(mode) - { - } - - explicit container_distribution_policy(traits::create_mode mode) - : mode_(mode) { } // number of chunks to create std::size_t num_partitions_ = static_cast(-1); - traits::create_mode mode_ = traits::create_mode::resize; }; static container_distribution_policy const container_layout{}; @@ -181,14 +157,5 @@ namespace hpx { return policy.get_num_partitions(); } }; - - template <> - struct allocation_mode - { - static create_mode call(container_distribution_policy const& policy) - { - return policy.get_create_mode(); - } - }; } // namespace traits } // namespace hpx diff --git a/libs/full/distribution_policies/include/hpx/distribution_policies/explicit_container_distribution_policy.hpp b/libs/full/distribution_policies/include/hpx/distribution_policies/explicit_container_distribution_policy.hpp index 23a89ba9ed7..864f5c12f50 100644 --- a/libs/full/distribution_policies/include/hpx/distribution_policies/explicit_container_distribution_policy.hpp +++ b/libs/full/distribution_policies/include/hpx/distribution_policies/explicit_container_distribution_policy.hpp @@ -33,24 +33,22 @@ namespace hpx { explicit_container_distribution_policy() = default; explicit_container_distribution_policy operator()( - std::vector sizes, - traits::create_mode mode = traits::create_mode::resize) const + std::vector sizes) const { - return {HPX_MOVE(sizes), get_localities(), mode}; + return {HPX_MOVE(sizes), get_localities()}; } explicit_container_distribution_policy operator()( - std::vector sizes, hpx::id_type locality, - traits::create_mode mode = traits::create_mode::resize) const + std::vector sizes, hpx::id_type locality) const { - return {HPX_MOVE(sizes), HPX_MOVE(locality), mode}; + return {HPX_MOVE(sizes), HPX_MOVE(locality)}; } explicit_container_distribution_policy operator()( - std::vector sizes, std::vector localities, - traits::create_mode mode = traits::create_mode::resize) const + std::vector sizes, + std::vector localities) const { - return {HPX_MOVE(sizes), HPX_MOVE(localities), mode}; + return {HPX_MOVE(sizes), HPX_MOVE(localities)}; } /////////////////////////////////////////////////////////////////////// @@ -77,11 +75,6 @@ namespace hpx { return sizes_; } - [[nodiscard]] constexpr traits::create_mode get_create_mode() const - { - return mode_; - } - private: friend class hpx::serialization::access; @@ -89,29 +82,26 @@ namespace hpx { void serialize(Archive& ar, unsigned int const /* version */) { // clang-format off - ar & localities_ & sizes_ & mode_; + ar & localities_ & sizes_; // clang-format on } - explicit_container_distribution_policy(std::vector sizes, - std::vector localities, traits::create_mode mode) + explicit_container_distribution_policy( + std::vector sizes, std::vector localities) : components::default_distribution_policy(HPX_MOVE(localities)) , sizes_(HPX_MOVE(sizes)) - , mode_(mode) { } - explicit_container_distribution_policy(std::vector sizes, - hpx::id_type locality, traits::create_mode mode) + explicit_container_distribution_policy( + std::vector sizes, hpx::id_type locality) : components::default_distribution_policy(HPX_MOVE(locality)) , sizes_(HPX_MOVE(sizes)) - , mode_(mode) { } // number of chunks to create std::vector sizes_; - traits::create_mode mode_ = traits::create_mode::resize; }; static explicit_container_distribution_policy const @@ -146,15 +136,5 @@ namespace hpx { return policy.get_sizes(); } }; - - template <> - struct allocation_mode - { - static create_mode call( - explicit_container_distribution_policy const& policy) - { - return policy.get_create_mode(); - } - }; } // namespace traits } // namespace hpx diff --git a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan.cpp b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan.cpp index 84300472e32..6d7be76bab1 100644 --- a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan.cpp +++ b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan.cpp @@ -373,7 +373,7 @@ void exclusive_scan_tests(std::vector& localities) exclusive_scan_tests_with_policy( length, hpx::container_layout(localities)); - exclusive_scan_tests_with_policy(1000, hpx::container_layout(1000)); + exclusive_scan_tests_with_policy(1000, hpx::container_layout(100)); // multiple localities needed for the following tests exclusive_scan_tests_segmented_out_with_policy(length, diff --git a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan2.cpp b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan2.cpp index 4796f03df06..8bcceddef10 100644 --- a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan2.cpp +++ b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_exclusive_scan2.cpp @@ -340,7 +340,7 @@ void exclusive_scan_tests(std::vector& localities) exclusive_scan_tests_with_policy( length, hpx::container_layout(localities)); - exclusive_scan_tests_with_policy(1000, hpx::container_layout(1000)); + exclusive_scan_tests_with_policy(1000, hpx::container_layout(100)); // multiple localities needed for the following tests exclusive_scan_tests_segmented_out_with_policy(length, diff --git a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_inclusive_scan2.cpp b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_inclusive_scan2.cpp index 52a5bda3be4..0b96a8b2f96 100644 --- a/libs/full/segmented_algorithms/tests/unit/partitioned_vector_inclusive_scan2.cpp +++ b/libs/full/segmented_algorithms/tests/unit/partitioned_vector_inclusive_scan2.cpp @@ -333,7 +333,7 @@ void inclusive_scan_tests(std::vector& localities) inclusive_scan_tests_with_policy( length, hpx::container_layout(localities)); - inclusive_scan_tests_with_policy(1000, hpx::container_layout(1000)); + inclusive_scan_tests_with_policy(1000, hpx::container_layout(100)); // multiple localities needed for the following tests inclusive_scan_tests_segmented_out_with_policy(length,