I wanted to know whether there is a way to parallelize a “for loop” having data dependency problem using OpenMP.
here is the for loop which I like to parallelize
int k = 0;
int A[100][100];
for(i = 0; i < 100; i++) {
for(j = 0; j < 100; j++) {
A[i][j] = k;
k++;
}
}
Do anyone have a solution for this…
You don’t really have a data dependency problem there, because
kcan be computed fromiandj:If you can give a more realistic example of what you’re trying to do, we may be able to help you more.