mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-23 00:24:23 +00:00
init_array
: Parallelize the second loop
The performance hit is gone? 0.0437s → 0.0342s
This commit is contained in:
parent
9dc24a3367
commit
a23fd895e9
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ static void init_array(int nx, int ny,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize the `A` matrix with [something?]
|
/// 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 (i = 0; i < nx; i++)
|
||||||
for (j = 0; j < ny; j++)
|
for (j = 0; j < ny; j++)
|
||||||
A[i][j] = ((DATA_TYPE)i * (j + 1)) / nx;
|
A[i][j] = ((DATA_TYPE)i * (j + 1)) / nx;
|
||||||
|
|
Loading…
Reference in a new issue