Skip to content

Commit

Permalink
[FIX] changed the code to avoid some underlying bugs of FastFlow usin…
Browse files Browse the repository at this point in the history
…g A2As
  • Loading branch information
mencagli committed Sep 17, 2020
1 parent 5e04e75 commit 7d87c8c
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 213 deletions.
3 changes: 1 addition & 2 deletions wf/accumulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include<unordered_map>
#include<ff/node.hpp>
#include<ff/pipeline.hpp>
#include<ff/multinode.hpp>
#include<ff/farm.hpp>
#include<basic.hpp>
#include<context.hpp>
Expand Down Expand Up @@ -82,7 +81,7 @@ class Accumulator: public ff::ff_farm, public Basic_Operator
size_t parallelism; // internal parallelism of the Accumulator
bool used; // true if the Accumulator has been added/chained in a MultiPipe
// class Accumulator_Node
class Accumulator_Node: public ff::ff_minode_t<tuple_t, result_t>
class Accumulator_Node: public ff::ff_node_t<tuple_t, result_t>
{
private:
acc_func_t acc_func; // reduce/fold function
Expand Down
3 changes: 1 addition & 2 deletions wf/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include<string>
#include<ff/node.hpp>
#include<ff/pipeline.hpp>
#include<ff/multinode.hpp>
#include<ff/farm.hpp>
#include<basic.hpp>
#include<context.hpp>
Expand Down Expand Up @@ -87,7 +86,7 @@ class Filter: public ff::ff_farm, public Basic_Operator
bool keyed; // flag stating whether the Filter is configured with keyBy or not
bool used; // true if the Filter has been added/chained in a MultiPipe
// class Filter_Node
class Filter_Node: public ff::ff_minode_t<tuple_t, result_t>
class Filter_Node: public ff::ff_node_t<tuple_t, result_t>
{
private:
filter_func_t filter_func; // filter function (with boolean return type)
Expand Down
3 changes: 1 addition & 2 deletions wf/flatmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include<string>
#include<ff/node.hpp>
#include<ff/pipeline.hpp>
#include<ff/multinode.hpp>
#include<ff/farm.hpp>
#include<basic.hpp>
#include<shipper.hpp>
Expand Down Expand Up @@ -80,7 +79,7 @@ class FlatMap: public ff::ff_farm, public Basic_Operator
bool keyed; // flag stating whether the FlatMap is configured with keyBy or not
bool used; // true if the FlatMap has been added/chained in a MultiPipe
// class FlatMap_Node
class FlatMap_Node: public ff::ff_minode_t<tuple_t, result_t>
class FlatMap_Node: public ff::ff_node_t<tuple_t, result_t>
{
private:
flatmap_func_t flatmap_func; // flatmap function
Expand Down
3 changes: 1 addition & 2 deletions wf/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include<string>
#include<ff/node.hpp>
#include<ff/pipeline.hpp>
#include<ff/multinode.hpp>
#include<ff/farm.hpp>
#include<basic.hpp>
#include<context.hpp>
Expand Down Expand Up @@ -83,7 +82,7 @@ class Map: public ff::ff_farm, public Basic_Operator
bool keyed; // flag stating whether the Map is configured with keyBy or not
bool used; // true if the Map has been added/chained in a MultiPipe
// class Map_Node
class Map_Node: public ff::ff_minode_t<tuple_t, result_t>
class Map_Node: public ff::ff_node_t<tuple_t, result_t>
{
private:
map_func_ip_t func_ip; // in-place map function
Expand Down
8 changes: 8 additions & 0 deletions wf/multipipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ class MultiPipe: public ff::ff_pipeline
collector_t *collector = new collector_t(_ordering, atomic_num_dropped);
combine_with_firststage(*stage, collector, true); // add the ordering_node / kslack_node
}
else {
dummy_mi *collector = new dummy_mi();
combine_with_firststage(*stage, collector, true); // dummy multi-input node
}
first_set.push_back(stage);
}
matrioska->add_firstset(first_set, 0, true);
Expand Down Expand Up @@ -318,6 +322,10 @@ class MultiPipe: public ff::ff_pipeline
collector_t *collector = new collector_t(_ordering, atomic_num_dropped);
combine_with_firststage(*stage, collector, true); // add the ordering_node / kslack_node
}
else {
dummy_mi *collector = new dummy_mi();
combine_with_firststage(*stage, collector, true); // dummy multi-input node
}
first_set.push_back(stage);
}
matrioska->add_firstset(first_set, 0, true);
Expand Down
3 changes: 1 addition & 2 deletions wf/sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include<ff/node.hpp>
#include<ff/combine.hpp>
#include<ff/pipeline.hpp>
#include<ff/multinode.hpp>
#include<ff/farm.hpp>
#include<basic.hpp>
#include<context.hpp>
Expand Down Expand Up @@ -90,7 +89,7 @@ class Sink: public ff::ff_farm, public Basic_Operator
bool keyed; // flag stating whether the Sink is configured with keyBy or not
bool used; // true if the Sink has been added/chained in a MultiPipe
// class Sink_Node
class Sink_Node: public ff::ff_minode_t<tuple_t>
class Sink_Node: public ff::ff_node_t<tuple_t>
{
private:
sink_func_t sink_func; // sink function (receiving a reference to an optional containing the input)
Expand Down
175 changes: 0 additions & 175 deletions wf/test_mp_gpu_kff_cb.cpp

This file was deleted.

13 changes: 6 additions & 7 deletions wf/win_seq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include<unordered_map>
#include<math.h>
#include<ff/node.hpp>
#include<ff/multinode.hpp>
#include<meta.hpp>
#include<window.hpp>
#include<context.hpp>
Expand All @@ -55,7 +54,7 @@ namespace wf {

// Win_Seq class
template<typename tuple_t, typename result_t, typename input_t>
class Win_Seq: public ff::ff_minode_t<input_t, result_t>
class Win_Seq: public ff::ff_node_t<input_t, result_t>
{
public:
// type of the non-incremental window processing function
Expand Down Expand Up @@ -485,9 +484,9 @@ class Win_Seq: public ff::ff_minode_t<input_t, result_t>
{
eos_received++;
// check the number of received EOS messages
if ((eos_received != this->get_num_inchannels()) && (this->get_num_inchannels() != 0)) { // workaround due to FastFlow
return;
}
//if ((eos_received != this->get_num_inchannels()) && (this->get_num_inchannels() != 0)) { // workaround due to FastFlow
// return;
//}
// iterate over all the keys
for (auto &k: keyMap) {
auto &wins = (k.second).wins;
Expand Down Expand Up @@ -568,13 +567,13 @@ class Win_Seq: public ff::ff_minode_t<input_t, result_t>
// method to start the node execution asynchronously
int run(bool) override
{
return ff::ff_minode::run();
return ff::ff_node::run();
}

// method to wait the node termination
int wait() override
{
return ff::ff_minode::wait();
return ff::ff_node::wait();
}
};

Expand Down
13 changes: 6 additions & 7 deletions wf/win_seq_gpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include<unordered_map>
#include<math.h>
#include<ff/node.hpp>
#include<ff/multinode.hpp>
#include<meta.hpp>
#include<window.hpp>
#include<meta_gpu.hpp>
Expand Down Expand Up @@ -82,7 +81,7 @@ __global__ void ComputeBatch_Kernel(void *input_data,

// Win_Seq_GPU class
template<typename tuple_t, typename result_t, typename win_F_t, typename input_t>
class Win_Seq_GPU: public ff::ff_minode_t<input_t, result_t>
class Win_Seq_GPU: public ff::ff_node_t<input_t, result_t>
{
private:
// type of the stream archive used by the Win_Seq_GPU node
Expand Down Expand Up @@ -614,9 +613,9 @@ class Win_Seq_GPU: public ff::ff_minode_t<input_t, result_t>
{
eos_received++;
// check the number of received EOS messages
if ((eos_received != this->get_num_inchannels()) && (this->get_num_inchannels() != 0)) { // workaround due to FastFlow
return;
}
//if ((eos_received != this->get_num_inchannels()) && (this->get_num_inchannels() != 0)) { // workaround due to FastFlow
// return;
//}
// emit results of the previously running kernel on the GPU
waitAndFlush();
// allocate on the CPU the scratchpad_memory
Expand Down Expand Up @@ -709,13 +708,13 @@ class Win_Seq_GPU: public ff::ff_minode_t<input_t, result_t>
// method to start the node execution asynchronously
int run(bool) override
{
return ff::ff_minode::run();
return ff::ff_node::run();
}

// method to wait the node termination
int wait() override
{
return ff::ff_minode::wait();
return ff::ff_node::wait();
}
};

Expand Down
Loading

0 comments on commit 7d87c8c

Please sign in to comment.