Skip to content

Commit

Permalink
[apps, script] Don't double buffer with jacobi2d, by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-17 committed Nov 28, 2023
1 parent 9db55cb commit 4f11b13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/jacobi2d/kernel/jacobi2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ void j2d_s(uint64_t r, uint64_t c, DATA_TYPE *A, DATA_TYPE *B,
B[i * c + j] =
(0.2) * (A[i * c + j] + A[i * c + j - 1] + A[i * c + j + 1] +
A[(i + 1) * c + j] + A[(i - 1) * c + j]);
#ifdef DOUBLE_BUFFERING
for (uint32_t i = 1; i < r - 1; i++)
for (uint32_t j = 1; j < c - 1; j++)
A[i * c + j] =
(0.2) * (B[i * c + j] + B[i * c + j - 1] + B[i * c + j + 1] +
B[(i + 1) * c + j] + B[(i - 1) * c + j]);
#endif
}
}

void j2d_v(uint64_t r, uint64_t c, DATA_TYPE *A, DATA_TYPE *B,
uint64_t tsteps) {
for (uint32_t t = 0; t < tsteps; t++) {
j2d_kernel_asm_v(r, c, A, B);
#ifdef DOUBLE_BUFFERING
j2d_kernel_asm_v(r, c, B, A);
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def fconv3d(args, cycles):
def jacobi2d(args, cycles):
size = int(args[0])
trash_0 = args[1]
performance = 2 * 5 * (size-1) * (size-1) / cycles
performance = 5 * (size-1) * (size-1) / cycles
return [size, performance]
def dropout(args, cycles):
size = int(args[0])
Expand Down

0 comments on commit 4f11b13

Please sign in to comment.