13 #ifndef THRILL_API_SIZE_HEADER 14 #define THRILL_API_SIZE_HEADER 27 template <
typename ValueType>
30 static constexpr
bool debug =
false;
36 template <
typename ParentDIA>
38 :
Super(parent.ctx(),
"Size", { parent.id() }, { parent.node() }),
42 auto pre_op_fn = [
this](
const ValueType&) { ++
local_size_; };
44 auto lop_chain = parent.stack().push(pre_op_fn).fold();
45 parent.node()->AddChild(
this, lop_chain);
52 <<
"Size rejected File from parent " 53 <<
"due to non-empty function stack.";
58 <<
"CacheNode." << this->
dia_id() <<
"::OnPreOpFile()" 59 <<
" accepted file with " <<
local_size_ <<
" items";
86 template <
typename ValueType,
typename Stack>
91 auto node = tlx::make_counting<SizeNode>(*this);
93 return node->result();
96 template <
typename ValueType,
typename Stack>
101 auto node = tlx::make_counting<SizeNode>(*this);
108 #endif // !THRILL_API_SIZE_HEADER net::FlowControlChannel & net
A File is an ordered sequence of Block objects for storing items.
static constexpr bool g_debug_push_file
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT AllReduce(const T &value, const BinarySumOp &sum_op=BinarySumOp())
Reduces a value of a serializable type T over all workers given a certain reduce function.
const bool parent_stack_empty_
Whether the parent stack is empty.
SizeNode(const ParentDIA &parent)
void Execute() final
Executes the size operation.
The return type class for all ActionFutures.
bool OnPreOpFile(const data::File &file, size_t) final
Receive a whole data::File of ValueType, but only if our stack is empty.
const size_t & dia_id() const
return unique id of DIANode subclass as stored by StatsNode
Future< size_t > SizeFuture() const
Lazily computes the total size of all elements across all workers.
static constexpr bool debug
size_t Size() const
Computes the total size of all elements across all workers.
#define LOG
Default logging method: output if the local debug variable is true.
Context & context_
associated Context
#define LOGC(cond)
Explicitly specify the condition for logging.
const size_t & result() const final
Returns result of global size.