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.
-
namespace
hpx
-
namespace
compute
Functions
-
template<typename
T
, typenameAllocator
= std::allocator<T>>
classvector
¶ 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.
-
bool
empty
() const¶ Returns: size() == 0.
-
void
resize
(size_type)¶ 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, T const&)¶ 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.
-
void
clear
()¶ Effects: Erases all elements in the range [begin(),end()). Destroys all elements in a. Invalidates all references, pointers, and iterators referring to the elements of a and may invalidate the past-the-end iterator.
Post: a.empty() returns true.
Complexity: Linear.
-
typedef T
-
template<typename
-
namespace
-
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::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<>
usingexecutor_type
= block_executor<Executor>¶
-
template<>
usingexecutor_parameters_type
= typename executor_type::executor_parameters_type¶
-
template<>
usingpolicy_type
= hpx::execution::parallel_policy_shim<executor_type, executor_parameters_type>¶
-
template<>
usingbase_type
= detail::policy_allocator<T, policy_type>¶
-
template<>
-
template<typename
-
namespace
-
namespace
-
template<typename
Executor
>
structexecutor_execution_category
<compute::host::block_executor<Executor>>¶
-
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
-
template<>
usingexecutor_parameters_type
= hpx::execution::static_chunk_size¶
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
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
-
namespace
hpx
-
namespace
parallel
-
namespace
util
¶ -
template<typename
T
, typenameExecutors
>
classnuma_allocator
¶ 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
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
Typedefs
-
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 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)¶
Public Members
-
const typedef T* hpx::compute::host::numa_binding_allocator::const_pointer
-
threads::hpx_hwloc_membind_policy
policy_
¶
-
unsigned int
flags_
¶
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
¶
-
template<typename
-
namespace
-
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
struct
target
¶ Public Functions
-
target
()¶
-
native_handle_type &
native_handle
()¶
-
native_handle_type const &
native_handle
() const¶
-
void
synchronize
() const¶
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
-
template<>
structaccess_target
<host::target>¶ -
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const&, T const *t)¶
-
template<typename
T
>
static voidwrite
(target_type const&, T *dst, T const *src)¶
-
template<typename
-
template<>
structaccess_target
<std::vector<host::target>>¶ -
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const&, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const&, T *dst, T const *src)
-
template<typename
-
namespace
hpx
-
namespace
compute
-
namespace
traits
¶ -
template<>
structaccess_target
<host::target> -
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const&, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const&, T *dst, T const *src)
-
template<typename
-
template<>
structaccess_target
<std::vector<host::target>> -
Public Static Functions
-
template<typename
T
>
static T const &read
(target_type const&, T const *t)
-
template<typename
T
>
static voidwrite
(target_type const&, T *dst, T const *src)
-
template<typename
-
template<>
-
namespace
-
namespace
-
namespace
hpx
-
namespace
serialization
Functions
-
template<typename
T
, typenameAllocator
>
voidserialize
(input_archive &ar, compute::vector<T, Allocator> &v, unsigned)¶
-
template<typename
T
, typenameAllocator
>
voidserialize
(output_archive &ar, compute::vector<T, Allocator> const &v, unsigned)¶
-
template<typename
-
namespace
-
namespace
hpx
-
namespace
compute
-
namespace
traits
-
template<typename
Allocator
>
structallocator_traits
¶ Public Types
-
template<>
usingreference
= typename detail::get_reference_type<Allocator>::type¶
-
template<>
usingconst_reference
= typename detail::get_const_reference_type<Allocator>::type¶
-
template<>
usingaccess_target
= typename detail::get_target_traits<Allocator>::type¶
-
template<>
usingtarget_type
= typename access_target::target_type¶
-
template<>
-
template<typename
-
namespace
-
namespace