distribution_policies

The contents of this module can be included with the header hpx/modules/distribution_policies.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/distribution_policies.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 components

Variables

constexpr char const *const default_binpacking_counter_name = "/runtime{locality/total}/count/component@"
const binpacking_distribution_policy binpacked = {}

A predefined instance of the binpacking distribution_policy. It will represent the local locality and will place all items to create here.

struct binpacking_distribution_policy
#include <binpacking_distribution_policy.hpp>

This class specifies the parameters for a binpacking distribution policy to use for creating a given number of items on a given set of localities. The binpacking policy will distribute the new objects in a way such that each of the localities will equalize the number of overall objects of this type based on a given criteria (by default this criteria is the overall number of objects of this type).

Public Functions

binpacking_distribution_policy()

Default-construct a new instance of a binpacking_distribution_policy. This policy will represent one locality (the local locality).

binpacking_distribution_policy operator()(std::vector<id_type> const &locs, char const *perf_counter_name = default_binpacking_counter_name) const

Create a new default_distribution policy representing the given set of localities.

Parameters
  • locs: [in] The list of localities the new instance should represent

  • perf_counter_name: [in] The name of the performance counter which should be used as the distribution criteria (by default the overall number of existing instances of the given component type will be used).

binpacking_distribution_policy operator()(std::vector<id_type> &&locs, char const *perf_counter_name = default_binpacking_counter_name) const

Create a new default_distribution policy representing the given set of localities.

Parameters
  • locs: [in] The list of localities the new instance should represent

  • perf_counter_name: [in] The name of the performance counter which should be used as the distribution criteria (by default the overall number of existing instances of the given component type will be used).

binpacking_distribution_policy operator()(id_type const &loc, char const *perf_counter_name = default_binpacking_counter_name) const

Create a new default_distribution policy representing the given locality

Parameters
  • loc: [in] The locality the new instance should represent

  • perf_counter_name: [in] The name of the performance counter that should be used as the distribution criteria (by default the overall number of existing instances of the given component type will be used).

template<typename Component, typename ...Ts>
hpx::future<hpx::id_type> create(Ts&&... vs) const

Create one object on one of the localities associated by this policy instance

Return

A future holding the global address which represents the newly created object

Parameters
  • vs: [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&&... vs) const

Create multiple objects on the localities associated by this policy instance

Return

A future holding the list of global addresses which represent the newly created objects

Parameters
  • count: [in] The number of objects to create

  • vs: [in] The arguments which will be forwarded to the constructors of the new objects.

std::string const &get_counter_name() const

Returns the name of the performance counter associated with this policy instance.

std::size_t get_num_localities() const

Returns the number of associated localities for this distribution policy

Note

This function is part of the creation policy implemented by this class

namespace hpx
namespace components

Variables

const colocating_distribution_policy colocated = {}

A predefined instance of the co-locating distribution_policy. It will represent the local locality and will place all items to create here.

struct colocating_distribution_policy
#include <colocating_distribution_policy.hpp>

This class specifies the parameters for a distribution policy to use for creating a given number of items on the locality where a given object is currently placed.

Public Functions

colocating_distribution_policy()

Default-construct a new instance of a colocating_distribution_policy. This policy will represent the local locality.

colocating_distribution_policy operator()(id_type const &id) const

Create a new colocating_distribution_policy representing the locality where the given object is current located

Parameters
  • id: [in] The global address of the object with which the new instances should be colocated on

template<typename Client, typename Stub>
colocating_distribution_policy operator()(client_base<Client, Stub> const &client) const

Create a new colocating_distribution_policy representing the locality where the given object is current located

Parameters
  • client: [in] The client side representation of the object with which the new instances should be colocated on

template<typename Component, typename ...Ts>
hpx::future<hpx::id_type> create(Ts&&... vs) const

Create one object on the locality of the object this distribution policy instance is associated with

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
  • vs: [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&&... vs) const

Create multiple objects colocated with the object represented 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 create

  • vs: [in] The arguments which will be forwarded to the constructors of the new objects.

template<typename Action, typename ...Ts>
async_result<Action>::type async(launch policy, Ts&&... vs) const
template<typename Action, typename Callback, typename ...Ts>
async_result<Action>::type async_cb(launch policy, Callback &&cb, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename Continuation, typename ...Ts>
bool apply(Continuation &&c, threads::thread_priority priority, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename ...Ts>
bool apply(threads::thread_priority priority, Ts&&... vs) const
template<typename Action, typename Continuation, typename Callback, typename ...Ts>
bool apply_cb(Continuation &&c, threads::thread_priority priority, Callback &&cb, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename Callback, typename ...Ts>
bool apply_cb(threads::thread_priority priority, Callback &&cb, Ts&&... vs) const
std::size_t get_num_localities() const

Returns the number of associated localities for this distribution policy

Note

This function is part of the creation policy implemented by this class

hpx::id_type get_next_target() const

Returns the locality which is anticipated to be used for the next async operation

template<typename Action>
struct async_result
#include <colocating_distribution_policy.hpp>

Note

This function is part of the invocation policy implemented by this class

Public Types

template<>
using type = hpx::future<typename traits::promise_local_result<typename hpx::traits::extract_action<Action>::remote_result_type>::type>
namespace hpx

Variables

const container_distribution_policy container_layout = {}
struct container_distribution_policy : public default_distribution_policy

Public Functions

container_distribution_policy()
container_distribution_policy operator()(std::size_t num_partitions) const
container_distribution_policy operator()(hpx::id_type const &locality) const
container_distribution_policy operator()(std::vector<id_type> const &localities) const
container_distribution_policy operator()(std::vector<id_type> &&localities) const
container_distribution_policy operator()(std::size_t num_partitions, std::vector<id_type> const &localities) const
container_distribution_policy operator()(std::size_t num_partitions, std::vector<id_type> &&localities) const
std::size_t get_num_partitions() const
std::vector<hpx::id_type> get_localities() const

Private Functions

template<typename Archive>
void serialize(Archive &ar, const unsigned int)
container_distribution_policy(std::size_t num_partitions, std::vector<id_type> const &localities)
container_distribution_policy(std::size_t num_partitions, std::vector<id_type> &&localities)
container_distribution_policy(hpx::id_type const &locality)

Private Members

std::size_t num_partitions_

Friends

friend hpx::hpx::serialization::access
namespace traits
template<>
struct num_container_partitions<container_distribution_policy>

Public Static Functions

static std::size_t call(container_distribution_policy const &policy)
namespace hpx
namespace components

Variables

const target_distribution_policy target = {}

A predefined instance of the target_distribution_policy. It will represent the local locality and will place all items to create here.

struct target_distribution_policy
#include <target_distribution_policy.hpp>

This class specifies the parameters for a simple distribution policy to use for creating (and evenly distributing) a given number of items on a given set of localities.

Public Functions

target_distribution_policy()

Default-construct a new instance of a target_distribution_policy. This policy will represent one locality (the local locality).

target_distribution_policy operator()(id_type const &id) const

Create a new target_distribution_policy representing the given locality

Parameters
  • loc: [in] The locality the new instance should represent

template<typename Component, typename ...Ts>
hpx::future<hpx::id_type> create(Ts&&... vs) 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
  • vs: [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&&... vs) 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 create

  • vs: [in] The arguments which will be forwarded to the constructors of the new objects.

template<typename Action, typename ...Ts>
async_result<Action>::type async(launch policy, Ts&&... vs) const
template<typename Action, typename Callback, typename ...Ts>
async_result<Action>::type async_cb(launch policy, Callback &&cb, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename Continuation, typename ...Ts>
bool apply(Continuation &&c, threads::thread_priority priority, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename ...Ts>
bool apply(threads::thread_priority priority, Ts&&... vs) const
template<typename Action, typename Continuation, typename Callback, typename ...Ts>
bool apply_cb(Continuation &&c, threads::thread_priority priority, Callback &&cb, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename Callback, typename ...Ts>
bool apply_cb(threads::thread_priority priority, Callback &&cb, Ts&&... vs) const
std::size_t get_num_localities() const

Returns the number of associated localities for this distribution policy

Note

This function is part of the creation policy implemented by this class

hpx::id_type get_next_target() const

Returns the locality which is anticipated to be used for the next async operation

template<typename Action>
struct async_result
#include <target_distribution_policy.hpp>

Note

This function is part of the invocation policy implemented by this class

Public Types

template<>
using type = hpx::future<typename traits::promise_local_result<typename hpx::traits::extract_action<Action>::remote_result_type>::type>
namespace hpx
namespace components
struct unwrapping_result_policy
#include <unwrapping_result_policy.hpp>

This class is a distribution policy that can be using with actions that return futures. For those actions it is possible to apply certain optimizations if the action is invoked synchronously.

Public Functions

unwrapping_result_policy(id_type const &id)
template<typename Client, typename Stub>
unwrapping_result_policy(client_base<Client, Stub> const &client)
template<typename Action, typename ...Ts>
async_result<Action>::type async(launch policy, Ts&&... vs) const
template<typename Action, typename ...Ts>
async_result<Action>::type async(launch::sync_policy, Ts&&... vs) const
template<typename Action, typename Callback, typename ...Ts>
async_result<Action>::type async_cb(launch policy, Callback &&cb, Ts&&... vs) const
template<typename Action, typename Continuation, typename ...Ts>
bool apply(Continuation &&c, threads::thread_priority priority, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename ...Ts>
bool apply(threads::thread_priority priority, Ts&&... vs) const
template<typename Action, typename Continuation, typename Callback, typename ...Ts>
bool apply_cb(Continuation &&c, threads::thread_priority priority, Callback &&cb, Ts&&... vs) const

Note

This function is part of the invocation policy implemented by this class

template<typename Action, typename Callback, typename ...Ts>
bool apply_cb(threads::thread_priority priority, Callback &&cb, Ts&&... vs) const
hpx::id_type const &get_next_target() const
template<typename Action>
struct async_result

Public Types

template<>
using type = typename traits::promise_local_result::type