mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-22 16:14:24 +00:00
kernel_atax
: Add comments to the second iteration
This commit is contained in:
parent
57fe10ad6a
commit
e891286291
1 changed files with 9 additions and 7 deletions
|
@ -69,17 +69,19 @@ static void kernel_atax(int nx, int ny,
|
||||||
for (i = 0; i < _PB_NY; i++)
|
for (i = 0; i < _PB_NY; i++)
|
||||||
y[i] = 0;
|
y[i] = 0;
|
||||||
|
|
||||||
// TODO: Optimizable loop, no dependencies
|
/// This computes... something? I guess whatever ATAX is?
|
||||||
// actually tmp[i] could be a local variable
|
// Trying to parallelize this only seems to increase the time required
|
||||||
for (i = 0; i < _PB_NX; i++)
|
|
||||||
tmp[i] = 0;
|
|
||||||
|
|
||||||
// TODO: what do we do here?
|
|
||||||
for (i = 0; i < _PB_NX; i++)
|
for (i = 0; i < _PB_NX; i++)
|
||||||
{
|
{
|
||||||
|
/// Every iteration has its own tmp variable
|
||||||
|
tmp[i] = 0;
|
||||||
|
|
||||||
for (j = 0; j < _PB_NY; j++)
|
for (j = 0; j < _PB_NY; j++)
|
||||||
tmp[i] = tmp[i] + A[i][j] * x[j];
|
/// Which gets increased by a bit on every iteration
|
||||||
|
tmp[i] += A[i][j] * x[j];
|
||||||
|
|
||||||
for (j = 0; j < _PB_NY; j++)
|
for (j = 0; j < _PB_NY; j++)
|
||||||
|
/// Which is later used for [something else]
|
||||||
y[j] = y[j] + A[i][j] * tmp[i];
|
y[j] = y[j] + A[i][j] * tmp[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue