mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-26 10:04:23 +00:00
aggiunge due for parallelizzati
This commit is contained in:
parent
d45d94ca91
commit
5b8b4f84b2
1 changed files with 3 additions and 3 deletions
|
@ -31,8 +31,8 @@ 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?
|
// Using 3-4 threads slow down the app
|
||||||
// #pragma omp parallel for num_threads(4) schedule(static)
|
#pragma omp parallel for num_threads(2) 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;
|
||||||
|
@ -70,7 +70,7 @@ static void kernel_atax(int nx, int ny,
|
||||||
y[i] = 0;
|
y[i] = 0;
|
||||||
|
|
||||||
/// This computes... something? I guess whatever ATAX is?
|
/// This computes... something? I guess whatever ATAX is?
|
||||||
// Trying to parallelize this only seems to increase the time required
|
#pragma omp parallel for num_threads(4) schedule(static)
|
||||||
for (i = 0; i < _PB_NX; i++)
|
for (i = 0; i < _PB_NX; i++)
|
||||||
{
|
{
|
||||||
/// Every iteration has its own tmp variable
|
/// Every iteration has its own tmp variable
|
||||||
|
|
Loading…
Reference in a new issue