Skip to content

Commit 35711a1

Browse files
committed
Adapt last HPX modules of the HPX core library to C++ modules
Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
1 parent 35bd323 commit 35711a1

44 files changed

Lines changed: 196 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libs/core/async_mpi/include/hpx/async_mpi/mpi_future.hpp

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,25 @@ namespace hpx::mpi::experimental {
4444

4545
// by convention the title is 7 chars (for alignment)
4646
HPX_CXX_EXPORT using print_on = debug::enable_print<false>;
47-
HPX_CXX_EXPORT static constexpr print_on mpi_debug("MPI_FUT");
47+
HPX_CXX_EXPORT inline constexpr print_on mpi_debug("MPI_FUT");
4848

4949
namespace detail {
5050

5151
HPX_CXX_EXPORT using mutex_type = hpx::spinlock;
5252

5353
// mutex needed to protect mpi request vector, note that the
5454
// mpi poll function takes place inside the main scheduling loop
55-
// of hpx and not on an hpx worker thread, so we must use std:mutex
55+
// of hpx and not on a hpx worker thread, so we must use std:mutex
5656
HPX_CXX_EXPORT HPX_CORE_EXPORT mutex_type& get_vector_mtx();
5757

5858
// -----------------------------------------------------------------
5959
// An implementation of future_data for MPI
6060
HPX_CXX_EXPORT struct future_data : hpx::lcos::detail::future_data<int>
6161
{
62-
HPX_NON_COPYABLE(future_data);
62+
future_data(future_data const&) = delete;
63+
future_data(future_data&&) = delete;
64+
future_data& operator=(future_data const&) = delete;
65+
future_data& operator=(future_data&&) = delete;
6366

6467
using init_no_addref =
6568
typename hpx::lcos::detail::future_data<int>::init_no_addref;
@@ -111,8 +114,8 @@ namespace hpx::mpi::experimental {
111114
HPX_CXX_EXPORT using future_data_ptr = hpx::intrusive_ptr<future_data>;
112115

113116
// -----------------------------------------------------------------
114-
// a convenience structure to hold state vars
115-
// used extensivey with debug::print to display rank etc
117+
// a convenience structure to hold state vars used extensively with
118+
// debug::print to display rank etc
116119
HPX_CXX_EXPORT struct mpi_info
117120
{
118121
bool error_handler_initialized_ = false;
@@ -132,20 +135,20 @@ namespace hpx::mpi::experimental {
132135
std::ostream& os, mpi_info const& i);
133136

134137
// -----------------------------------------------------------------
135-
// an MPI error handling type that we can use to intercept
136-
// MPI errors is we enable the error handler
138+
// an MPI error handling type that we can use to intercept MPI errors is
139+
// we enable the error handler
137140
HPX_CXX_EXPORT HPX_CORE_EXPORT extern MPI_Errhandler hpx_mpi_errhandler;
138141

139142
// function that converts an MPI error into an exception
140143
HPX_CXX_EXPORT HPX_CORE_EXPORT void hpx_MPI_Handler(
141144
MPI_Comm*, int* errorcode, ...);
142145

143146
// -----------------------------------------------------------------
144-
// we track requests and callbacks in two vectors even though
145-
// we have the request stored in the request_callback vector already
146-
// the reason for this is because we can use MPI_Testany
147-
// with a vector of requests to save overheads compared
148-
// to testing one by one every item (using a list)
147+
// we track requests and callbacks in two vectors even though we have
148+
// the request stored in the request_callback vector already the reason
149+
// for this is because we can use MPI_Testany with a vector of requests
150+
// to save overheads compared to testing one by one every item (using a
151+
// list)
149152
HPX_CXX_EXPORT HPX_CORE_EXPORT std::vector<MPI_Request>&
150153
get_requests_vector();
151154

@@ -158,16 +161,16 @@ namespace hpx::mpi::experimental {
158161
concurrency::ConcurrentQueue<future_data_ptr>;
159162

160163
// -----------------------------------------------------------------
161-
// used internally to query how many requests are 'in flight'
162-
// these are requests that are being polled for actively
163-
// and not the same as the requests enqueued
164+
// used internally to query how many requests are 'in flight' these are
165+
// requests that are being polled for actively and not the same as the
166+
// requests enqueued
164167
HPX_CXX_EXPORT HPX_CORE_EXPORT std::size_t
165168
get_number_of_active_requests();
166169
} // namespace detail
167170

168171
// -----------------------------------------------------------------
169-
// set an error handler for communicators that will be called
170-
// on any error instead of the default behavior of program termination
172+
// set an error handler for communicators that will be called on any error
173+
// instead of the default behavior of program termination
171174
HPX_CXX_EXPORT HPX_CORE_EXPORT void set_error_handler();
172175

173176
// -----------------------------------------------------------------
@@ -200,9 +203,9 @@ namespace hpx::mpi::experimental {
200203
} // namespace detail
201204

202205
// -----------------------------------------------------------------
203-
// Background progress function for MPI async operations
204-
// Checks for completed MPI_Requests and sets mpi::experimental::future ready
205-
// when found
206+
// Background progress function for MPI async operations. Checks for
207+
// completed MPI_Requests and sets mpi::experimental::future ready when
208+
// found
206209
HPX_CXX_EXPORT HPX_CORE_EXPORT
207210
hpx::threads::policies::detail::polling_status
208211
poll();
@@ -238,9 +241,8 @@ namespace hpx::mpi::experimental {
238241
});
239242
}
240243

241-
// initialize the hpx::mpi background request handler
242-
// All ranks should call this function,
243-
// but only one thread per rank needs to do so
244+
// initialize the hpx::mpi background request handler All ranks should call
245+
// this function, but only one thread per rank needs to do so
244246
HPX_CXX_EXPORT HPX_CORE_EXPORT void init(bool init_mpi = false,
245247
std::string const& pool_name = "", bool init_errorhandler = false);
246248

libs/core/compute_local/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2022 The STE||AR-Group
1+
# Copyright (c) 2019-2025 The STE||AR-Group
22
#
33
# SPDX-License-Identifier: BSL-1.0
44
# Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -41,6 +41,7 @@ include(HPX_AddModule)
4141
add_hpx_module(
4242
core compute_local
4343
GLOBAL_HEADER_GEN ON
44+
GLOBAL_HEADER_MODULE_GEN ON
4445
SOURCES ${compute_local_sources}
4546
HEADERS ${compute_local_headers}
4647
COMPAT_HEADERS ${compute_local_compat_headers}

libs/core/compute_local/include/hpx/compute_local/detail/get_proxy_type.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414

1515
namespace hpx::compute::detail {
1616

17-
template <typename T, typename Enable = void>
17+
HPX_CXX_EXPORT template <typename T, typename Enable = void>
1818
struct get_proxy_type_impl
1919
{
2020
using type = T;
2121
};
2222

23-
template <typename T>
23+
HPX_CXX_EXPORT template <typename T>
2424
struct get_proxy_type_impl<T,
2525
std::void_t<typename std::decay_t<T>::proxy_type>>
2626
{
2727
using proxy_type = typename std::decay_t<T>::proxy_type;
2828
};
2929

30-
template <typename T, typename Enable = void>
30+
HPX_CXX_EXPORT template <typename T, typename Enable = void>
3131
struct get_proxy_type : get_proxy_type_impl<T>
3232
{
3333
};

libs/core/compute_local/include/hpx/compute_local/detail/iterator.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace hpx::compute::detail {
2020

21-
template <typename T, typename Allocator>
21+
HPX_CXX_EXPORT template <typename T, typename Allocator>
2222
struct iterator
2323
: hpx::util::iterator_adaptor<iterator<T, Allocator>,
2424
typename traits::allocator_traits<Allocator>::pointer,
@@ -78,12 +78,12 @@ namespace hpx::compute::detail {
7878
target_type const* target_;
7979
};
8080

81-
template <typename T, typename Allocator>
81+
HPX_CXX_EXPORT template <typename T, typename Allocator>
8282
struct reverse_iterator
8383
{
8484
};
8585

86-
template <typename T, typename Allocator>
86+
HPX_CXX_EXPORT template <typename T, typename Allocator>
8787
struct const_reverse_iterator
8888
{
8989
};

libs/core/compute_local/include/hpx/compute_local/host/block_allocator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace hpx::compute::host {
3434

3535
/// The policy_allocator allocates blocks of memory touched according to
3636
/// the distribution policy of the given executor.
37-
template <typename T, typename Policy,
37+
HPX_CXX_EXPORT template <typename T, typename Policy,
3838
typename Enable =
3939
std::enable_if_t<hpx::is_execution_policy_v<Policy>>>
4040
struct policy_allocator
@@ -253,7 +253,7 @@ namespace hpx::compute::host {
253253
/// std::size_t N = 2048;
254254
/// vector_type v(N, allocator_type(numa_nodes));
255255
///
256-
template <typename T,
256+
HPX_CXX_EXPORT template <typename T,
257257
typename Executor =
258258
hpx::execution::experimental::restricted_thread_pool_executor>
259259
struct block_allocator

libs/core/compute_local/include/hpx/compute_local/host/block_executor.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ namespace hpx::compute::host {
3131
/// It will distribute work evenly across the passed targets
3232
///
3333
/// \tparam Executor The underlying executor to use
34-
template <typename Executor =
35-
hpx::execution::experimental::restricted_thread_pool_executor>
34+
HPX_CXX_EXPORT template <
35+
typename Executor =
36+
hpx::execution::experimental::restricted_thread_pool_executor>
3637
struct block_executor
3738
{
3839
public:
@@ -319,31 +320,31 @@ namespace hpx::compute::host {
319320

320321
namespace hpx::execution::experimental {
321322

322-
template <typename Executor>
323+
HPX_CXX_EXPORT template <typename Executor>
323324
struct executor_execution_category<compute::host::block_executor<Executor>>
324325
{
325326
using type = hpx::execution::parallel_execution_tag;
326327
};
327328

328-
template <typename Executor>
329+
HPX_CXX_EXPORT template <typename Executor>
329330
struct is_one_way_executor<compute::host::block_executor<Executor>>
330331
: std::true_type
331332
{
332333
};
333334

334-
template <typename Executor>
335+
HPX_CXX_EXPORT template <typename Executor>
335336
struct is_two_way_executor<compute::host::block_executor<Executor>>
336337
: std::true_type
337338
{
338339
};
339340

340-
template <typename Executor>
341+
HPX_CXX_EXPORT template <typename Executor>
341342
struct is_bulk_one_way_executor<compute::host::block_executor<Executor>>
342343
: std::true_type
343344
{
344345
};
345346

346-
template <typename Executor>
347+
HPX_CXX_EXPORT template <typename Executor>
347348
struct is_bulk_two_way_executor<compute::host::block_executor<Executor>>
348349
: std::true_type
349350
{

libs/core/compute_local/include/hpx/compute_local/host/block_fork_join_executor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace hpx::execution::experimental {
5252
/// This behaviour is similar to the plain \a fork_join_executor except that
5353
/// the block_fork_join_executor creates a hierarchy of fork_join_executors,
5454
/// one for each target used to initialize it.
55-
class block_fork_join_executor
55+
HPX_CXX_EXPORT class block_fork_join_executor
5656
{
5757
static hpx::threads::mask_type cores_for_targets(
5858
std::vector<compute::host::target> const& targets)

libs/core/compute_local/include/hpx/compute_local/host/get_targets.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace hpx::compute::host {
1414

15-
struct HPX_CORE_EXPORT target;
15+
HPX_CXX_EXPORT struct HPX_CORE_EXPORT target;
1616

17-
HPX_CORE_EXPORT std::vector<target> get_local_targets();
17+
HPX_CXX_EXPORT HPX_CORE_EXPORT std::vector<target> get_local_targets();
1818
} // namespace hpx::compute::host

libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
namespace hpx::parallel::util {
3232

3333
///////////////////////////////////////////////////////////////////////////
34-
template <typename T, typename Executors>
34+
HPX_CXX_EXPORT template <typename T, typename Executors>
3535
class numa_allocator
3636
{
3737
using executor_type = typename Executors::value_type;

libs/core/compute_local/include/hpx/compute_local/host/numa_binding_allocator.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646

4747
namespace hpx {
4848

49-
static hpx::debug::enable_print<NUMA_BINDING_ALLOCATOR_DEBUG> nba_deb(
50-
"NUM_B_A");
51-
}
49+
HPX_CXX_EXPORT inline hpx::debug::enable_print<NUMA_BINDING_ALLOCATOR_DEBUG>
50+
nba_deb("NUM_B_A");
51+
} // namespace hpx
5252

5353
namespace hpx::execution::experimental {
5454

55-
struct numa_binding_allocator_tag
55+
HPX_CXX_EXPORT struct numa_binding_allocator_tag
5656
{
5757
};
5858

@@ -72,7 +72,7 @@ namespace hpx::execution::experimental {
7272

7373
namespace hpx::compute::host {
7474

75-
template <typename T>
75+
HPX_CXX_EXPORT template <typename T>
7676
struct numa_binding_helper
7777
{
7878
// After memory has been allocated, this operator will be called for
@@ -146,14 +146,14 @@ namespace hpx::compute::host {
146146
std::string pool_name_ = "default";
147147
};
148148

149-
template <typename T>
149+
HPX_CXX_EXPORT template <typename T>
150150
using numa_binding_helper_ptr = std::shared_ptr<numa_binding_helper<T>>;
151151

152152
/// The numa_binding_allocator allocates memory using a policy based on
153153
/// hwloc flags for memory binding. This allocator can be used to request
154154
/// data that is bound to one or more numa domains via the bitmap mask
155155
/// supplied
156-
template <typename T>
156+
HPX_CXX_EXPORT template <typename T>
157157
struct numa_binding_allocator
158158
{
159159
using value_type = T;

0 commit comments

Comments
 (0)