runtime_components

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

Defines

HPX_REGISTER_COMPONENT(type, name, mode)

Define a component factory for a component type.

This macro is used create and to register a minimal component factory for a component type which allows it to be remotely created using the hpx::new_<> function.

This macro can be invoked with one, two or three arguments

Parameters
  • type: The type parameter is a (fully decorated) type of the component type for which a factory should be defined.

  • name: The name parameter specifies the name to use to register the factory. This should uniquely (system-wide) identify the component type. The name parameter must conform to the C++ identifier rules (without any namespace). If this parameter is not given, the first parameter is used.

  • mode: The mode parameter has to be one of the defined enumeration values of the enumeration hpx::components::factory_state_enum. The default for this parameter is hpx::components::factory_enabled.

Defines

HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY(...)

This macro is used create and to register a minimal component registry with Hpx.Plugin.

HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_(...)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_2(ComponentType, componentname)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_3(ComponentType, componentname, state)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_DYNAMIC(...)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_DYNAMIC_(...)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_DYNAMIC_2(ComponentType, componentname)
HPX_REGISTER_MINIMAL_COMPONENT_REGISTRY_DYNAMIC_3(ComponentType, componentname, state)
namespace hpx
namespace components
template<typename Component, factory_state_enum state>
struct component_registry : public component_registry_base
#include <component_registry.hpp>

The component_registry provides a minimal implementation of a component’s registry. If no additional functionality is required this type can be used to implement the full set of minimally required functions to be exposed by a component’s registry instance.

Template Parameters
  • Component: The component type this registry should be responsible for.

Public Functions

bool get_component_info(std::vector<std::string> &fillini, std::string const &filepath, bool is_static = false)

Return the ini-information for all contained components.

Return

Returns true if the parameter fillini has been successfully initialized with the registry data of all implemented in this module.

Parameters
  • fillini: [in] The module is expected to fill this vector with the ini-information (one line per vector element) for all components implemented in this module.

void register_component_type()

Return the unique identifier of the component type this factory is responsible for.

Return

Returns the unique identifier of the component type this factory instance is responsible for. This function throws on any error.

Parameters
  • locality: [in] The id of the locality this factory is responsible for.

  • agas_client: [in] The AGAS client to use for component id registration (if needed).

namespace hpx

Functions

components::server::runtime_support *get_runtime_support_ptr()
namespace hpx
namespace components

Functions

void console_error_sink(naming::id_type const &dst, std::exception_ptr const &e)
void console_error_sink(std::exception_ptr const &e)
namespace hpx
namespace components

Functions

void console_logging(logging_destination dest, std::size_t level, std::string const &msg)
void cleanup_logging()
void activate_logging()
namespace hpx
namespace components

Functions

template<typename Component, typename ...Ts>
future<naming::id_type> create_async(naming::id_type const &gid, Ts&&... vs)

Asynchronously create a new instance of a component.

template<typename Component, typename ...Ts>
future<std::vector<naming::id_type>> bulk_create_async(naming::id_type const &gid, std::size_t count, Ts&&... vs)
template<typename Component, typename ...Ts>
naming::id_type create(naming::id_type const &gid, Ts&&... vs)
template<typename Component, typename ...Ts>
std::vector<naming::id_type> bulk_create(naming::id_type const &gid, std::size_t count, Ts&&... vs)
template<typename Component, typename ...Ts>
future<naming::id_type> create_colocated_async(naming::id_type const &gid, Ts&&... vs)
template<typename Component, typename ...Ts>
static naming::id_type create_colocated(naming::id_type const &gid, Ts&&... vs)
template<typename Component, typename ...Ts>
static future<std::vector<naming::id_type>> bulk_create_colocated_async(naming::id_type const &gid, std::size_t count, Ts&&... vs)
template<typename Component, typename ...Ts>
std::vector<naming::id_type> bulk_create_colocated(naming::id_type const &id, std::size_t count, Ts&&... vs)
namespace hpx
namespace components

Variables

const default_distribution_policy default_layout = {}

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

struct default_distribution_policy
#include <default_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

constexpr default_distribution_policy()

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

default_distribution_policy operator()(std::vector<id_type> const &locs) 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

default_distribution_policy operator()(std::vector<id_type> &&locs) 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

default_distribution_policy operator()(id_type const &loc) const

Create a new default_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 <default_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>

Defines

HPX_REGISTER_DERIVED_COMPONENT_FACTORY(...)

This macro is used create and to register a minimal component factory with Hpx.Plugin. This macro may be used if the registered component factory is the only factory to be exposed from a particular module. If more than one factory needs to be exposed the HPX_REGISTER_COMPONENT_FACTORY and HPX_REGISTER_COMPONENT_MODULE macros should be used instead.

HPX_REGISTER_DERIVED_COMPONENT_FACTORY_(...)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_3(ComponentType, componentname, basecomponentname)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_4(ComponentType, componentname, basecomponentname, state)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_DYNAMIC(...)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_DYNAMIC_(...)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_DYNAMIC_3(ComponentType, componentname, basecomponentname)
HPX_REGISTER_DERIVED_COMPONENT_FACTORY_DYNAMIC_4(ComponentType, componentname, basecomponentname, state)

Defines

HPX_DISTRIBUTED_METADATA_DECLARATION(...)
HPX_DISTRIBUTED_METADATA_DECLARATION_(...)
HPX_DISTRIBUTED_METADATA_DECLARATION_1(config)
HPX_DISTRIBUTED_METADATA_DECLARATION_2(config, name)
HPX_DISTRIBUTED_METADATA(...)
HPX_DISTRIBUTED_METADATA_(...)
HPX_DISTRIBUTED_METADATA_1(config)
HPX_DISTRIBUTED_METADATA_2(config, name)
namespace hpx
namespace components
namespace server
template<typename ConfigData, typename Derived = detail::this_type>
class distributed_metadata_base : public hpx::components::component_base<std::conditional<std::is_same<detail::this_type, detail::this_type>::value, distributed_metadata_base<ConfigData, detail::this_type>, detail::this_type>::type>

Public Functions

distributed_metadata_base()
distributed_metadata_base(ConfigData const &data)
ConfigData get() const

Retrieve the configuration data.

HPX_DEFINE_COMPONENT_DIRECT_ACTION(distributed_metadata_base, get)

Private Members

ConfigData data_
namespace hpx

Functions

template<typename Component, typename... Ts><unspecified> hpx::new_(id_type const & locality, Ts &&... vs)

Create one or more new instances of the given Component type on the specified locality.

This function creates one or more new instances of the given Component type on the specified locality and returns a future object for the global address which can be used to reference the new component instance.

Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<hpx::id_type> f =
   hpx::new_<some_component>(hpx::find_here(), ...);
hpx::id_type id = f.get();

Return

The function returns different types depending on its use:

  • If the explicit template argument Component represents a component type (traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which can be used to retrieve the global address of the newly created component.

  • If the explicit template argument Component represents a client side object (traits::is_client<Component>::value evaluates to true), the function will return a new instance of that type which can be used to refer to the newly created component instance.

Parameters
  • locality: [in] The global address of the locality where the new instance should be created on.

  • vs: [in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

template<typename Component, typename... Ts><unspecified> hpx::local_new(Ts &&... vs)

Create one new instance of the given Component type on the current locality.

This function creates one new instance of the given Component type on the current locality and returns a future object for the global address which can be used to reference the new component instance.

Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<hpx::id_type> f =
   hpx::local_new<some_component>(...);
hpx::id_type id = f.get();

Return

The function returns different types depending on its use:

  • If the explicit template argument Component represents a component type (traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which can be used to retrieve the global address of the newly created component. If the first argument is hpx::launch::sync the function will directly return an hpx::id_type.

  • If the explicit template argument Component represents a client side object (traits::is_client<Component>::value evaluates to true), the function will return a new instance of that type which can be used to refer to the newly created component instance.

Note

The difference of this function to hpx::new_ is that it can be used in cases where the supplied arguments are non-copyable and non-movable. All operations are guaranteed to be local only.

Parameters
  • vs: [in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

template<typename Component, typename... Ts><unspecified> hpx::new_(id_type const & locality, std::size_t count, Ts &&... vs)

Create multiple new instances of the given Component type on the specified locality.

This function creates multiple new instances of the given Component type on the specified locality and returns a future object for the global address which can be used to reference the new component instance.

Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<std::vector<hpx::id_type> > f =
   hpx::new_<some_component[]>(hpx::find_here(), 10, ...);
hpx::id_type id = f.get();

Return

The function returns different types depending on its use:

  • If the explicit template argument Component represents an array of a component type (i.e. Component[], where traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which holds a std::vector<hpx::id_type>, where each of the items in this vector is a global address of one of the newly created components.

  • If the explicit template argument Component represents an array of a client side object type (i.e. Component[], where traits::is_client<Component>::value evaluates to true), the function will return an hpx::future object instance which holds a std::vector<hpx::id_type>, where each of the items in this vector is a client side instance of the given type, each representing one of the newly created components.

Parameters
  • locality: [in] The global address of the locality where the new instance should be created on.

  • count: [in] The number of component instances to create

  • vs: [in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

template<typename Component, typename DistPolicy, typename... Ts><unspecified> hpx::new_(DistPolicy const & policy, Ts &&... vs)

Create one or more new instances of the given Component type based on the given distribution policy.

This function creates one or more new instances of the given Component type on the localities defined by the given distribution policy and returns a future object for global address which can be used to reference the new component instance(s).

Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<hpx::id_type> f =
   hpx::new_<some_component>(hpx::default_layout, ...);
hpx::id_type id = f.get();

Return

The function returns different types depending on its use:

  • If the explicit template argument Component represents a component type (traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which can be used to retrieve the global address of the newly created component.

  • If the explicit template argument Component represents a client side object (traits::is_client<Component>::value evaluates to true), the function will return a new instance of that type which can be used to refer to the newly created component instance.

Parameters
  • policy: [in] The distribution policy used to decide where to place the newly created.

  • vs: [in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

template<typename Component, typename DistPolicy, typename... Ts><unspecified> hpx::new_(DistPolicy const & policy, std::size_t count, Ts &&... vs)

Create multiple new instances of the given Component type on the localities as defined by the given distribution policy.

This function creates multiple new instances of the given Component type on the localities defined by the given distribution policy and returns a future object for the global address which can be used to reference the new component instance.

Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<std::vector<hpx::id_type> > f =
   hpx::new_<some_component[]>(hpx::default_layout, 10, ...);
hpx::id_type id = f.get();

Return

The function returns different types depending on its use:

  • If the explicit template argument Component represents an array of a component type (i.e. Component[], where traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which holds a std::vector<hpx::id_type>, where each of the items in this vector is a global address of one of the newly created components.

  • If the explicit template argument Component represents an array of a client side object type (i.e. Component[], where traits::is_client<Component>::value evaluates to true), the function will return an hpx::future object instance which holds a std::vector<hpx::id_type>, where each of the items in this vector is a client side instance of the given type, each representing one of the newly created components.

Parameters
  • policy: [in] The distribution policy used to decide where to place the newly created.

  • count: [in] The number of component instances to create

  • vs: [in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

namespace hpx
namespace components
namespace server

Functions

void console_error_sink(std::exception_ptr const&)
HPX_DEFINE_PLAIN_ACTION(console_error_sink, console_error_sink_action)
namespace hpx
namespace components
namespace server

Functions

console_error_dispatcher &get_error_dispatcher()
class console_error_dispatcher

Public Types

typedef util::spinlock mutex_type
typedef util::function_nonser<void(std::string const&)> sink_type

Public Functions

HPX_NON_COPYABLE(console_error_dispatcher)
console_error_dispatcher()
template<typename F>
sink_type set_error_sink(F &&sink)
void operator()(std::string const &msg)

Private Members

mutex_type mtx_
sink_type sink_
namespace hpx
namespace components

Typedefs

typedef hpx::tuple<logging_destination, std::size_t, std::string> message_type
typedef std::vector<message_type> messages_type
namespace server

Functions

void console_logging(messages_type const&)
template<typename Dummy = void>
class console_logging_action : public actions::direct_action<void (*)(messages_type const&), console_logging, console_logging_action<void>>

Public Functions

console_logging_action()
console_logging_action(messages_type const &msgs)
console_logging_action(threads::thread_priority, messages_type const &msgs)

Public Static Functions

template<typename T>
static util::unused_type execute_function(naming::address_type, naming::component_type, T &&v)

Private Types

typedef actions::direct_action<void (*)(messages_type const&), console_logging, console_logging_action> base_type