ttg::BinaryTreeReduce< Value, BinaryOp, OutKey > Class Template Reference
Inheritance diagram for ttg::BinaryTreeReduce< Value, BinaryOp, OutKey >:
ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > > ttg::TTBase ttg_parsec::detail::ParsecTTBase

Documentation

template<typename Value, typename BinaryOp, typename OutKey>
class ttg::BinaryTreeReduce< Value, BinaryOp, OutKey >

generic binary reduction of a set of key-value pairs.

This reduces a set of Value objects keyed by an integer in the [0,max_key) interval using BinaryOp op . The reduction order is determined by breadth-first traversal of a binary spanning tree of the complete graph of the [0,max_key) set (see BinarySpanningTree) rooted at a particular key; at each node Node the reduction is performed as op(op(LeftSubTree,Node),RightSubTree) . The primary use is for reducing over a World, hence by default the keymap is identity (keymap(key) = key) and max_key=world.size() . The result is associated with output key dest_key .

Note
this is equivalent to MPI_Reduce; unlike std::reduce this lacks the initializer value.

Definition at line 29 of file reduce.h.

Public Types

using baseT = typename BinaryTreeReduce::ttT
 
- Public Types inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
using ttT = TT
 
using key_type = int
 
using input_terminals_type = ttg::detail::input_terminals_tuple_t< int, input_tuple_type >
 
using input_args_type = actual_input_tuple_type
 
using input_edges_type = ttg::detail::edges_tuple_t< int, ttg::meta::decayed_typelist_t< input_tuple_type > >
 
using input_values_full_tuple_type = ttg::meta::void_to_Void_tuple_t< ttg::meta::decayed_typelist_t< actual_input_tuple_type > >
 
using input_refs_full_tuple_type = ttg::meta::add_glvalue_reference_tuple_t< ttg::meta::void_to_Void_tuple_t< actual_input_tuple_type > >
 
using input_values_tuple_type = ttg::meta::drop_void_t< ttg::meta::decayed_typelist_t< input_tuple_type > >
 
using input_refs_tuple_type = ttg::meta::drop_void_t< ttg::meta::add_glvalue_reference_tuple_t< input_tuple_type > >
 
using output_terminals_type = std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >
 
using output_edges_type = typename ttg::terminals_to_edges< std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > > >::type
 

Public Member Functions

 BinaryTreeReduce (Edge< int, Value > &in, Edge< OutKey, Value > &out, int root=0, OutKey dest_key=OutKey(), BinaryOp op=BinaryOp{}, World world=ttg::default_execution_context(), int max_key=-1, Edge< int, Value > inout=Edge< int, Value >{}, Edge< int, Value > inout_l=Edge< int, Value >{}, Edge< int, Value > inout_r=Edge< int, Value >{})
 
void op (const int &key, typename baseT::input_values_tuple_type &&indata, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value >> &outdata)
 
- Public Member Functions inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
ttg::World get_world () const override final
 
void set_static_argstream_size (std::size_t size)
 
std::enable_if_t<!ttg::meta::is_void_v< Key >, void > set_argstream_size (const Key &key, std::size_t size)
 
std::enable_if_t< ttg::meta::is_void_v< Key >, void > set_argstream_size (std::size_t size)
 
std::enable_if_t<!ttg::meta::is_void_v< Key >, void > finalize_argstream (const Key &key)
 finalizes stream for input i More...
 
std::enable_if_t< key_is_void, void > finalize_argstream ()
 finalizes stream for input i More...
 
void copy_mark_pushout (detail::ttg_data_copy_t *copy)
 
std::enable_if_t<!std::is_void_v< std::decay_t< Value > >, void > do_prepare_send (const Value &value, RemoteCheckFn &&remote_check)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > prepare_send (const ttg::span< const Key > &keylist, const Value &value)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > prepare_send (const Value &value)
 
 TT (const std::string &name, const std::vector< std::string > &innames, const std::vector< std::string > &outnames, ttg::World world, keymapT &&keymap_=keymapT(), priomapT &&priomap_=priomapT())
 
 TT (const std::string &name, const std::vector< std::string > &innames, const std::vector< std::string > &outnames, keymapT &&keymap=keymapT(ttg::default_execution_context()), priomapT &&priomap=priomapT())
 
 TT (const input_edges_type &inedges, const output_edges_type &outedges, const std::string &name, const std::vector< std::string > &innames, const std::vector< std::string > &outnames, ttg::World world, keymapT &&keymap_=keymapT(), priomapT &&priomap=priomapT())
 
 TT (const input_edges_type &inedges, const output_edges_type &outedges, const std::string &name, const std::vector< std::string > &innames, const std::vector< std::string > &outnames, keymapT &&keymap=keymapT(ttg::default_execution_context()), priomapT &&priomap=priomapT())
 
virtual ~TT ()
 
void print_incomplete_tasks ()
 
virtual void release () override
 
void do_release ()
 
void set_input_reducer (Reducer &&reducer)
 
void set_input_reducer (Reducer &&reducer, std::size_t size)
 
std::tuple_element_t< i, input_terminals_type > * in ()
 
std::tuple_element_t< i, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > > > * out ()
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke (const Key &key, const input_values_tuple_type &args)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke (const input_values_tuple_type &args)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke (const Key &key)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke ()
 
void invoke () override
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke (const Key &key, Arg &&arg, Args &&... args)
 
void set_defer_writer (bool value)
 
bool get_defer_writer (bool value)
 
void make_executable () override
 Marks this executable. More...
 
decltype(keymap) const & get_keymap () const
 
void set_keymap (Keymap &&km)
 keymap setter More...
 
decltype(priomap) const & get_priomap () const
 
void set_priomap (Priomap &&pm)
 
void set_devicemap (Devicemap &&dm)
 
auto get_devicemap ()
 
void register_static_op_function (void)
 
- Public Member Functions inherited from ttg::TTBase
virtual ~TTBase ()=default
 
bool set_trace_instance (bool value)
 
bool tracing () const
 
template<typename T , typename... Ts>
void trace (const T &t, const Ts &...ts)
 Like ttg::trace(), but only produces tracing output if this->tracing()==true More...
 
bool set_lazy_pull_instance (bool value)
 
bool is_lazy_pull ()
 
std::optional< std::reference_wrapper< const TTBase > > ttg () const
 
const TTBasettg_ptr () const
 
bool is_ttg () const
 
void set_name (const std::string &name)
 Sets the name of this operation. More...
 
const std::string & get_name () const
 Gets the name of this operation. More...
 
std::string get_class_name () const
 Gets the demangled class name (uses RTTI) More...
 
const std::vector< TerminalBase * > & get_inputs () const
 Returns the vector of input terminals. More...
 
const std::vector< TerminalBase * > & get_outputs () const
 Returns the vector of output terminals. More...
 
ttg::TerminalBasein (size_t i)
 Returns a pointer to the i'th input terminal. More...
 
ttg::TerminalBaseout (size_t i)
 Returns a pointer to the i'th output terminal. More...
 
template<std::size_t i>
ttg::TerminalBasein ()
 Returns a pointer to the i'th input terminal ... to make API consistent with TT. More...
 
template<std::size_t i>
ttg::TerminalBaseout ()
 Returns a pointer to the i'th output terminal ... to make API consistent with TT. More...
 
auto get_instance_id () const
 
bool is_executable () const
 

Additional Inherited Members

- Static Public Member Functions inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
static constexpr bool derived_has_cuda_op ()
 
static constexpr bool derived_has_hip_op ()
 
static constexpr bool derived_has_level_zero_op ()
 
static constexpr bool derived_has_device_op ()
 
static resultT get (InTuple &&intuple)
 
static auto & get (InTuple &&intuple)
 
static void ht_iter_cb (void *item, void *cb_data)
 
- Static Public Member Functions inherited from ttg::TTBase
static bool set_trace_all (bool value)
 
static bool set_lazy_pull (bool value)
 
static const std::vector< TerminalBase * > * get_outputs_tls_ptr ()
 Returns this thread's pointer to the vector of output terminals. More...
 
- Static Public Attributes inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
static constexpr int numinvals
 
static constexpr const ttg::Runtime runtime
 
- Protected Member Functions inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
const auto & get_output_terminals () const
 
uint64_t unpack (T &obj, void *_bytes, uint64_t pos)
 
uint64_t pack (T &obj, void *bytes, uint64_t pos, detail::ttg_data_copy_t *copy=nullptr)
 
parsec_thread_mempool_t * get_task_mempool (void)
 
void set_arg_from_msg_keylist (ttg::span< int > &&keylist, detail::ttg_data_copy_t *copy)
 
void set_arg_from_msg (void *data, std::size_t size)
 
void finalize_argstream_from_msg (void *data, std::size_t size)
 
void argstream_set_size_from_msg (void *data, std::size_t size)
 
void get_from_pull_msg (void *data, std::size_t size)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg_local (const Key &key, Value &&value)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg_local (Value &&value)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg_local (const Key &key, const Value &value)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg_local (const Value &value)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg_local (std::shared_ptr< const Value > &valueptr)
 
task_tcreate_new_task (const Key &key)
 
detail::reducer_task_tcreate_new_reducer_task (task_t *task, bool is_first)
 
void set_arg_local_impl (const Key &key, Value &&value, detail::ttg_data_copy_t *copy_in=nullptr, parsec_task_t **task_ring=nullptr)
 
void release_task (task_t *task, parsec_task_t **task_ring=nullptr)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg (const Key &key, Value &&value)
 
std::enable_if_t< ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > set_arg (Value &&value)
 
std::enable_if_t< ttg::meta::is_void_v< Key >, void > set_arg ()
 
std::enable_if_t<!ttg::meta::is_void_v< Key >, void > set_arg (const Key &key)
 
bool can_inline_data (Value *value_ptr, detail::ttg_data_copy_t *copy, const Key &key, std::size_t num_keys)
 
void set_arg_impl (const Key &key, Value &&value, detail::ttg_data_copy_t *copy_in=nullptr)
 
void broadcast_arg_local (Iterator &&begin, Iterator &&end, const Value &value)
 
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!std::is_void_v< std::decay_t< Value > >, void > broadcast_arg (const ttg::span< const Key > &keylist, const Value &value)
 
std::enable_if_t< ttg::meta::is_none_void_v< Key >, void > set_args (std::index_sequence< Is... >, std::index_sequence< Js... >, const Key &key, const std::tuple< Ts... > &args)
 
std::enable_if_t< ttg::meta::is_none_void_v< Key >, void > set_args (std::index_sequence< Is... > is, const Key &key, const std::tuple< Ts... > &args)
 
std::enable_if_t< ttg::meta::is_void_v< Key >, void > set_args (std::index_sequence< Is... >, std::index_sequence< Js... >, const std::tuple< Ts... > &args)
 
std::enable_if_t< ttg::meta::is_void_v< Key >, void > set_args (std::index_sequence< Is... > is, const std::tuple< Ts... > &args)
 
- Protected Member Functions inherited from ttg::TTBase
void set_input (size_t i, TerminalBase *t)
 
void set_output (size_t i, TerminalBase *t)
 
template<bool out, typename terminalT , std::size_t i, typename setfuncT >
void register_terminal (terminalT &term, const std::string &name, const setfuncT setfunc)
 
template<bool out, std::size_t... IS, typename terminalsT , typename namesT , typename setfuncT >
void register_terminals (std::index_sequence< IS... >, terminalsT &terms, const namesT &names, const setfuncT setfunc)
 
template<typename terminalsT , typename namesT >
void register_input_terminals (terminalsT &terms, const namesT &names)
 
template<typename terminalsT , typename namesT >
void register_output_terminals (terminalsT &terms, const namesT &names)
 
template<std::size_t... IS, typename terminalsT , typename setfuncT >
void set_terminals (std::index_sequence< IS... >, terminalsT &terms, const setfuncT setfunc)
 
template<typename terminalsT , typename setfuncT >
void set_terminals (const terminalsT &terms, const setfuncT setfunc)
 
 TTBase (TTBase &&other)
 
TTBaseoperator= (TTBase &&other)
 
 TTBase (const std::string &name, size_t numins, size_t numouts)
 
void set_outputs_tls_ptr ()
 
void set_outputs_tls_ptr (const std::vector< TerminalBase * > *ptr)
 
- Static Protected Member Functions inherited from ttg_parsec::TT< int, std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value > >, BinaryTreeReduce< Value, BinaryOp, OutKey >, ttg::typelist< Value, Value, Value > >
static void static_set_arg (void *data, std::size_t size, ttg::TTBase *bop)
 
- Static Protected Member Functions inherited from ttg::TTBase
static const std::vector< TerminalBase * > *& outputs_tls_ptr_accessor ()
 

Member Typedef Documentation

◆ baseT

template<typename Value , typename BinaryOp , typename OutKey >
using ttg::BinaryTreeReduce< Value, BinaryOp, OutKey >::baseT = typename BinaryTreeReduce::ttT

Definition at line 33 of file reduce.h.

Constructor & Destructor Documentation

◆ BinaryTreeReduce()

template<typename Value , typename BinaryOp , typename OutKey >
ttg::BinaryTreeReduce< Value, BinaryOp, OutKey >::BinaryTreeReduce ( Edge< int, Value > &  in,
Edge< OutKey, Value > &  out,
int  root = 0,
OutKey  dest_key = OutKey(),
BinaryOp  op = BinaryOp{},
World  world = ttg::default_execution_context(),
int  max_key = -1,
Edge< int, Value >  inout = Edge<int, Value>{},
Edge< int, Value >  inout_l = Edge<int, Value>{},
Edge< int, Value >  inout_r = Edge<int, Value>{} 
)
inline

Definition at line 35 of file reduce.h.

Member Function Documentation

◆ op()

template<typename Value , typename BinaryOp , typename OutKey >
void ttg::BinaryTreeReduce< Value, BinaryOp, OutKey >::op ( const int &  key,
typename baseT::input_values_tuple_type &&  indata,
std::tuple< Out< int, Value >, Out< int, Value >, Out< int, Value >, Out< OutKey, Value >> &  outdata 
)
inline

skip stub values ... won't need this ugliness when streaming is implemented

Definition at line 47 of file reduce.h.


The documentation for this class was generated from the following file: