-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task dependency graph? #28
Comments
You can have a look at the ff_mdf patter (Macro Data-Flow). |
I tried to compile the #include <ff/mdf.hpp>
using namespace ff;
const size_t SIZE = 1<<8; //1<<20;
void sum2(long *X, long *Y, const long size);
void sum3(long *X, long *Y, long *Z, const long size);
template<typename T>
struct Parameters {
long *A,*B,*C,*D;
T* mdf;
};
void taskGen(Parameters<ff_mdf > *const P){
long *A = P->A; long *B = P->B;
long *C = P->C; long *D = P->D;
auto mdf = P->mdf;
std::vector<param_info> Param;
// A = A + B;
{
const param_info _1={(uintptr_t)A,INPUT}; // 1st param
const param_info _2={(uintptr_t)B,INPUT}; // 2nd param
const param_info _3={(uintptr_t)A,OUTPUT}; // 3rd param
// pack the parameters in one single vector
Param.push_back(_1); Param.push_back(_2);
Param.push_back(_3);
mdf->AddTask(Param, sum2, A,B,SIZE); // create on task
}
// C = C + B;
{
Param.clear();
const param_info _1={(uintptr_t)C,INPUT};
const param_info _2={(uintptr_t)B,INPUT};
const param_info _3={(uintptr_t)C,OUTPUT};
Param.push_back(_1); Param.push_back(_2); Param.push_back(_3);
mdf->AddTask(Param, sum2, C,B,SIZE);
}
// D = D + B;
{
Param.clear();
const param_info _1={(uintptr_t)D,INPUT};
const param_info _2={(uintptr_t)B,INPUT};
const param_info _3={(uintptr_t)D,OUTPUT};
Param.push_back(_1); Param.push_back(_2); Param.push_back(_3);
mdf->AddTask(Param, sum2, D,B,SIZE);
}
// D = A + C + D;
{
Param.clear();
const param_info _1={(uintptr_t)A,INPUT};
const param_info _2={(uintptr_t)C,INPUT};
const param_info _3={(uintptr_t)D,INPUT};
const param_info _4={(uintptr_t)D,OUTPUT};
Param.push_back(_1); Param.push_back(_2);
Param.push_back(_3); Param.push_back(_4);
mdf->AddTask(Param, sum3, D,A,C,SIZE);
}
}
int main() {
long *A= new long[SIZE], *B= new long[SIZE];
long *C= new long[SIZE], *D= new long[SIZE];
for(size_t i=0;i<SIZE;++i) {
A[i]=i; B[i]=i+1; C[i]=i+2; D[i]=i+3;
}
// creates the mdf object passing the task generetor function
Parameters<ff_mdf > P;
ff_mdf dag(taskGen, &P);
P.A=A,P.B=B,P.C=C,P.D=D,P.mdf=&dag;
if (dag.run_and_wait_end() <0) {
std::cerr << "error dag\n";
}
return 0;
} And I use the following command: ~$ g++ hetero_traversal -I fastflow_home/ -pthread
/usr/bin/ld: /tmp/cc80DX8e.o: in function `taskGen(Parameters<ff::ff_mdf>*)':
hetero_traversal.cpp:(.text+0x1289): undefined reference to `sum2(long*, long*, long)'
/usr/bin/ld: hetero_traversal.cpp:(.text+0x1357): undefined reference to `sum2(long*, long*, long)'
/usr/bin/ld: hetero_traversal.cpp:(.text+0x141c): undefined reference to `sum2(long*, long*, long)'
/usr/bin/ld: hetero_traversal.cpp:(.text+0x151c): undefined reference to `sum3(long*, long*, long*, long)'
/usr/bin/ld: /tmp/cc80DX8e.o: in function `ff::ff_pipeline::prepare()::{lambda()#1}::operator()() const':
hetero_traversal.cpp:(.text._ZZN2ff11ff_pipeline7prepareEvENKUlvE_clEv[_ZZN2ff11ff_pipeline7prepareEvENKUlvE_clEv]+0x47): undefined reference to `ff::isa2a_getfirstset(ff::ff_node*)'
/usr/bin/ld: /tmp/cc80DX8e.o: in function `ff::ff_pipeline::prepare()::{lambda()#2}::operator()() const':
hetero_traversal.cpp:(.text._ZZN2ff11ff_pipeline7prepareEvENKUlvE0_clEv[_ZZN2ff11ff_pipeline7prepareEvENKUlvE0_clEv]+0x47): undefined reference to `ff::isa2a_getfirstset(ff::ff_node*)'
/usr/bin/ld: /tmp/cc80DX8e.o: in function `ff::ff_pipeline::prepare()::{lambda()#3}::operator()() const':
hetero_traversal.cpp:(.text._ZZN2ff11ff_pipeline7prepareEvENKUlvE1_clEv[_ZZN2ff11ff_pipeline7prepareEvENKUlvE1_clEv]+0x11d): undefined reference to `ff::isa2a_getsecondset(ff::ff_node*)'
/usr/bin/ld: /tmp/cc80DX8e.o: in function `ff::ff_pipeline::prepare()::{lambda()#4}::operator()() const':
hetero_traversal.cpp:(.text._ZZN2ff11ff_pipeline7prepareEvENKUlvE2_clEv[_ZZN2ff11ff_pipeline7prepareEvENKUlvE2_clEv]+0x11a): undefined reference to `ff::isa2a_getsecondset(ff::ff_node*)'
/usr/bin/ld: /tmp/cc80DX8e.o: in function `ff::ff_pipeline::prepare()':
hetero_traversal.cpp:(.text._ZN2ff11ff_pipeline7prepareEv[_ZN2ff11ff_pipeline7prepareEv]+0x261): undefined reference to `ff::isfarm_withcollector(ff::ff_node*)'
/usr/bin/ld: hetero_traversal.cpp:(.text._ZN2ff11ff_pipeline7prepareEv[_ZN2ff11ff_pipeline7prepareEv]+0x29c): undefined reference to `ff::isfarm_withcollector(ff::ff_node*)'
/usr/bin/ld: hetero_traversal.cpp:(.text._ZN2ff11ff_pipeline7prepareEv[_ZN2ff11ff_pipeline7prepareEv]+0x102d): undefined reference to `ff::isa2a_getfirstset(ff::ff_node*)'
/usr/bin/ld: hetero_traversal.cpp:(.text._ZN2ff11ff_pipeline7prepareEv[_ZN2ff11ff_pipeline7prepareEv]+0x1a41): undefined reference to `ff::isa2a_getfirstset(ff::ff_node*)'
collect2: error: ld returned 1 exit status Why? I know I have to define |
Perhaps, you may let me know how to program a very simple example of three tasks, A, B, and C, and I want A to run before B and C (B and C can run concurrently). What is the code to express this very simple example? |
Hi,
|
Any example or tutorial to how to use fastflow build a task dependency graph?
ff_taskf
tutorial page is blank with TBD. I didn't find any example either.The text was updated successfully, but these errors were encountered: