hpx/collectives/reduce_direct.hpp#

Defined in header hpx/collectives/reduce_direct.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx

Top level HPX namespace.

namespace lcos

Functions

template<typename Action, typename ReduceOp, typename ArgN, ...> hpx::future< decltype(Action(hpx::id_type, ArgN,...))> reduce (std::vector< hpx::id_type > const &ids, ReduceOp &&reduce_op, ArgN argN,...)

Perform a distributed reduction operation.

The function hpx::lcos::reduce performs a distributed reduction operation over results returned from action invocations on a given set of global identifiers. The action can be either a plain action (in which case the global identifiers have to refer to localities) or a component action (in which case the global identifiers have to refer to instances of a component type which exposes the action.

Parameters
  • ids – [in] A list of global identifiers identifying the target objects for which the given action will be invoked.

  • reduce_op – [in] A binary function expecting two results as returned from the action invocations. The function (or function object) is expected to return the result of the reduction operation performed on its arguments.

  • argN – [in] Any number of arbitrary arguments (passed by by const reference) which will be forwarded to the action invocation.

Returns

This function returns a future representing the result of the overall reduction operation.

template<typename Action, typename ReduceOp, typename ArgN, ...> hpx::future< decltype(Action(hpx::id_type, ArgN,..., std::size_t))> reduce_with_index (std::vector< hpx::id_type > const &ids, ReduceOp &&reduce_op, ArgN argN,...)

Perform a distributed reduction operation.

The function hpx::lcos::reduce_with_index performs a distributed reduction operation over results returned from action invocations on a given set of global identifiers. The action can be either plain action (in which case the global identifiers have to refer to localities) or a component action (in which case the global identifiers have to refer to instances of a component type which exposes the action.

The function passes the index of the global identifier in the given list of identifiers as the last argument to the action.

Parameters
  • ids – [in] A list of global identifiers identifying the target objects for which the given action will be invoked.

  • reduce_op – [in] A binary function expecting two results as returned from the action invocations. The function (or function object) is expected to return the result of the reduction operation performed on its arguments.

  • argN – [in] Any number of arbitrary arguments (passed by by const reference) which will be forwarded to the action invocation.

Returns

This function returns a future representing the result of the overall reduction operation.