12 #ifndef THRILL_API_DISTRIBUTE_HEADER 13 #define THRILL_API_DISTRIBUTE_HEADER 32 template <
typename ValueType>
40 const std::vector<ValueType>& in_vector,
42 :
Super(ctx,
"Distribute"),
48 std::vector<ValueType>&& in_vector,
50 :
Super(ctx,
"Distribute"),
64 for (
size_t w = 0; w < emitters.size(); ++w) {
69 for (
size_t i = local.
begin; i < local.
end; ++i) {
105 template <
typename ValueType>
108 const std::vector<ValueType>& in_vector,
size_t source_id = 0) {
112 auto node = tlx::make_counting<DistributeNode>(
113 ctx, in_vector, source_id);
125 template <
typename ValueType>
128 std::vector<ValueType>&& in_vector,
size_t source_id = 0) {
132 auto node = tlx::make_counting<DistributeNode>(
133 ctx, std::move(in_vector), source_id);
145 #endif // !THRILL_API_DISTRIBUTE_HEADER DIA is the interface between the user and the Thrill framework.
void PushItem(const ValueType &item) const
Method for derived classes to Push a single item to all children.
void PushData(bool consume) final
Virtual method for pushing data. Triggers actual pushing in sub-classes.
size_t source_id_
source worker id, which sends vector
void reset()
release contained pointer, frees object if this is the last reference.
TLX_ATTRIBUTE_ALWAYS_INLINE T Next()
Next() reads a complete item T.
represents a 1 dimensional range (interval) [begin,end)
The Context of a job is a unique instance per worker which holds references to all underlying parts o...
data::CatStreamPtr stream_
DistributeNode(Context &ctx, const std::vector< ValueType > &in_vector, size_t source_id)
An extra class derived from std::vector<> for delivery of the BlockWriters of a Stream.
data::CatStreamPtr GetNewCatStream(size_t dia_id)
static Range CalculateLocalRange(size_t global_size, size_t p, size_t i)
void Execute() final
Executes the scatter operation: source sends out its data.
DistributeNode(Context &ctx, std::vector< ValueType > &&in_vector, size_t source_id)
size_t my_rank() const
Global rank of this worker among all other workers in the system.
void vector_free(std::vector< Type > &v)
auto Distribute(Context &ctx, const std::vector< ValueType > &in_vector, size_t source_id=0)
Distribute is a Source DOp, which scatters the vector data from the source_id to all workers...
TLX_ATTRIBUTE_ALWAYS_INLINE bool HasNext()
HasNext() returns true if at least one more item is available.
std::vector< ValueType > in_vector_
Vector pointer to read elements from.
void Dispose() final
Virtual clear method. Triggers actual disposing in sub-classes.
Context & context_
associated Context