Skip to content

Commit

Permalink
Merge branch 'master' into build-doxy-dont-extract-private
Browse files Browse the repository at this point in the history
  • Loading branch information
bhumitattarde committed Oct 6, 2022
2 parents 67558b6 + 21366b0 commit 419751a
Show file tree
Hide file tree
Showing 32 changed files with 576 additions and 102 deletions.
2 changes: 1 addition & 1 deletion examples/1d_stencil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ foreach(example_program ${example_programs})
add_hpx_executable(
${example_program} INTERNAL_FLAGS
SOURCES ${sources} ${${example_program}_FLAGS}
FOLDER "Examples/1D Stencil/${example_program}"
FOLDER "Examples/1D Stencil"
)

add_hpx_example_target_dependencies("1d_stencil" ${example_program})
Expand Down
29 changes: 18 additions & 11 deletions libs/core/affinity/include/hpx/affinity/affinity_data.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2017 Hartmut Kaiser
// Copyright (c) 2007-2022 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -89,21 +89,28 @@ namespace hpx { namespace threads { namespace policies { namespace detail {
std::size_t num_thread, std::size_t hardware_concurrency) const;

private:
std::size_t num_threads_; ///< number of processing units managed
std::size_t
pu_offset_; ///< offset of the first processing unit to use
std::size_t pu_step_; ///< step between used processing units
///< number of processing units managed
std::size_t num_threads_;

///< offset of the first processing unit to use
std::size_t pu_offset_;

///< step between used processing units
std::size_t pu_step_;
std::size_t used_cores_;
std::string affinity_domain_;
std::vector<mask_type> affinity_masks_;
std::vector<std::size_t> pu_nums_;
mask_type
no_affinity_; ///< mask of processing units which have no affinity
bool
use_process_mask_; ///< use the process CPU mask to limit available PUs

///< mask of processing units which have no affinity
mask_type no_affinity_;

///< use the process CPU mask to limit available PUs
bool use_process_mask_;
std::size_t num_pus_needed_;
static std::atomic<int>
instance_number_counter_; ///< counter for instance numbers

///< counter for instance numbers
static std::atomic<int> instance_number_counter_;
};
}}}} // namespace hpx::threads::policies::detail

Expand Down
2 changes: 1 addition & 1 deletion libs/core/affinity/src/affinity_data.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2007-2017 Hartmut Kaiser
// Copyright (c) 2007-2022 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down
3 changes: 2 additions & 1 deletion libs/core/asio/include/hpx/asio/asio_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace hpx { namespace util {

///////////////////////////////////////////////////////////////////////////
HPX_CORE_EXPORT bool get_endpoint(std::string const& addr,
std::uint16_t port, asio::ip::tcp::endpoint& ep, bool force_ipv4 = false);
std::uint16_t port, asio::ip::tcp::endpoint& ep,
bool force_ipv4 = false);

HPX_CORE_EXPORT std::string get_endpoint_name(
asio::ip::tcp::endpoint const& ep);
Expand Down
3 changes: 2 additions & 1 deletion libs/core/asio/include/hpx/asio/map_hostnames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace hpx { namespace util {
transform_function_type;

map_hostnames(bool debug = false)
: ipv4_(false), debug_(debug)
: ipv4_(false)
, debug_(debug)
{
}

Expand Down
4 changes: 2 additions & 2 deletions libs/core/asio/src/asio_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ namespace hpx { namespace util {

asio::ip::tcp::resolver::iterator it = resolver.resolve(query);

while (force_ipv4 &&
it != tcp::resolver::iterator() && !it->endpoint().address().is_v4())
while (force_ipv4 && it != tcp::resolver::iterator() &&
!it->endpoint().address().is_v4())
{
++it;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 ETH Zurich
// Copyright (c) 2022 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -10,8 +11,21 @@
#include <hpx/coroutines/thread_enums.hpp>
#include <hpx/functional/detail/tag_fallback_invoke.hpp>

#include <type_traits>

namespace hpx { namespace execution { namespace experimental {

///////////////////////////////////////////////////////////////////////////
template <typename Property, typename Enable = void>
struct is_scheduling_property : std::false_type
{
};

template <typename Property>
inline constexpr bool is_scheduling_property_v =
is_scheduling_property<Property>::value;

///////////////////////////////////////////////////////////////////////////
namespace detail {

template <typename Tag, typename... Args>
Expand Down Expand Up @@ -41,6 +55,16 @@ namespace hpx { namespace execution { namespace experimental {
};
} // namespace detail

///////////////////////////////////////////////////////////////////////////
template <typename Property>
struct is_scheduling_property<Property,
std::enable_if_t<
std::is_base_of_v<detail::property_base<Property>, Property>>>
: std::true_type
{
};

///////////////////////////////////////////////////////////////////////////
inline constexpr struct with_priority_t final
: detail::property_base<with_priority_t>
{
Expand All @@ -59,6 +83,12 @@ namespace hpx { namespace execution { namespace experimental {
}
} get_priority{};

template <>
struct is_scheduling_property<get_priority_t> : std::true_type
{
};

///////////////////////////////////////////////////////////////////////////
inline constexpr struct with_stacksize_t final
: detail::property_base<with_stacksize_t>
{
Expand All @@ -77,6 +107,12 @@ namespace hpx { namespace execution { namespace experimental {
}
} get_stacksize{};

template <>
struct is_scheduling_property<get_stacksize_t> : std::true_type
{
};

///////////////////////////////////////////////////////////////////////////
inline constexpr struct with_hint_t final
: detail::property_base<with_hint_t>
{
Expand All @@ -95,6 +131,12 @@ namespace hpx { namespace execution { namespace experimental {
}
} get_hint{};

template <>
struct is_scheduling_property<get_hint_t> : std::true_type
{
};

///////////////////////////////////////////////////////////////////////////
inline constexpr struct with_annotation_t final
: detail::property_base<with_annotation_t>
{
Expand All @@ -112,4 +154,9 @@ namespace hpx { namespace execution { namespace experimental {
return nullptr;
}
} get_annotation{};

template <>
struct is_scheduling_property<get_annotation_t> : std::true_type
{
};
}}} // namespace hpx::execution::experimental
1 change: 1 addition & 0 deletions libs/core/compute_local/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ add_hpx_module(
hpx_algorithms
hpx_allocator_support
hpx_async_combinators
hpx_concepts
hpx_config
hpx_datastructures
hpx_execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#include <hpx/executors/fork_join_executor.hpp>
#include <hpx/iterator_support/counting_shape.hpp>
#include <hpx/iterator_support/iterator_range.hpp>
#include <hpx/modules/concepts.hpp>
#include <hpx/modules/topology.hpp>
#include <hpx/resource_partitioner/detail/partitioner.hpp>
#include <hpx/topology/cpu_mask.hpp>

#include <chrono>
#include <cstddef>
Expand Down Expand Up @@ -273,6 +274,7 @@ namespace hpx::execution::experimental {
// clang-format off
template <typename Tag, typename Property,
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<
Tag, fork_join_executor, Property>
)>
Expand All @@ -281,20 +283,22 @@ namespace hpx::execution::experimental {
block_fork_join_executor const& exec, Property&& prop) noexcept
{
auto exec_with_prop = exec;
exec_with_prop.exec_ = tag(exec.exec_, HPX_FORWARD(Property, prop));
exec_with_prop.exec_ = hpx::functional::tag_invoke(
tag, exec.exec_, HPX_FORWARD(Property, prop));
return exec_with_prop;
}

// clang-format off
template <typename Tag,
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<Tag, fork_join_executor>
)>
// clang-format on
friend decltype(auto) tag_invoke(
Tag tag, block_fork_join_executor const& exec) noexcept
{
return tag(exec.exec_);
return hpx::functional::tag_invoke(tag, exec.exec_);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,10 @@ namespace hpx::detail {
block_width_type const extra_bits = count_extra_bits();

if (extra_bits != 0)
{
// NOLINTNEXTLINE(stringop-overflow=)
highest_block() &= (Block(1) << extra_bits) - 1;
}
}

// check class invariants
Expand Down
20 changes: 15 additions & 5 deletions libs/core/executors/include/hpx/executors/annotating_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <hpx/execution_base/execution.hpp>
#include <hpx/execution_base/traits/is_executor.hpp>
#include <hpx/functional/tag_invoke.hpp>
#include <hpx/modules/concepts.hpp>
#include <hpx/modules/topology.hpp>
#include <hpx/threading_base/annotated_function.hpp>
#include <hpx/type_support/always_void.hpp>

Expand Down Expand Up @@ -188,23 +190,31 @@ namespace hpx { namespace execution { namespace experimental {
}

// support all properties exposed by the wrapped executor
// clang-format off
template <typename Tag, typename Property,
typename Enable = std::enable_if_t<hpx::functional::
is_tag_invocable_v<Tag, BaseExecutor, Property>>>
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<Tag, BaseExecutor, Property>
)>
// clang-format on
friend annotating_executor tag_invoke(
Tag tag, annotating_executor const& exec, Property&& prop)
{
return annotating_executor(hpx::functional::tag_invoke(
tag, exec.exec_, HPX_FORWARD(Property, prop)));
}

// clang-format off
template <typename Tag,
typename Enable = std::enable_if_t<
hpx::functional::is_tag_invocable_v<Tag, BaseExecutor>>>
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<Tag, BaseExecutor>
)>
// clang-format on
friend decltype(auto) tag_invoke(
Tag tag, annotating_executor const& exec)
{
return hpx::functional::tag_invoke(tag, exec.policy_);
return hpx::functional::tag_invoke(tag, exec.exec_);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#pragma once

#include <hpx/config.hpp>
#include <hpx/concepts/concepts.hpp>
#include <hpx/datastructures/tuple.hpp>
#include <hpx/execution/algorithms/bulk.hpp>
#include <hpx/execution/algorithms/keep_future.hpp>
Expand All @@ -28,6 +27,8 @@
#include <hpx/functional/deferred_call.hpp>
#include <hpx/functional/invoke_fused.hpp>
#include <hpx/functional/tag_invoke.hpp>
#include <hpx/modules/concepts.hpp>
#include <hpx/modules/topology.hpp>

#include <cstddef>
#include <exception>
Expand Down Expand Up @@ -92,19 +93,28 @@ namespace hpx::execution::experimental {
}

// support all properties exposed by the wrapped scheduler
// clang-format off
template <typename Tag, typename Property,
typename Enable = std::enable_if_t<hpx::functional::
is_tag_invocable_v<Tag, BaseScheduler, Property>>>
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<
Tag, BaseScheduler, Property>
)>
// clang-format on
friend explicit_scheduler_executor tag_invoke(
Tag tag, explicit_scheduler_executor const& exec, Property&& prop)
{
return explicit_scheduler_executor(hpx::functional::tag_invoke(
tag, exec.sched_, HPX_FORWARD(Property, prop)));
}

// clang-format off
template <typename Tag,
typename Enable = std::enable_if_t<
hpx::functional::is_tag_invocable_v<Tag, BaseScheduler>>>
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduling_property_v<Tag> &&
hpx::functional::is_tag_invocable_v<Tag, BaseScheduler>
)>
// clang-format on
friend decltype(auto) tag_invoke(
Tag tag, explicit_scheduler_executor const& exec)
{
Expand Down
17 changes: 15 additions & 2 deletions libs/core/executors/include/hpx/executors/fork_join_executor.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 ETH Zurich
// Copyright (c) 2022 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -26,12 +27,11 @@
#include <hpx/modules/format.hpp>
#include <hpx/modules/hardware.hpp>
#include <hpx/modules/itt_notify.hpp>
#include <hpx/modules/topology.hpp>
#include <hpx/resource_partitioner/detail/partitioner.hpp>
#include <hpx/synchronization/spinlock.hpp>
#include <hpx/threading/thread.hpp>
#include <hpx/threading_base/annotated_function.hpp>
#include <hpx/topology/cpu_mask.hpp>
#include <hpx/topology/topology.hpp>

#include <atomic>
#include <chrono>
Expand Down Expand Up @@ -858,6 +858,19 @@ namespace hpx { namespace execution { namespace experimental {
return exec.shared_data_->annotation_;
}

friend auto tag_invoke(
hpx::execution::experimental::get_processing_units_mask_t,
fork_join_executor const& exec) noexcept
{
return exec.shared_data_->pu_mask_;
}

friend auto tag_invoke(hpx::execution::experimental::get_cores_mask_t,
fork_join_executor const& exec) noexcept
{
return exec.shared_data_->pu_mask_;
}

/// \cond NOINTERNAL
enum class init_mode
{
Expand Down
Loading

0 comments on commit 419751a

Please sign in to comment.