compute¶
#include <hpx/compute/host.hpp>
¶
#include <hpx/compute/traits.hpp>
¶
#include <hpx/compute/vector.hpp>
¶
-
namespace
hpx
-
namespace
compute
¶ Functions
-
template <typename T, typename Allocator = 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, typename Enable = typename std::enable_if< hpx::traits::is_input_iterator<InIter>::value>::type>
vector
(InIter first, InIter last, Allocator const &alloc)¶
-
~vector
()¶
-
allocator_type
get_allocator
() const¶ Returns the allocator associated with the container.
-
HPX_HOST_DEVICE reference hpx::compute::vector::operator[](size_type pos)
-
HPX_HOST_DEVICE const_reference hpx::compute::vector::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 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.
-
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.
Private Types
-
typedef traits::allocator_traits<Allocator>
alloc_traits
¶
-
typedef T
-
template <typename T, typename Allocator = std::allocator<T>>
-
namespace
#include <hpx/compute/host/default_executor.hpp>
¶
-
template <>
template<>
structexecutor_execution_category
<compute::host::default_executor>¶ Public Types
-
typedef parallel::execution::parallel_execution_tag
type
¶
-
typedef parallel::execution::parallel_execution_tag
-
namespace
hpx
-
namespace
compute
-
namespace
host
¶ -
struct
default_executor
¶ Public Functions
-
template <typename F, typename... Ts>
voidpost
(F &&f, Ts&&... ts)¶
Public Static Functions
-
template <typename F, typename... Ts>
static voidsync_execute
(F &&f, Ts&&... ts)¶
-
template <typename F, typename Shape, typename... Ts>
static std::vector<hpx::future<void>>bulk_async_execute
(F &&f, Shape const &shape, Ts&&... ts)¶
-
template <typename F, typename Shape, typename... Ts>
static voidbulk_sync_execute
(F &&f, Shape const &shape, Ts&&... ts)¶
-
template <typename F, typename... Ts>
-
struct
-
namespace
-
namespace
parallel
-
namespace
execution
¶ -
template <>
template<>
structexecutor_execution_category
<compute::host::default_executor> Public Types
-
typedef parallel::execution::parallel_execution_tag
type
-
typedef parallel::execution::parallel_execution_tag
-
template <>
-
namespace
-
namespace
#include <hpx/compute/host/numa_domains.hpp>
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
#include <hpx/compute/host/block_allocator.hpp>
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
template <typename T, typename Executor = hpx::parallel::execution::local_priority_queue_attached_executor>
structblock_allocator
¶ - #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. (maybe better methods will be used in the future…);
This allocator can be used to write NUMA aware algorithms:
typedef hpx::compute::host::block_allocator<int> allocator_type; typedef hpx::compute::vector<int, allocator_type> vector_type;
auto numa_nodes = hpx::compute::host::numa_domains(); std::size_t N = 2048; vector_type v(N, allocator_type(numa_nodes));
Public Types
-
typedef T
value_type
¶
-
typedef T *
pointer
¶
-
typedef const T *
const_pointer
¶
-
typedef T &
reference
¶
-
typedef T const &
const_reference
¶
-
typedef Executor
executor_type
¶
Public Functions
-
block_allocator
()¶
-
block_allocator
(target_type const &targets)¶
-
block_allocator
(target_type &&targets)¶
-
block_allocator
(block_allocator const &alloc)¶
-
block_allocator
(block_allocator &&alloc)¶
-
template <typename U>
block_allocator
(block_allocator<U> const &alloc)¶
-
template <typename U>
block_allocator
(block_allocator<U> &&alloc)¶
-
block_allocator &
operator=
(block_allocator const &rhs)¶
-
block_allocator &
operator=
(block_allocator &&rhs)¶
-
const_pointer
address
(const_reference x) const¶
-
template <typename U, typename... Args>
voidbulk_construct
(U *p, std::size_t count, Args&&... args)¶
-
template <typename U, typename... Args>
voidconstruct
(U *p, Args&&... args)¶
-
template <typename U>
voiddestroy
(U *p)¶
-
target_type const &
target
() const¶
Private Members
-
block_executor<executor_type>
executor_
¶
-
typedef T
-
template <typename T, typename Executor = hpx::parallel::execution::local_priority_queue_attached_executor>
-
namespace
-
namespace
#include <hpx/compute/host/target.hpp>
¶
-
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¶
Public Static Functions
Private Functions
-
void
serialize
(serialization::input_archive &ar, const unsigned int)¶
-
void
serialize
(serialization::output_archive &ar, const unsigned int)¶
Friends
-
friend
hpx::compute::host::hpx::serialization::access
-
bool
operator==
(target const &lhs, target const &rhs)¶
-
-
struct
-
namespace
-
namespace
#include <hpx/compute/host/target_distribution_policy.hpp>
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
Variables
-
target_distribution_policy const
target_layout
¶ A predefined instance of the target_distribution_policy for localities. It will represent all NUMA domains of the given locality and will place all items to create here.
-
struct
target_distribution_policy
: public compute::detail::target_distribution_policy<host::target>¶ - #include <target_distribution_policy.hpp>
A target_distribution_policy used for CPU bound localities.
Public Functions
-
target_distribution_policy
()¶ Default-construct a new instance of a target_distribution_policy. This policy will represent all devices on the current locality.
-
target_distribution_policy
operator()
(std::vector<target_type> const &targets, std::size_t num_partitions = std::size_t(-1)) const¶ Create a new target_distribution_policy representing the given set of targets
- Parameters
targets
: [in] The targets the new instances should represent
-
target_distribution_policy
operator()
(std::vector<target_type> &&targets, std::size_t num_partitions = std::size_t(-1)) const¶ Create a new target_distribution_policy representing the given set of targets
- Parameters
targets
: [in] The targets the new instances should represent
-
target_distribution_policy
operator()
(target_type const &target, std::size_t num_partitions = 1) const¶ Create a new target_distribution_policy representing the given target
- Parameters
target
: [in] The target the new instances should represent
-
target_distribution_policy
operator()
(target_type &&target, std::size_t num_partitions = 1) const¶ Create a new target_distribution_policy representing the given target
- Parameters
target
: [in] The target the new instances should represent
-
template <typename Component, typename... Ts>
hpx::future<hpx::id_type>create
(Ts&&... ts) const¶ Create one object on one of the localities associated by this policy instance
- Note
- This function is part of the placement policy implemented by this class
- Return
- A future holding the global address which represents the newly created object
- Parameters
ts
: [in] The arguments which will be forwarded to the constructor of the new object.
-
template <typename Component, typename... Ts>
hpx::future<std::vector<bulk_locality_result>>bulk_create
(std::size_t count, Ts&&... ts) const¶ Create multiple objects on the localities associated by this policy instance
- Note
- This function is part of the placement policy implemented by this class
- Return
- A future holding the list of global addresses which represent the newly created objects
- Parameters
count
: [in] The number of objects to createvs
: [in] The arguments which will be forwarded to the constructors of the new objects.
-
-
target_distribution_policy const
-
namespace
-
namespace
#include <hpx/compute/host/get_targets.hpp>
¶
-
namespace
hpx
-
namespace
compute
-
namespace
host
-
namespace
-
namespace
#include <hpx/compute/host/block_executor.hpp>
¶
-
template <typename Executor>
template<>
structexecutor_execution_category
<compute::host::block_executor<Executor>>¶ 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::threads::executors::local_priority_queue_attached_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
(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>
voidpost
(F &&f, Ts&&... ts)¶
-
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, typename Shape, 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
()¶
-
template <typename Executor = hpx::threads::executors::local_priority_queue_attached_executor>
-
namespace
-
namespace
parallel
-
namespace
execution
-
template <typename Executor>
template<>
structexecutor_execution_category
<compute::host::block_executor<Executor>> Public Types
-
typedef parallel::execution::parallel_execution_tag
type
-
typedef parallel::execution::parallel_execution_tag
-
template <typename Executor>
-
namespace
-
namespace
#include <hpx/compute/host/traits/access_target.hpp>
¶
-
template <>
template<>
structaccess_target
<host::target>¶ -
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 T>
-
template <>
template<>
structaccess_target
<std::vector<host::target>>¶ -
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 T>
-
namespace
hpx
-
namespace
compute
-
namespace
traits
¶ -
template <>
template<>
structaccess_target
<host::target> -
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 T>
-
template <>
template<>
structaccess_target
<std::vector<host::target>> -
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 T>
-
template <>
-
namespace
-
namespace
#include <hpx/compute/traits/access_target.hpp>
¶
#include <hpx/compute/traits/allocator_traits.hpp>
¶
-
namespace
hpx
-
namespace
compute
-
namespace
traits
-
template <typename Allocator>
structallocator_traits
: public std::allocator_traits<Allocator>¶ 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
¶
Public Static Functions
-
static HPX_HOST_DEVICE auto hpx::compute::traits::allocator_traits::target(Allocator const & alloc)
- template <typename… Ts>
-
static HPX_HOST_DEVICE void hpx::compute::traits::allocator_traits::bulk_construct(Allocator & alloc, pointer p, size_type count, Ts &&... vs)
-
static HPX_HOST_DEVICE void hpx::compute::traits::allocator_traits::bulk_destroy(Allocator & alloc, pointer p, size_type count)
-
typedef detail::get_reference_type<Allocator>::type
-
template <typename Allocator>
-
namespace
-
namespace
#include <hpx/compute/serialization/vector.hpp>
¶
-
namespace
hpx
-
namespace
serialization
¶ Functions
-
template <typename T, typename Allocator>
voidserialize
(input_archive &ar, compute::vector<T, Allocator> &v, unsigned)¶
-
template <typename T, typename Allocator>
voidserialize
(output_archive &ar, compute::vector<T, Allocator> const &v, unsigned)¶
-
template <typename T, typename Allocator>
-
namespace