Skip to content

Commit

Permalink
Modernize modules in level 17 and 18
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Aug 24, 2023
1 parent 557b87d commit 7d4a9de
Show file tree
Hide file tree
Showing 48 changed files with 560 additions and 517 deletions.
4 changes: 2 additions & 2 deletions cmake/HPX_SetupLCI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ macro(hpx_setup_lci)
)
else()
hpx_info(
"HPX_WITH_FETCH_LCI=${HPX_WITH_FETCH_LCI}, LCI will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_Lci_TAG=${HPX_WITH_Lci_TAG})"
"HPX_WITH_FETCH_LCI=${HPX_WITH_FETCH_LCI}, LCI will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_LCI_TAG=${HPX_WITH_LCI_TAG})"
)
endif()
include(FetchContent)
fetchcontent_declare(
lci
GIT_REPOSITORY https://github.com/uiuc-hpc/LC.git
GIT_TAG ${HPX_WITH_Lci_TAG}
GIT_TAG ${HPX_WITH_LCI_TAG}
)

fetchcontent_getproperties(lci)
Expand Down
4 changes: 2 additions & 2 deletions libs/core/debugging/include/hpx/debugging/print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ namespace hpx::debug {
std::string buffered_msg;

//
scoped_var(char const* p, Args const&... args)
explicit scoped_var(char const* p, Args const&... args)
: prefix_(p)
, message_(args...)
{
Expand All @@ -395,7 +395,7 @@ namespace hpx::debug {
double const delay_;
std::tuple<Args...> const message_;
//
timed_var(double delay, Args const&... args)
explicit timed_var(double delay, Args const&... args)
: time_start_(std::chrono::steady_clock::now())
, delay_(delay)
, message_(args...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include <hpx/futures/futures_factory.hpp>
#include <hpx/futures/traits/is_future.hpp>
#include <hpx/threading_base/annotated_function.hpp>
#include <hpx/threading_base/detail/get_default_pool.hpp>
#include <hpx/threading_base/scoped_annotation.hpp>
#include <hpx/threading_base/thread_description.hpp>
#include <hpx/threading_base/thread_helpers.hpp>
#include <hpx/threading_base/thread_pool_base.hpp>

#include <exception>
#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include <hpx/execution/detail/sync_launch_policy_dispatch.hpp>
#include <hpx/functional/deferred_call.hpp>
#include <hpx/functional/invoke.hpp>
#include <hpx/threading_base/detail/get_default_pool.hpp>
#include <hpx/threading_base/thread_description.hpp>
#include <hpx/threading_base/thread_helpers.hpp>
#include <hpx/threading_base/thread_num_tss.hpp>
#include <hpx/threading_base/thread_pool_base.hpp>

#include <cstdint>
#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include <hpx/modules/topology.hpp>
#include <hpx/serialization/serialize.hpp>
#include <hpx/threading_base/annotated_function.hpp>
#include <hpx/threading_base/detail/get_default_pool.hpp>
#include <hpx/threading_base/thread_data.hpp>
#include <hpx/threading_base/thread_pool_base.hpp>
#include <hpx/timing/steady_clock.hpp>

#include <algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <hpx/execution_base/sender.hpp>
#include <hpx/modules/topology.hpp>
#include <hpx/threading_base/annotated_function.hpp>
#include <hpx/threading_base/detail/get_default_pool.hpp>
#include <hpx/threading_base/register_thread.hpp>
#include <hpx/timing/steady_clock.hpp>

Expand Down
1 change: 1 addition & 0 deletions libs/core/futures/include/hpx/futures/futures_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <hpx/futures/traits/future_access.hpp>
#include <hpx/modules/errors.hpp>
#include <hpx/modules/memory.hpp>
#include <hpx/threading_base/detail/get_default_pool.hpp>
#include <hpx/threading_base/thread_description.hpp>
#include <hpx/threading_base/thread_helpers.hpp>
#include <hpx/threading_base/thread_num_tss.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace hpx::util {
}

/// \brief Activate the thread \a index for this thread pool
void thread_run(std::size_t index, barrier* startup = nullptr);
void thread_run(std::size_t index, barrier* startup = nullptr) const;

/// \brief Return name of this pool
constexpr char const* get_name() const noexcept
Expand All @@ -122,7 +122,8 @@ namespace hpx::util {
using io_service_ptr = std::unique_ptr<asio::io_context>;
using work_type = std::unique_ptr<asio::io_context::work>;

HPX_FORCEINLINE work_type initialize_work(asio::io_context& io_service)
HPX_FORCEINLINE work_type initialize_work(
asio::io_context& io_service) const
{
return work_type(
std::make_unique<asio::io_context::work>(io_service));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#include <hpx/config.hpp>
#include <hpx/io_service/io_service_pool_fwd.hpp>
#include <hpx/threading_base/callback_notifier.hpp>
#include <hpx/threading_base/scheduler_mode.hpp>
#include <hpx/threading_base/scheduler_state.hpp>
#include <hpx/threading_base/thread_pool_base.hpp>

Expand Down
6 changes: 2 additions & 4 deletions libs/core/io_service/src/io_service_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ namespace hpx::util {
, pool_name_(pool_name)
, pool_name_postfix_(name_postfix)
, waiting_(false)
, wait_barrier_()
, continue_barrier_()
{
LPROGRESS_ << pool_name;
init(pool_size);
Expand All @@ -52,7 +50,6 @@ namespace hpx::util {
HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
"io_service_pool::io_service_pool",
"io_service_pool size is 0");
return;
}

wait_barrier_.reset(new barrier(pool_size + 1));
Expand Down Expand Up @@ -93,7 +90,8 @@ namespace hpx::util {
clear_locked();
}

void io_service_pool::thread_run(std::size_t index, util::barrier* startup)
void io_service_pool::thread_run(
std::size_t index, util::barrier* startup) const
{
// wait for all threads to start up before before starting HPX work
if (startup != nullptr)
Expand Down
2 changes: 0 additions & 2 deletions libs/core/io_service/src/io_service_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <hpx/concurrency/barrier.hpp>
#include <hpx/io_service/io_service_pool.hpp>
#include <hpx/io_service/io_service_thread_pool.hpp>
#include <hpx/threading_base/callback_notifier.hpp>
#include <hpx/threading_base/scheduler_mode.hpp>

#include <cstddef>
#include <exception>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016-2018 Hartmut Kaiser
// Copyright (c) 2016-2023 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -14,6 +14,7 @@
#include <hpx/functional/invoke_result.hpp>
#include <hpx/synchronization/spinlock.hpp>
#include <hpx/threading_base/thread_helpers.hpp>
#include <hpx/threading_base/threading_base_fwd.hpp>

#include <chrono>
#include <condition_variable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@
#pragma once

#include <hpx/config.hpp>
#include <hpx/assert.hpp>
#include <hpx/modules/logging.hpp>
#include <hpx/schedulers/deadlock_detection.hpp>
#include <hpx/schedulers/local_queue_scheduler.hpp>
#include <hpx/schedulers/lockfree_queue_backends.hpp>
#include <hpx/schedulers/thread_queue.hpp>
#include <hpx/threading_base/thread_data.hpp>
#include <hpx/topology/topology.hpp>

#include <cstddef>
#include <cstdint>
#include <memory>
#include <mutex>
#include <string_view>
#include <vector>

#include <hpx/config/warnings_prefix.hpp>

Expand Down Expand Up @@ -67,16 +61,18 @@ namespace hpx::threads::policies {
{
// this scheduler does not support stealing or numa stealing, but
// needs to enable background work
mode = scheduler_mode(mode & ~scheduler_mode::enable_stealing);
mode = scheduler_mode(mode & ~scheduler_mode::enable_stealing_numa);
mode = static_cast<scheduler_mode>(
mode & ~scheduler_mode::enable_stealing);
mode = static_cast<scheduler_mode>(
mode & ~scheduler_mode::enable_stealing_numa);
mode = mode | ~scheduler_mode::do_background_work;
mode = mode | ~scheduler_mode::do_background_work_only;
scheduler_base::set_scheduler_mode(mode);
}

// Return the next thread to be executed, return false if none is
// available
constexpr bool get_next_thread(
static constexpr bool get_next_thread(
std::size_t, bool, threads::thread_id_ref_type&, bool) noexcept
{
// this scheduler does not maintain any thread queues
Expand All @@ -87,8 +83,9 @@ namespace hpx::threads::policies {
// manager to allow for maintenance tasks to be executed in the
// scheduler. Returns true if the OS thread calling this function has to
// be terminated (i.e. no more work has to be done).
constexpr bool wait_or_add_new(std::size_t, bool running, std::int64_t&,
bool, std::size_t&, thread_id_ref_type* = nullptr)
static constexpr bool wait_or_add_new(std::size_t, bool running,
std::int64_t&, bool, std::size_t&,
thread_id_ref_type* = nullptr) noexcept
{
return !running;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace hpx::threads::policies {
detail::affinity_data const& affinity_data,
std::size_t num_high_priority_queues = static_cast<std::size_t>(
-1),
thread_queue_init_parameters thread_queue_init =
thread_queue_init_parameters const& thread_queue_init =
thread_queue_init_parameters{},
char const* description =
"local_priority_queue_scheduler") noexcept
Expand Down Expand Up @@ -111,7 +111,7 @@ namespace hpx::threads::policies {
};
using init_parameter_type = init_parameter;

local_priority_queue_scheduler(init_parameter_type const& init,
explicit local_priority_queue_scheduler(init_parameter_type const& init,
bool deferred_initialization = true)
: scheduler_base(
init.num_queues_, init.description_, init.thread_queue_init_)
Expand Down Expand Up @@ -801,7 +801,7 @@ namespace hpx::threads::policies {

num_thread = select_active_pu(num_thread, allow_fallback);

[[maybe_unused]] auto* thrdptr = get_thread_id_data(thrd);
[[maybe_unused]] auto const* thrdptr = get_thread_id_data(thrd);
switch (priority)
{
case thread_priority::high_recursive:
Expand Down Expand Up @@ -1007,7 +1007,7 @@ namespace hpx::threads::policies {
std::int64_t get_thread_count(
thread_schedule_state state = thread_schedule_state::unknown,
thread_priority priority = thread_priority::default_,
std::size_t num_thread = std::size_t(-1),
std::size_t num_thread = static_cast<std::size_t>(-1),
bool /* reset */ = false) const override
{
// Return thread count of one specific queue.
Expand Down
Loading

0 comments on commit 7d4a9de

Please sign in to comment.