runtime_distributed

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

Functions

bool tolerate_node_faults()
class runtime_distributed : public runtime
#include <runtime_distributed.hpp>

The runtime class encapsulates the HPX runtime system in a simple to use way. It makes sure all required parts of the HPX runtime system are properly initialized.

Public Functions

hpx::runtime_distributed::runtime_distributed(util::runtime_configuration & rtcfg, int(*pre_main)(runtime_mode) = nullptr)

Construct a new HPX runtime instance

Parameters
  • locality_mode: [in] This is the mode the given runtime instance should be executed in.

~runtime_distributed()

The destructor makes sure all HPX runtime services are properly shut down before exiting.

int start(util::function_nonser<hpx_main_function_type> const &func, bool blocking = false)

Start the runtime system.

Return

If a blocking is a true, this function will return the value as returned as the result of the invocation of the function object given by the parameter func. Otherwise it will return zero.

Parameters
  • func: [in] This is the main function of an HPX application. It will be scheduled for execution by the thread manager as soon as the runtime has been initialized. This function is expected to expose an interface as defined by the typedef hpx_main_function_type.

  • blocking: [in] This allows to control whether this call blocks until the runtime system has been stopped. If this parameter is true the function runtime::start will call runtime::wait internally.

int start(bool blocking = false)

Start the runtime system.

Return

If a blocking is a true, this function will return the value as returned as the result of the invocation of the function object given by the parameter func. Otherwise it will return zero.

Parameters
  • blocking: [in] This allows to control whether this call blocks until the runtime system has been stopped. If this parameter is true the function runtime::start will call runtime::wait internally .

int wait()

Wait for the shutdown action to be executed.

Return

This function will return the value as returned as the result of the invocation of the function object given by the parameter func.

void stop(bool blocking = true)

Initiate termination of the runtime system.

Parameters
  • blocking: [in] This allows to control whether this call blocks until the runtime system has been fully stopped. If this parameter is false then this call will initiate the stop action but will return immediately. Use a second call to stop with this parameter set to true to wait for all internal work to be completed.

int finalize(double shutdown_timeout)
void stop_helper(bool blocking, std::condition_variable &cond, std::mutex &mtx)

Stop the runtime system, wait for termination.

Parameters
  • blocking: [in] This allows to control whether this call blocks until the runtime system has been fully stopped. If this parameter is false then this call will initiate the stop action but will return immediately. Use a second call to stop with this parameter set to true to wait for all internal work to be completed.

int suspend()

Suspend the runtime system.

int resume()

Resume the runtime system.

bool report_error(std::size_t num_thread, std::exception_ptr const &e, bool terminate_all = true)

Report a non-recoverable error to the runtime system.

Parameters
  • num_thread: [in] The number of the operating system thread the error has been detected in.

  • e: [in] This is an instance encapsulating an exception which lead to this function call.

  • terminate_all: [in] Kill all localities attached to the currently running application (default: true)

bool report_error(std::exception_ptr const &e, bool terminate_all = true)

Report a non-recoverable error to the runtime system.

Note

This function will retrieve the number of the current shepherd thread and forward to the report_error function above.

Parameters
  • e: [in] This is an instance encapsulating an exception which lead to this function call.

  • terminate_all: [in] Kill all localities attached to the currently running application (default: true)

int run(util::function_nonser<hpx_main_function_type> const &func)

Run the HPX runtime system, use the given function for the main thread and block waiting for all threads to finish.

Note

The parameter func is optional. If no function is supplied, the runtime system will simply wait for the shutdown action without explicitly executing any main thread.

Return

This function will return the value as returned as the result of the invocation of the function object given by the parameter func.

Parameters
  • func: [in] This is the main function of an HPX application. It will be scheduled for execution by the thread manager as soon as the runtime has been initialized. This function is expected to expose an interface as defined by the typedef hpx_main_function_type. This parameter is optional and defaults to none main thread function, in which case all threads have to be scheduled explicitly.

int run()

Run the HPX runtime system, initially use the given number of (OS) threads in the thread-manager and block waiting for all threads to finish.

Return

This function will always return 0 (zero).

bool is_networking_enabled()
template<typename F>
components::server::console_error_dispatcher::sink_type set_error_sink(F &&sink)
performance_counters::registry &get_counter_registry()

Allow access to the registry counter registry instance used by the HPX runtime.

performance_counters::registry const &get_counter_registry() const

Allow access to the registry counter registry instance used by the HPX runtime.

void register_counter_types()

Install all performance counters related to this runtime instance.

void register_query_counters(std::shared_ptr<util::query_counters> const &active_counters)
void start_active_counters(error_code &ec = throws)
void stop_active_counters(error_code &ec = throws)
void reset_active_counters(error_code &ec = throws)
void reinit_active_counters(bool reset = true, error_code &ec = throws)
void evaluate_active_counters(bool reset = false, char const *description = nullptr, error_code &ec = throws)
void stop_evaluating_counters(bool terminate = false)
naming::resolver_client &get_agas_client()

Allow access to the AGAS client instance used by the HPX runtime.

hpx::threads::threadmanager &get_thread_manager()

Allow access to the thread manager instance used by the HPX runtime.

applier::applier &get_applier()

Allow access to the applier instance used by the HPX runtime.

std::string here() const

Returns a string of the locality endpoints (usable in debug output)

std::uint64_t get_runtime_support_lva() const
naming::gid_type get_next_id(std::size_t count = 1)
void init_id_pool_range()
util::unique_id_ranges &get_id_pool()
void initialize_agas()

Initialize AGAS operation.

void add_pre_startup_function(startup_function_type f)

Add a function to be executed inside a HPX thread before hpx_main but guaranteed to be executed before any startup function registered with add_startup_function.

Note

The difference to a startup function is that all pre-startup functions will be (system-wide) executed before any startup function.

Parameters
  • f: The function ‘f’ will be called from inside a HPX thread before hpx_main is executed. This is very useful to setup the runtime environment of the application (install performance counters, etc.)

void add_startup_function(startup_function_type f)

Add a function to be executed inside a HPX thread before hpx_main

Parameters
  • f: The function ‘f’ will be called from inside a HPX thread before hpx_main is executed. This is very useful to setup the runtime environment of the application (install performance counters, etc.)

void add_pre_shutdown_function(shutdown_function_type f)

Add a function to be executed inside a HPX thread during hpx::finalize, but guaranteed before any of the shutdown functions is executed.

Note

The difference to a shutdown function is that all pre-shutdown functions will be (system-wide) executed before any shutdown function.

Parameters
  • f: The function ‘f’ will be called from inside a HPX thread while hpx::finalize is executed. This is very useful to tear down the runtime environment of the application (uninstall performance counters, etc.)

void add_shutdown_function(shutdown_function_type f)

Add a function to be executed inside a HPX thread during hpx::finalize

Parameters
  • f: The function ‘f’ will be called from inside a HPX thread while hpx::finalize is executed. This is very useful to tear down the runtime environment of the application (uninstall performance counters, etc.)

hpx::util::io_service_pool *get_thread_pool(char const *name)

Access one of the internal thread pools (io_service instances) HPX is using to perform specific tasks. The three possible values for the argument name are “main_pool”, “io_pool”, “parcel_pool”, and “timer_pool”. For any other argument value the function will return zero.

bool register_thread(char const *name, std::size_t num = 0, bool service_thread = true, error_code &ec = throws)

Register an external OS-thread with HPX.

notification_policy_type get_notification_policy(char const *prefix, runtime_local::os_thread_type type)

Generate a new notification policy instance for the given thread name prefix

std::uint32_t get_locality_id(error_code &ec) const
std::size_t get_num_worker_threads() const
std::uint32_t get_num_localities(hpx::launch::sync_policy, error_code &ec) const
std::uint32_t get_initial_num_localities() const
lcos::future<std::uint32_t> get_num_localities() const
std::string get_locality_name() const
std::uint32_t get_num_localities(hpx::launch::sync_policy, components::component_type type, error_code &ec) const
lcos::future<std::uint32_t> get_num_localities(components::component_type type) const
std::uint32_t assign_cores(std::string const &locality_basename, std::uint32_t num_threads)
std::uint32_t assign_cores()

Private Types

using used_cores_map_type = std::map<std::string, std::uint32_t>

Private Functions

runtime_distributed *This()
threads::thread_result_type run_helper(util::function_nonser<runtime::hpx_main_function_type> const &func, int &result)
void wait_helper(std::mutex &mtx, std::condition_variable &cond, bool &running)
void init_tss_helper(char const *context, runtime_local::os_thread_type type, std::size_t local_thread_num, std::size_t global_thread_num, char const *pool_name, char const *postfix, bool service_thread)
void deinit_tss_helper(char const *context, std::size_t num)
void init_tss_ex(std::string const &locality, char const *context, runtime_local::os_thread_type type, std::size_t local_thread_num, std::size_t global_thread_num, char const *pool_name, char const *postfix, bool service_thread, error_code &ec)

Private Members

runtime_mode mode_
util::unique_id_ranges id_pool_
naming::resolver_client agas_client_
applier::applier applier_
used_cores_map_type used_cores_map_
std::unique_ptr<components::server::runtime_support> runtime_support_
std::shared_ptr<util::query_counters> active_counters_
int (*pre_main_)(runtime_mode)

Private Static Functions

static void default_errorsink(std::string const&)
namespace hpx
namespace applier

Functions

applier &get_applier()

The function get_applier returns a reference to the (thread specific) applier instance.

applier *get_applier_ptr()

The function get_applier returns a pointer to the (thread specific) applier instance. The returned pointer is NULL if the current thread is not known to HPX or if the runtime system is not active.

namespace applier

The namespace applier contains all definitions needed for the class hpx::applier::applier and its related functionality. This namespace is part of the HPX core module.

namespace hpx
namespace components

Functions

template<typename Component>
future<naming::id_type> copy(naming::id_type const &to_copy)

Copy given component to the specified target locality.

The function copy<Component> will create a copy of the component referenced by to_copy on the locality specified with target_locality. It returns a future referring to the newly created component instance.

Return

A future representing the global id of the newly (copied) component instance.

Note

The new component instance is created on the locality of the component instance which is to be copied.

Parameters
  • to_copy: [in] The global id of the component to copy

Template Parameters
  • The: only template argument specifies the component type to create.

template<typename Component>
future<naming::id_type> copy(naming::id_type const &to_copy, naming::id_type const &target_locality)

Copy given component to the specified target locality.

The function copy<Component> will create a copy of the component referenced by to_copy on the locality specified with target_locality. It returns a future referring to the newly created component instance.

Return

A future representing the global id of the newly (copied) component instance.

Parameters
  • to_copy: [in] The global id of the component to copy

  • target_locality: [in ] The locality where the copy should be created.

Template Parameters
  • The: only template argument specifies the component type to create.

template<typename Derived, typename Stub>
Derived copy(client_base<Derived, Stub> const &to_copy, naming::id_type const &target_locality = naming::invalid_id)

Copy given component to the specified target locality.

The function copy will create a copy of the component referenced by the client side object to_copy on the locality specified with target_locality. It returns a new client side object future referring to the newly created component instance.

Return

A future representing the global id of the newly (copied) component instance.

Note

If the second argument is omitted (or is invalid_id) the new component instance is created on the locality of the component instance which is to be copied.

Parameters
  • to_copy: [in] The client side object representing the component to copy

  • target_locality: [in, optional] The locality where the copy should be created (default is same locality as source).

Template Parameters
  • The: only template argument specifies the component type to create.

namespace hpx

Functions

naming::id_type find_root_locality(error_code &ec = throws)

Return the global id representing the root locality.

The function find_root_locality() can be used to retrieve the global id usable to refer to the root locality. The root locality is the locality where the main AGAS service is hosted.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global id representing the root locality for this application.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return hpx::naming::invalid_id otherwise.

See

hpx::find_all_localities(), hpx::find_locality()

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

std::vector<naming::id_type> find_all_localities(error_code &ec = throws)

Return the list of global ids representing all localities available to this application.

The function find_all_localities() can be used to retrieve the global ids of all localities currently available to this application.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global ids representing the localities currently available to this application.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return an empty vector otherwise.

See

hpx::find_here(), hpx::find_locality()

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

std::vector<naming::id_type> find_remote_localities(error_code &ec = throws)

Return the list of locality ids of remote localities supporting the given component type. By default this function will return the list of all remote localities (all but the current locality).

The function find_remote_localities() can be used to retrieve the global ids of all remote localities currently available to this application (i.e. all localities except the current one).

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global ids representing the remote localities currently available to this application.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return an empty vector otherwise.

See

hpx::find_here(), hpx::find_locality()

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

namespace hpx

Functions

naming::id_type find_here(error_code &ec = throws)

Return the global id representing this locality.

The function find_here() can be used to retrieve the global id usable to refer to the current locality.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global id representing the locality this function has been called on.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return hpx::naming::invalid_id otherwise.

See

hpx::find_all_localities(), hpx::find_locality()

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

namespace hpx

Functions

std::vector<naming::id_type> find_all_localities(components::component_type type, error_code &ec = throws)

Return the list of global ids representing all localities available to this application which support the given component type.

The function find_all_localities() can be used to retrieve the global ids of all localities currently available to this application which support the creation of instances of the given component type.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global ids representing the localities currently available to this application which support the creation of instances of the given component type. If no localities supporting the given component type are currently available, this function will return an empty vector.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return an empty vector otherwise.

See

hpx::find_here(), hpx::find_locality()

Parameters
  • type: [in] The type of the components for which the function should return the available localities.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

std::vector<naming::id_type> find_remote_localities(components::component_type type, error_code &ec = throws)

Return the list of locality ids of remote localities supporting the given component type. By default this function will return the list of all remote localities (all but the current locality).

The function find_remote_localities() can be used to retrieve the global ids of all remote localities currently available to this application (i.e. all localities except the current one) which support the creation of instances of the given component type.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global ids representing the remote localities currently available to this application.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return an empty vector otherwise.

See

hpx::find_here(), hpx::find_locality()

Parameters
  • type: [in] The type of the components for which the function should return the available remote localities.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

naming::id_type find_locality(components::component_type type, error_code &ec = throws)

Return the global id representing an arbitrary locality which supports the given component type.

The function find_locality() can be used to retrieve the global id of an arbitrary locality currently available to this application which supports the creation of instances of the given component type.

Note

Generally, the id of a locality can be used for instance to create new instances of components and to invoke plain actions (global functions).

Return

The global id representing an arbitrary locality currently available to this application which supports the creation of instances of the given component type. If no locality supporting the given component type is currently available, this function will return hpx::naming::invalid_id.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Note

This function will return meaningful results only if called from an HPX-thread. It will return hpx::naming::invalid_id otherwise.

See

hpx::find_here(), hpx::find_all_localities()

Parameters
  • type: [in] The type of the components for which the function should return any available locality.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

namespace hpx

Functions

future<std::string> get_locality_name(naming::id_type const &id)

Return the name of the referenced locality.

This function returns a future referring to the name for the locality of the given id.

Return

This function returns the name for the locality of the given id. The name is retrieved from the underlying networking layer and may be different for different parcel ports.

See

std::string get_locality_name()

Parameters
  • id: [in] The global id of the locality for which the name should be retrieved

namespace hpx

Functions

lcos::future<std::uint32_t> get_num_localities(components::component_type t)

Asynchronously return the number of localities which are currently registered for the running application.

The function get_num_localities asynchronously returns the number of localities currently connected to the console which support the creation of the given component type. The returned future represents the actual result.

Note

This function will return meaningful results only if called from an HPX-thread. It will return 0 otherwise.

See

hpx::find_all_localities, hpx::get_num_localities

Parameters
  • t: The component type for which the number of connected localities should be retrieved.

std::uint32_t get_num_localities(launch::sync_policy, components::component_type t, error_code &ec = throws)

Synchronously return the number of localities which are currently registered for the running application.

The function get_num_localities returns the number of localities currently connected to the console which support the creation of the given component type. The returned future represents the actual result.

Note

This function will return meaningful results only if called from an HPX-thread. It will return 0 otherwise.

See

hpx::find_all_localities, hpx::get_num_localities

Parameters
  • t: The component type for which the number of connected localities should be retrieved.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

namespace hpx
namespace components

Functions

template<typename Component, typename DistPolicy>
future<naming::id_type> migrate(naming::id_type const &to_migrate, DistPolicy const &policy)

Migrate the given component to the specified target locality

The function migrate<Component> will migrate the component referenced by to_migrate to the locality specified with target_locality. It returns a future referring to the migrated component instance.

Return

A future representing the global id of the migrated component instance. This should be the same as migrate_to.

Parameters
  • to_migrate: [in] The client side representation of the component to migrate.

  • policy: [in] A distribution policy which will be used to determine the locality to migrate this object to.

Template Parameters
  • Component: Specifies the component type of the component to migrate.

  • DistPolicy: Specifies the distribution policy to use to determine the destination locality.

template<typename Derived, typename Stub, typename DistPolicy>
Derived migrate(client_base<Derived, Stub> const &to_migrate, DistPolicy const &policy)

Migrate the given component to the specified target locality

The function migrate<Component> will migrate the component referenced by to_migrate to the locality specified with target_locality. It returns a future referring to the migrated component instance.

Return

A future representing the global id of the migrated component instance. This should be the same as migrate_to.

Parameters
  • to_migrate: [in] The client side representation of the component to migrate.

  • policy: [in] A distribution policy which will be used to determine the locality to migrate this object to.

Template Parameters
  • Derived: Specifies the component type of the component to migrate.

  • DistPolicy: Specifies the distribution policy to use to determine the destination locality.

template<typename Component>
future<naming::id_type> migrate(naming::id_type const &to_migrate, naming::id_type const &target_locality)

Migrate the component with the given id to the specified target locality

The function migrate<Component> will migrate the component referenced by to_migrate to the locality specified with target_locality. It returns a future referring to the migrated component instance.

Return

A future representing the global id of the migrated component instance. This should be the same as migrate_to.

Parameters
  • to_migrate: [in] The global id of the component to migrate.

  • target_locality: [in] The locality where the component should be migrated to.

Template Parameters
  • Component: Specifies the component type of the component to migrate.

template<typename Derived, typename Stub>
Derived migrate(client_base<Derived, Stub> const &to_migrate, naming::id_type const &target_locality)

Migrate the given component to the specified target locality

The function migrate<Component> will migrate the component referenced by to_migrate to the locality specified with target_locality. It returns a future referring to the migrated component instance.

Return

A client side representation of representing of the migrated component instance. This should be the same as migrate_to.

Parameters
  • to_migrate: [in] The client side representation of the component to migrate.

  • target_locality: [in] The id of the locality to migrate this object to.

Template Parameters
  • Derived: Specifies the component type of the component to migrate.

namespace hpx
namespace components
class runtime_support : public hpx::components::stubs::runtime_support
#include <runtime_support.hpp>

The runtime_support class is the client side representation of a server::runtime_support component

Public Functions

runtime_support(naming::id_type const &gid = naming::invalid_id)

Create a client side representation for the existing server::runtime_support instance with the given global id gid.

template<typename Component, typename ...Ts>
naming::id_type create_component(Ts&&... vs)

Create a new component type using the runtime_support.

template<typename Component, typename ...Ts>
lcos::future<naming::id_type> create_component_async(Ts&&... vs)

Asynchronously create a new component using the runtime_support.

template<typename Component, typename ...Ts>
std::vector<naming::id_type> bulk_create_component(std::size_t, Ts&&... vs)

Asynchronously create N new default constructed components using the runtime_support

template<typename Component, typename ...Ts>
lcos::future<std::vector<naming::id_type>> bulk_create_components_async(std::size_t, Ts&&... vs)

Asynchronously create a new component using the runtime_support.

lcos::future<int> load_components_async()
int load_components()
lcos::future<void> call_startup_functions_async(bool pre_startup)
void call_startup_functions(bool pre_startup)
lcos::future<void> shutdown_async(double timeout = -1)

Shutdown the given runtime system.

void shutdown(double timeout = -1)
void shutdown_all(double timeout = -1)

Shutdown the runtime systems of all localities.

lcos::future<void> terminate_async()

Terminate the given runtime system.

void terminate()
void terminate_all()

Terminate the runtime systems of all localities.

void get_config(util::section &ini)

Retrieve configuration information.

naming::id_type const &get_id() const
naming::gid_type const &get_raw_gid() const

Private Types

typedef stubs::runtime_support base_type

Private Members

naming::id_type gid_
namespace hpx
namespace components
namespace server

Functions

template<typename Component>
future<naming::id_type> copy_component_here(naming::id_type const &to_copy)
template<typename Component>
future<naming::id_type> copy_component(naming::id_type const &to_copy, naming::id_type const &target_locality)
namespace hpx
namespace components
namespace server

Functions

template<typename Component, typename DistPolicy>
future<id_type> migrate_component(id_type const &to_migrate, naming::address const &addr, DistPolicy const &policy)
template<typename Component, typename DistPolicy>
future<id_type> trigger_migrate_component(id_type const &to_migrate, DistPolicy const &policy, naming::id_type const &id, naming::address const &addr)
template<typename Component, typename DistPolicy>
future<id_type> perform_migrate_component(id_type const &to_migrate, DistPolicy const &policy)
namespace hpx
namespace components
namespace server
class runtime_support

Public Types

typedef runtime_support type_holder

Public Functions

runtime_support(hpx::util::runtime_configuration &cfg)
~runtime_support()
void delete_function_lists()
void tidy()
template<typename Component>
naming::gid_type create_component()

Actions to create new objects.

template<typename Component, typename T, typename ...Ts>
naming::gid_type create_component(T v, Ts... vs)
template<typename Component>
std::vector<naming::gid_type> bulk_create_component(std::size_t count)
template<typename Component, typename T, typename ...Ts>
std::vector<naming::gid_type> bulk_create_component(std::size_t count, T v, Ts... vs)
template<typename Component>
naming::gid_type copy_create_component(std::shared_ptr<Component> const &p, bool local_op)
template<typename Component>
naming::gid_type migrate_component_to_here(std::shared_ptr<Component> const &p, naming::id_type to_migrate)
void shutdown(double timeout, naming::id_type const &respond_to)

Gracefully shutdown this runtime system instance.

void shutdown_all(double timeout)

Gracefully shutdown runtime system instances on all localities.

HPX_NORETURN void hpx::components::server::runtime_support::terminate(naming::id_type const & respond_to)

Shutdown this runtime system instance.

void terminate_act(naming::id_type const &id)
HPX_NORETURN void hpx::components::server::runtime_support::terminate_all()

Shutdown runtime system instances on all localities.

void terminate_all_act()
util::section get_config()

Retrieve configuration information.

int load_components()

Load all components on this locality.

void call_startup_functions(bool pre_startup)
void call_shutdown_functions(bool pre_shutdown)
void garbage_collect()

Force a garbage collection operation in the AGAS layer.

naming::gid_type create_performance_counter(performance_counters::counter_info const &info)

Create the given performance counter instance.

void remove_from_connection_cache(naming::gid_type const &gid, parcelset::endpoints_type const &eps)

Remove the given locality from our connection cache.

HPX_DEFINE_COMPONENT_ACTION(runtime_support, load_components)

termination detection

HPX_DEFINE_COMPONENT_ACTION(runtime_support, call_startup_functions)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, call_shutdown_functions)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, shutdown)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, shutdown_all)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, terminate_act, terminate_action)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, terminate_all_act, terminate_all_action)
HPX_DEFINE_COMPONENT_DIRECT_ACTION(runtime_support, get_config)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, garbage_collect)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, create_performance_counter)
HPX_DEFINE_COMPONENT_ACTION(runtime_support, remove_from_connection_cache)
void run()

Start the runtime_support component.

void wait()

Wait for the runtime_support component to notify the calling thread.

This function will be called from the main thread, causing it to block while the HPX functionality is executed. The main thread will block until the shutdown_action is executed, which in turn notifies all waiting threads.

void stop(double timeout, naming::id_type const &respond_to, bool remove_from_remote_caches)

Notify all waiting (blocking) threads allowing the system to be properly stopped.

Note

This function can be called from any thread.

void stopped()

called locally only

void notify_waiting_main()
bool was_stopped() const
void add_pre_startup_function(startup_function_type f)
void add_startup_function(startup_function_type f)
void add_pre_shutdown_function(shutdown_function_type f)
void add_shutdown_function(shutdown_function_type f)
void remove_here_from_connection_cache()
void remove_here_from_console_connection_cache()

Public Static Functions

static component_type get_component_type()
static void set_component_type(component_type t)
static constexpr void finalize()

finalize() will be called just before the instance gets destructed

Parameters
  • self: [in] The HPX thread used to execute this function.

  • appl: [in] The applier to be used for finalization of the component instance.

static bool is_target_valid(naming::id_type const &id)

Protected Functions

int load_components(util::section &ini, naming::gid_type const &prefix, naming::resolver_client &agas_client, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_component(hpx::util::plugin::dll &d, util::section &ini, std::string const &instance, std::string const &component, filesystem::path const &lib, naming::gid_type const &prefix, naming::resolver_client &agas_client, bool isdefault, bool isenabled, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_component_dynamic(util::section &ini, std::string const &instance, std::string const &component, filesystem::path lib, naming::gid_type const &prefix, naming::resolver_client &agas_client, bool isdefault, bool isenabled, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_startup_shutdown_functions(hpx::util::plugin::dll &d, error_code &ec)
bool load_commandline_options(hpx::util::plugin::dll &d, hpx::program_options::options_description &options, error_code &ec)
bool load_component_static(util::section &ini, std::string const &instance, std::string const &component, filesystem::path const &lib, naming::gid_type const &prefix, naming::resolver_client &agas_client, bool isdefault, bool isenabled, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_startup_shutdown_functions_static(std::string const &mod, error_code &ec)
bool load_commandline_options_static(std::string const &mod, hpx::program_options::options_description &options, error_code &ec)
bool load_plugins(util::section &ini, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_plugin(hpx::util::plugin::dll &d, util::section &ini, std::string const &instance, std::string const &component, filesystem::path const &lib, bool isenabled, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
bool load_plugin_dynamic(util::section &ini, std::string const &instance, std::string const &component, filesystem::path lib, bool isenabled, hpx::program_options::options_description &options, std::set<std::string> &startup_handled)
std::size_t dijkstra_termination_detection(std::vector<naming::id_type> const &locality_ids)

Private Types

typedef lcos::local::spinlock plugin_map_mutex_type
typedef plugin_factory plugin_factory_type
typedef std::map<std::string, plugin_factory_type> plugin_map_type
typedef std::map<std::string, hpx::util::plugin::dll> modules_map_type
typedef std::vector<static_factory_load_data_type> static_modules_type

Private Members

std::mutex mtx_
std::condition_variable wait_condition_
std::condition_variable stop_condition_
bool stop_called_
bool stop_done_
bool terminated_
std::thread::id main_thread_id_
std::atomic<bool> shutdown_all_invoked_
plugin_map_mutex_type p_mtx_
plugin_map_type plugins_
modules_map_type &modules_
static_modules_type static_modules_
lcos::local::spinlock globals_mtx_
std::list<startup_function_type> pre_startup_functions_
std::list<startup_function_type> startup_functions_
std::list<shutdown_function_type> pre_shutdown_functions_
std::list<shutdown_function_type> shutdown_functions_
struct plugin_factory

Public Functions

plugin_factory(std::shared_ptr<plugins::plugin_factory_base> const &f, hpx::util::plugin::dll const &d, bool enabled)

Public Members

std::shared_ptr<plugins::plugin_factory_base> first
hpx::util::plugin::dll const &second
bool isenabled
namespace hpx
namespace components
namespace stubs
struct runtime_support

Subclassed by hpx::components::runtime_support

Public Static Functions

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

Create a new component type using the runtime_support with the given targetgid. This is a non-blocking call. The caller needs to call future::get on the result of this function to obtain the global id of the newly created object.

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

Create a new component type using the runtime_support with the given targetgid. Block for the creation to finish.

template<typename Component, typename ...Ts>
static lcos::future<std::vector<naming::id_type>> bulk_create_component_colocated_async(naming::id_type const &gid, std::size_t count, Ts&&... vs)

Create multiple new components type using the runtime_support colocated with the with the given targetgid. This is a non-blocking call.

template<typename Component, typename ...Ts>
static std::vector<naming::id_type> bulk_create_component_colocated(naming::id_type const &gid, std::size_t count, Ts&&... vs)

Create multiple new components type using the runtime_support colocated with the with the given targetgid. Block for the creation to finish.

template<typename Component, typename ...Ts>
static lcos::future<std::vector<naming::id_type>> bulk_create_component_async(naming::id_type const &gid, std::size_t count, Ts&&... vs)

Create multiple new components type using the runtime_support on the given locality. This is a non-blocking call.

template<typename Component, typename ...Ts>
static std::vector<naming::id_type> bulk_create_component(naming::id_type const &gid, std::size_t count, Ts&&... vs)

Create multiple new components type using the runtime_support on the given locality. Block for the creation to finish.

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

Create a new component type using the runtime_support with the given targetgid. This is a non-blocking call. The caller needs to call future::get on the result of this function to obtain the global id of the newly created object.

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

Create a new component type using the runtime_support with the given targetgid. Block for the creation to finish.

template<typename Component>
static lcos::future<naming::id_type> copy_create_component_async(naming::id_type const &gid, std::shared_ptr<Component> const &p, bool local_op)
template<typename Component>
static naming::id_type copy_create_component(naming::id_type const &gid, std::shared_ptr<Component> const &p, bool local_op)
template<typename Component>
static lcos::future<naming::id_type> migrate_component_async(naming::id_type const &target_locality, std::shared_ptr<Component> const &p, naming::id_type const &to_migrate)
template<typename Component, typename DistPolicy>
static lcos::future<naming::id_type> migrate_component_async(DistPolicy const &policy, std::shared_ptr<Component> const &p, naming::id_type const &to_migrate)
template<typename Component, typename Target>
static naming::id_type migrate_component(Target const &target, naming::id_type const &to_migrate, std::shared_ptr<Component> const &p)
static lcos::future<int> load_components_async(naming::id_type const &gid)
static int load_components(naming::id_type const &gid)
static lcos::future<void> call_startup_functions_async(naming::id_type const &gid, bool pre_startup)
static void call_startup_functions(naming::id_type const &gid, bool pre_startup)
static lcos::future<void> shutdown_async(naming::id_type const &targetgid, double timeout = -1)

Shutdown the given runtime system.

static void shutdown(naming::id_type const &targetgid, double timeout = -1)
static void shutdown_all(naming::id_type const &targetgid, double timeout = -1)

Shutdown the runtime systems of all localities.

static void shutdown_all(double timeout = -1)
static lcos::future<void> terminate_async(naming::id_type const &targetgid)

Retrieve configuration information.

Terminate the given runtime system

static void terminate(naming::id_type const &targetgid)
static void terminate_all(naming::id_type const &targetgid)

Terminate the runtime systems of all localities.

static void terminate_all()
static void garbage_collect_non_blocking(naming::id_type const &targetgid)
static lcos::future<void> garbage_collect_async(naming::id_type const &targetgid)
static void garbage_collect(naming::id_type const &targetgid)
static lcos::future<naming::id_type> create_performance_counter_async(naming::id_type targetgid, performance_counters::counter_info const &info)
static naming::id_type create_performance_counter(naming::id_type targetgid, performance_counters::counter_info const &info, error_code &ec = throws)
static lcos::future<util::section> get_config_async(naming::id_type const &targetgid)

Retrieve configuration information.

static void get_config(naming::id_type const &targetgid, util::section &ini)
static void remove_from_connection_cache_async(naming::id_type const &target, naming::gid_type const &gid, parcelset::endpoints_type const &endpoints)