I have a question on how to produce OpenMP pseudocode when you have a specific dependency graph in mind. So suppose that we have this specific graph:
A solution could be something like this:
#pragma omp parallel
{
#pragma omp single
{
A();
#pragma omp task B();
#pragma omp task C();
D();
#pragma omp taskwait
#pragma omp task E();
F();
}
}
Now the thing is that although the code above does succeed important parallelism, task E has to wait for task D to complete and task F has to wait for task B to complete, which is not required according to the graph.
So my question is, can someone provide me with OpenMP pseudocode where E won't wait for D and F won't wait for B for the given dependency graph?
For this purpose, the OpenMP standard proposes the
depend
clause for thetask
directive.In your specific case, I guess this could be used like this:
As you can see, I introduced some variables
a
,b
andc
which I use to define dependencies across tasks. I also modify them in the call accordingly, although this isn't necessary (I only did it for showing how the flow was handled).And here is what I get on my machine: