hpx/compute/host/block_allocator.hpp

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace compute
namespace host
template<typename T, typename Executor = hpx::parallel::execution::restricted_thread_pool_executor>
struct block_allocator : public hpx::compute::host::detail::policy_allocator<T, hpx::execution::parallel_policy_shim<block_executor<hpx::parallel::execution::restricted_thread_pool_executor>, block_executor<hpx::parallel::execution::restricted_thread_pool_executor>::executor_parameters_type>>
#include <block_allocator.hpp>

The block_allocator allocates blocks of memory evenly divided onto the passed vector of targets. This is done by using first touch memory placement.

This allocator can be used to write NUMA aware algorithms:

using allocator_type = hpx::compute::host::block_allocator<int>; using vector_type = hpx::compute::vector<int, allocator_type>;

auto numa_nodes = hpx::compute::host::numa_domains(); std::size_t N = 2048; vector_type v(N, allocator_type(numa_nodes));

Public Types

template<>
using executor_type = block_executor<Executor>
template<>
using executor_parameters_type = typename executor_type::executor_parameters_type
template<>
using policy_type = hpx::execution::parallel_policy_shim<executor_type, executor_parameters_type>
template<>
using base_type = detail::policy_allocator<T, policy_type>
template<>
using target_type = std::vector<host::target>

Public Functions

block_allocator()
block_allocator(target_type const &targets)
block_allocator(target_type &&targets)
target_type const &target() const