From 7fcff5d12790a9b7d10dc2dac42788a425991338 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 16 Nov 2022 01:41:29 +0100 Subject: [PATCH] `init_array`: Actually, do optimize the first iteration --- OpenMP/linear-algebra/kernels/atax/atax.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenMP/linear-algebra/kernels/atax/atax.c b/OpenMP/linear-algebra/kernels/atax/atax.c index ec3aac5..af684eb 100644 --- a/OpenMP/linear-algebra/kernels/atax/atax.c +++ b/OpenMP/linear-algebra/kernels/atax/atax.c @@ -24,8 +24,8 @@ static void init_array(int nx, int ny, { int i, j; - // Parallelizing this causes a slowdown, as the cost of context-switches is greater than the cost of inlline execution - // #pragma omp parallel for num_threads(SOMETHING) schedule(static) + /// Initialize the `x` array with PI and its multiples. + #pragma omp parallel for num_threads(4) schedule(static) for (i = 0; i < ny; i++) { x[i] = i * M_PI; }