I am trying to use openmp tasks to schedule the tiled execution of a basic jacobi2d calculation. In jacobi2d, there is a dependence on A (i, j) on
A (i, j)
A (i-1, j)
A (i + 1, j)
A (i, j-1)
A (i, j + 1).
In my understanding of the dependency clause, I correctly define the dependencies, but they are not respected when executing the code. I copied the simplified part of the code below. Initially, I assumed that out of range limits for some fragments this problem might occur, so I fixed it, but the problem persists. (I did not copy the longer code with the correct ranges of tiles, since this part is just a bunch of ifs + max)
int n=8,tsteps=2,b=4; //n - size of matrix, tsteps - time iterations, b - tile size or block size
So the idea of ββdeclaring a dependency, starting with i-1 and j-1 and range (b + 2), is that neighboring tiles also affect your current tile calculations. And similarly for the second set of loops, where the values ββin should be overwritten only after the neighboring tiles used the values.
The code compiles using gcc 5.3, which supports openmp 4.0.
ps: the array path declared above indicates the starting position and the number of indices to consider when creating a dependency graph.
edit (based on Zulan comment) - changed the internal code to a simple print statement, as this is enough to check the order of the task. Ideally, for the above values ββ(since there are only 4 tiles), all tiles should complete the first printf and then only the second. But if you execute the code, it will mix the order.