Edited pragma

This commit is contained in:
Fabio Salvini 2016-11-23 11:42:22 +01:00
parent 8ff3e6cf65
commit 054a659804

View File

@ -40,7 +40,9 @@ double *compute_jacobi(int n, double init_value, double threshold, borders b, in
*iterations = 0; *iterations = 0;
do { do {
max_diff = 0; max_diff = 0;
#pragma omp parallel for schedule(static, 20) reduction (max:max_diff) private(new_value, j) firstprivate(n, nb) shared(x, new_x) #pragma omp parallel for schedule(static, 20) \
reduction (max:max_diff) \
default(none) private(new_value, j) firstprivate(n, nb) shared(x, new_x)
for (i = 1; i <= n; i++) { for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) { for (j = 1; j <= n; j++) {
new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]); new_value = 0.25 * (x[IDX(nb, i - 1, j)] + x[IDX(nb, i, j + 1)] + x[IDX(nb, i + 1, j)] + x[IDX(nb, i, j - 1)]);