compute¶
The contents of this module can be included with the header
hpx/modules/compute.hpp
. These headers may be used by user-code but are not
guaranteed stable (neither header location nor contents). You are using these at
your own risk. If you wish to use non-public functionality from a module we
strongly suggest only including the module header hpx/modules/compute.hpp
, not
the particular header in which the functionality you would like to use is
defined. See Public API for a list of names that are part of the public
HPX API.
Header hpx/compute/host.hpp
¶
Header hpx/compute/host/block_allocator.hpp
¶
-
namespace
hpx
-
namespace
compute
¶ -
namespace
host
¶ -
template<typename
T
, typenameExecutor
= hpx::parallel::execution::restricted_thread_pool_executor>
structblock_allocator
: public hpx::compute::host::detail::policy_allocator<T, hpx::parallel::execution::parallel_policy_shim<block_executor<Executor>, block_executor<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<>
usingexecutor_type
= block_executor<Executor>¶
-
template<>
usingexecutor_parameters_type
= typename executor_type::executor_parameters_type¶
-
template<>
usingpolicy_type
= hpx::parallel::execution::parallel_policy_shim<executor_type, executor_parameters_type>¶
-
template<>
usingbase_type
= detail::policy_allocator<T, policy_type>¶
-
template<>
-
template<typename
-
namespace
-
namespace
Header hpx/compute/host/block_executor.hpp
¶
-
template<typename
Executor
>
structexecutor_execution_category
<compute::host::block_executor<Executor>>¶ - #include <block_executor.hpp>
Public Types
-
typedef parallel::execution::parallel_execution_tag
type
¶
-
typedef parallel::execution::parallel_execution_tag
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
template<typename
Executor
= hpx::parallel::execution::restricted_thread_pool_executor>
structblock_executor
¶ - #include <block_executor.hpp>
The block executor can be used to build NUMA aware programs. It will distribute work evenly across the passed targets
- Template Parameters
Executor
: The underlying executor to use
Public Types
-
typedef hpx::parallel::execution::static_chunk_size
executor_parameters_type
¶
Public Functions
-
block_executor
(std::vector<host::target> const &targets, threads::thread_priority priority = threads::thread_priority_high, threads::thread_stacksize stacksize = threads::thread_stacksize_default, threads::thread_schedule_hint schedulehint = {})¶
-
block_executor
(block_executor const &other)¶
-
block_executor
(block_executor &&other)¶
-
block_executor &
operator=
(block_executor const &other)¶
-
block_executor &
operator=
(block_executor &&other)¶
-
template<typename
F
, typename ...Ts
>
hpx::future<typename hpx::util::detail::invoke_deferred_result<F, Ts...>::type>async_execute
(F &&f, Ts&&... ts)¶
-
template<typename
F
, typename ...Ts
>
hpx::util::detail::invoke_deferred_result<F, Ts...>::typesync_execute
(F &&f, Ts&&... ts)¶
-
template<typename
F
, typenameShape
, typename ...Ts
>
std::vector<hpx::future<typename parallel::execution::detail::bulk_function_result<F, Shape, Ts...>::type>>bulk_async_execute
(F &&f, Shape const &shape, Ts&&... ts)¶
Private Functions
-
void
init_executors
()¶
Private Members
-
threads::thread_priority
priority_
= threads::thread_priority_high¶
-
threads::thread_stacksize
stacksize_
= threads::thread_stacksize_default¶
-
threads::thread_schedule_hint
schedulehint_
= {}¶
-
template<typename
-
namespace
-
namespace
Header hpx/compute/host/get_targets.hpp
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
Header hpx/compute/host/numa_allocator.hpp
¶
-
namespace
hpx
-
namespace
parallel
-
namespace
util
-
template<typename
T
, typenameExecutors
>
classnuma_allocator
¶ - #include <numa_allocator.hpp>
Public Types
-
typedef T
value_type
¶
-
typedef value_type *
pointer
¶
-
typedef value_type const *
const_pointer
¶
-
typedef value_type &
reference
¶
-
typedef value_type const &
const_reference
¶
Public Functions
-
numa_allocator
(numa_allocator const &rhs)¶
-
template<typename
U
>numa_allocator
(numa_allocator<U, Executors> const &rhs)¶
-
const_pointer
address
(const_reference r)¶
Private Types
-
typedef Executors::value_type
executor_type
¶
-
typedef T
-
template<typename
-
namespace
-
namespace
Header hpx/compute/host/numa_binding_allocator.hpp
¶
Defines
-
NUMA_BINDING_ALLOCATOR_DEBUG
¶
-
namespace
hpx
Functions
-
static hpx::debug::enable_print<NUMA_BINDING_ALLOCATOR_DEBUG> hpx::nba_deb("NUM_B_A")
-
namespace
compute
-
namespace
host
-
-
template<typename
T
>
structnuma_binding_allocator
¶ - #include <numa_binding_allocator.hpp>
The numa_binding_allocator allocates memory using a policy based on hwloc flags for memory binding. This allocator can be used to request data that is bound to one or more numa domains via the bitmap mask supplied
Public Types
-
typedef T
value_type
¶
-
typedef T *
pointer
¶
-
typedef const T *
const_pointer
¶
-
typedef T &
reference
¶
-
typedef T const &
const_reference
¶
Public Functions
-
numa_binding_allocator
()¶
-
numa_binding_allocator
(threads::hpx_hwloc_membind_policy policy, unsigned int flags)¶
-
numa_binding_allocator
(numa_binding_helper_ptr bind_func, threads::hpx_hwloc_membind_policy policy, unsigned int flags)¶
-
numa_binding_allocator
(numa_binding_allocator const &rhs)¶
-
template<typename
U
>numa_binding_allocator
(numa_binding_allocator<U> const &rhs)¶
-
numa_binding_allocator
(numa_binding_allocator &&rhs)¶
-
numa_binding_allocator &
operator=
(numa_binding_allocator const &rhs)¶
-
numa_binding_allocator &
operator=
(numa_binding_allocator &&rhs)¶
-
const_pointer
address
(const_reference x) const¶
-
int
get_numa_domain
(void *page)¶
-
std::string
display_binding
(pointer p, numa_binding_helper_ptr helper)¶
Protected Functions
-
std::vector<threads::hwloc_bitmap_ptr>
create_nodesets
(threads::hwloc_bitmap_ptr bitmap) const¶
-
void
touch_pages
(pointer p, size_t n, numa_binding_helper_ptr helper, size_type numa_domain, std::vector<threads::hwloc_bitmap_ptr> const &nodesets) const¶
-
void
bind_pages
(pointer p, size_t n, numa_binding_helper_ptr helper, size_type numa_domain, std::vector<threads::hwloc_bitmap_ptr> const &nodesets) const¶
-
typedef T
-
template<typename
T
>
structnuma_binding_helper
¶ - #include <numa_binding_allocator.hpp>
-
template<typename
-
namespace
-
Header hpx/compute/host/numa_domains.hpp
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
Header hpx/compute/host/target.hpp
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
struct
target
¶ - #include <target.hpp>
Public Functions
-
target
()¶
-
native_handle_type &
native_handle
()¶
-
native_handle_type const &
native_handle
() const¶
-
void
synchronize
() const¶
Public Static Functions
Private Functions
-
void
serialize
(serialization::input_archive &ar, const unsigned int)¶
-
void
serialize
(serialization::output_archive &ar, const unsigned int)¶
Private Members
-
native_handle_type
handle_
¶
Friends
-
friend
hpx::compute::host::hpx::serialization::access
-
bool
operator==
(target const &lhs, target const &rhs)
-
-
struct
-
namespace
-
namespace
Header hpx/compute/host/target_distribution_policy.hpp
¶
Header hpx/compute/host/traits/access_target.hpp
¶
-
template<>
structaccess_target
<host::target>¶ - #include <access_target.hpp>
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const &tgt, T const *t)¶
-
template<typename
T
>
static voidwrite
(target_type const &tgt, T *dst, T const *src)¶
-
template<typename
-
template<>
structaccess_target
<std::vector<host::target>>¶ - #include <access_target.hpp>
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const &tgt, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const &tgt, T *dst, T const *src)
-
template<typename
-
namespace
hpx
-
namespace
compute
-
namespace
traits
¶ -
template<>
structaccess_target
<host::target> - #include <access_target.hpp>
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const &tgt, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const &tgt, T *dst, T const *src)
-
template<typename
-
template<>
structaccess_target
<std::vector<host::target>> - #include <access_target.hpp>
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const &tgt, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const &tgt, T *dst, T const *src)
-
template<typename
-
template<>
-
namespace
-
namespace
Header hpx/compute/serialization/vector.hpp
¶
Header hpx/compute/traits.hpp
¶
Header hpx/compute/traits/access_target.hpp
¶
Header hpx/compute/traits/allocator_traits.hpp
¶
-
namespace
hpx
-
namespace
compute
-
namespace
traits
-
template<typename
Allocator
>
structallocator_traits
: public std::allocator_traits<Allocator>¶ - #include <allocator_traits.hpp>
Public Types
-
typedef detail::get_reference_type<Allocator>::type
reference
¶
-
typedef detail::get_const_reference_type<Allocator>::type
const_reference
¶
-
typedef detail::get_target_traits<Allocator>::type
access_target
¶
-
typedef access_target::target_type
target_type
¶
-
typedef detail::get_reference_type<Allocator>::type
-
template<typename
-
namespace
-
namespace
Header hpx/compute/vector.hpp
¶
-
namespace
hpx
-
namespace
compute
Functions
-
template<typename
T
, typenameAllocator
= std::allocator<T>>
classvector
¶ - #include <vector.hpp>
Public Types
-
typedef T
value_type
¶ Member types (FIXME: add reference to std.
-
typedef Allocator
allocator_type
¶
-
typedef alloc_traits::access_target
access_target
¶
-
typedef alloc_traits::reference
reference
¶
-
typedef alloc_traits::const_reference
const_reference
¶
-
typedef alloc_traits::pointer
pointer
¶
-
typedef alloc_traits::const_pointer
const_pointer
¶
-
typedef detail::iterator<T, Allocator>
iterator
¶
-
typedef detail::iterator<T const, Allocator>
const_iterator
¶
-
typedef detail::reverse_iterator<T, Allocator>
reverse_iterator
¶
-
typedef detail::const_reverse_iterator<T, Allocator>
const_reverse_iterator
¶
Public Functions
-
vector
(Allocator const &alloc = Allocator())¶
-
template<typename
InIter
, typenameEnable
= typename std::enable_if<hpx::traits::is_input_iterator<InIter>::value>::type>vector
(InIter first, InIter last, Allocator const &alloc)¶
-
~vector
()¶
-
vector &
operator=
(vector const &other)¶
-
vector &
operator=
(vector &&other)¶
-
allocator_type
get_allocator
() const¶ Returns the allocator associated with the container.
-
const_reference
operator[]
(size_type pos) const¶
-
pointer
data
()¶ Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
-
const_pointer
data
() const¶ Returns pointer to the underlying array serving as element storage. The pointer is such that range [data(); data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
-
T *
device_data
() const¶ Returns a raw pointer corresponding to the address of the data allocated on the device.
-
void
resize
(size_type size)¶ Effects: If size <= size(), equivalent to calling pop_back() size() - size times. If size() < size, appends size - size() default-inserted elements to the sequence.
Requires: T shall be MoveInsertable and DefaultInsertable into *this.
Remarks: If an exception is thrown other than by the move constructor of a non-CopyInsertable T there are no effects.
-
void
resize
(size_type size, T const &val)¶ Effects: If size <= size(), equivalent to calling pop_back() size() - size times. If size() < size, appends size - size() copies of val to the sequence.
Requires: T shall be CopyInsertable into *this.
Remarks: If an exception is thrown there are no effects.
-
const_iterator
cbegin
() const¶
-
const_iterator
cend
() const¶
-
const_iterator
begin
() const¶
-
const_iterator
end
() const¶
-
void
swap
(vector &other)¶ Effects: Exchanges the contents and capacity() of *this with that of x.
Complexity: Constant time.
-
typedef T
-
template<typename
-
namespace