CPPuddle
Loading...
Searching...
No Matches
kernel_aggregation_interface.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Gregor Daiß
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef KERNEL_AGGREGATION_INTERFACE_HPP
7#define KERNEL_AGGREGATION_INTERFACE_HPP
8
12
15
16namespace cppuddle {
18namespace kernel_aggregation {
19
27
30template <typename T, typename Host_Allocator, typename Executor>
33
37template <typename Executor>
40
42template <const char *kernelname, class Interface, class Pool>
45 Pool>;
46
48template <const char* region_name, typename executor_t, typename return_type>
49hpx::future<return_type> aggregation_region(const size_t team_size,
50 std::function<return_type(size_t, size_t,
52 executor_t>::executor_slice&)> &&aggregation_area) {
53 using aggregation_pool_t = cppuddle::kernel_aggregation::aggregation_pool<region_name,
55 static hpx::once_flag pool_init;
56 hpx::call_once(pool_init,
58 auto executor_slice_fut = aggregation_pool_t::request_executor_slice();
59 auto ret_fut = executor_slice_fut.value().then(hpx::annotated_function(
60 [aggregation_area](auto &&fut) {
62 executor_t>::Executor_Slice agg_exec = fut.get();
63 const size_t slice_id = agg_exec.id;
64 const size_t number_slices = agg_exec.number_slices;
65 return aggregation_area(slice_id, number_slices, agg_exec);
66 },
67 region_name));
68 return ret_fut;
69}
70
71} // namespace kernel_aggregation
72} // namespace cppuddle
73
74#endif
Definition executor_pools_management.hpp:54
Executor Class that aggregates function calls for specific kernels.
Definition aggregation_executors_and_allocators.hpp:394
Definition aggregation_executor_pools.hpp:16
Declaration since the actual allocator is only defined after the Executors.
Definition aggregation_executors_and_allocators.hpp:993
void init_area_aggregation_pool(const size_t max_slices)
Definition aggregation_executor_pools.hpp:131
aggregated_executor_modes
Definition aggregation_executors_and_allocators.hpp:383
hpx::future< return_type > aggregation_region(const size_t team_size, std::function< return_type(size_t, size_t, typename cppuddle::kernel_aggregation::detail::aggregated_executor< executor_t >::executor_slice &)> &&aggregation_area)
Start an aggregation region (passsed via lambda)
Definition kernel_aggregation_interface.hpp:49
Definition config.hpp:31