From a23fd895e91e5093b58145ebeef275d3de66738a Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 17 Nov 2022 01:54:13 +0100 Subject: [PATCH] `init_array`: Parallelize the second loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The performance hit is gone? 0.0437s → 0.0342s --- OpenMP/linear-algebra/kernels/atax/atax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenMP/linear-algebra/kernels/atax/atax.c b/OpenMP/linear-algebra/kernels/atax/atax.c index 8894087..885bc9f 100644 --- a/OpenMP/linear-algebra/kernels/atax/atax.c +++ b/OpenMP/linear-algebra/kernels/atax/atax.c @@ -31,7 +31,7 @@ static void init_array(int nx, int ny, } /// Initialize the `A` matrix with [something?] - // Using 4 threads here slows everything down: why? + #pragma omp parallel for num_threads(THREAD_COUNT) schedule(static) for (i = 0; i < nx; i++) for (j = 0; j < ny; j++) A[i][j] = ((DATA_TYPE)i * (j + 1)) / nx;