I'm beginning in openMP and i want parallelize this portion of code :
for (i=0 ;i<n ;i++)
for (j=1 ;j<n ;j++)
A[i][j]+=A[i][j-1];
and i find this answer:
#pragma omp parallel for private(i, j) shared(A, n)
for (i = 0; i < n; ++i)
for (j = 1; j < n; ++j)
A[i][j] += A[i][j-1];
i have some questions:
- why does i
private and not shared?
- about this answer if i have 4 threads so,each thread have (i = 0; i < n; ++i)and (j = 0; j < n; ++j) iteration? i need your help.