12 #ifndef THRILL_API_GATHER_HEADER 13 #define THRILL_API_GATHER_HEADER 27 template <
typename ValueType>
34 template <
typename ParentDIA>
37 std::vector<ValueType>* out_vector)
38 :
Super(parent.ctx(), label,
39 { parent.id() }, { parent.node() }),
44 auto pre_op_fn = [
this](
const ValueType& input) {
50 auto lop_chain = parent.stack().push(pre_op_fn).fold();
51 parent.node()->AddChild(
this, lop_chain);
58 for (
size_t i = 0; i <
emitters_.size(); i++) {
69 auto reader =
stream_->GetCatReader(
true );
71 while (reader.HasNext()) {
72 out_vector_->push_back(reader.template Next<ValueType>());
76 const std::vector<ValueType>&
result() const final {
91 template <
typename ValueType,
typename Stack>
92 std::vector<ValueType>
98 std::vector<ValueType> output;
100 auto node = tlx::make_counting<GatherNode>(
101 *
this,
"Gather", target_id, &output);
108 template <
typename ValueType,
typename Stack>
110 size_t target_id, std::vector<ValueType>* out_vector)
const {
115 auto node = tlx::make_counting<GatherNode>(
116 *
this,
"Gather", target_id, out_vector);
124 #endif // !THRILL_API_GATHER_HEADER data::CatStream::Writers emitters_
size_t num_workers() const
Global number of workers in the system.
const char * label() const
return label() of DIANode subclass as stored by StatsNode
const std::vector< ValueType > & result() const final
virtual method to return result via an ActionFuture
data::CatStreamPtr GetNewCatStream(size_t dia_id)
void StopPreOp(size_t) final
Virtual method for preparing end of PushData.
StreamData::Writers Writers
GatherNode(const ParentDIA &parent, const char *label, size_t target_id, std::vector< ValueType > *out_vector)
data::CatStreamPtr stream_
void Execute() final
Virtual execution method. Triggers actual computation in sub-classes.
std::vector< ValueType > * out_vector_
Vector pointer to write elements to.
std::vector< ValueType > Gather(size_t target_id=0) const
Gather is an Action, which collects all data of the DIA into a vector at the given worker...
void StartPreOp(size_t) final
Virtual method for preparing start of PushData.
Context & context_
associated Context