diff options
author | Yann Herklotz <git@yannherklotz.com> | 2020-11-17 09:11:01 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2020-11-17 09:11:01 +0000 |
commit | 7d9057a6ca6f591851ee5c6e8d74e3833aae3903 (patch) | |
tree | 7577f9b16008a7ceb6158eb836909f1fa636dbc8 /benchmarks/polybench-syn/stencils/heat-3d.c | |
parent | 6aa7ea660f19e7bde920b5b22c1c0c93f1be2fd7 (diff) | |
parent | 38b249970456a55f0a69ff28070887367e113205 (diff) | |
download | vericert-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.tar.gz vericert-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.zip |
Merge branch 'dev-experiments'
Diffstat (limited to 'benchmarks/polybench-syn/stencils/heat-3d.c')
-rw-r--r-- | benchmarks/polybench-syn/stencils/heat-3d.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/benchmarks/polybench-syn/stencils/heat-3d.c b/benchmarks/polybench-syn/stencils/heat-3d.c index 6529e8b..4bc92ee 100644 --- a/benchmarks/polybench-syn/stencils/heat-3d.c +++ b/benchmarks/polybench-syn/stencils/heat-3d.c @@ -9,6 +9,12 @@ */ /* heat-3d.c: this file is part of PolyBench/C */ +#include "../include/misc.h" + +#ifndef SYNTHESIS +#include <stdio.h> +#endif + #define plus(i) i = i + ONE static void init_array (int n, @@ -17,12 +23,11 @@ void init_array (int n, { int i, j, k; int ONE = 1; - int TEN = 10; for (i = 0; i < n; plus(i)) for (j = 0; j < n; plus(j)) for (k = 0; k < n; plus(k)) - A[i][j][k] = B[i][j][k] = (int) (i + j + (n-k))* TEN / (n); + A[i][j][k] = B[i][j][k] = (int) (i + j + (n-k))* sdivider(10, n); } @@ -42,6 +47,9 @@ int print_array(int n, for (k = 0; k < n; plus(k)) { res ^= A[i][j][k]; } +#ifndef SYNTHESIS + printf("finished %u\n", res); +#endif return res; } @@ -57,16 +65,14 @@ void kernel_heat_3d(int tsteps, int t, i, j, k; int ONE = 1; int TWO = 2; - int FOUR = 4; -#pragma scop for (t = 1; t <= 5; plus(t)) { for (i = 1; i < n-ONE; plus(i)) { for (j = 1; j < n-ONE; plus(j)) { for (k = 1; k < n-ONE; plus(k)) { - B[i][j][k] = (A[i+ONE][j][k] - TWO * A[i][j][k] + A[i-ONE][j][k]) >> FOUR - + (A[i][j+ONE][k] - TWO * A[i][j][k] + A[i][j-ONE][k]) >> 4 - + (A[i][j][k+ONE] - TWO * A[i][j][k] + A[i][j][k-ONE]) >> 4 + B[i][j][k] = ((A[i+ONE][j][k] - TWO * A[i][j][k] + A[i-ONE][j][k]) >> 4) + + ((A[i][j+ONE][k] - TWO * A[i][j][k] + A[i][j-ONE][k]) >> 4) + + ((A[i][j][k+ONE] - TWO * A[i][j][k] + A[i][j][k-ONE]) >> 4) + A[i][j][k] ; } @@ -75,16 +81,15 @@ void kernel_heat_3d(int tsteps, for (i = 1; i < n-ONE; plus(i)) { for (j = 1; j < n-ONE; plus(j)) { for (k = 1; k < n-ONE; plus(k)) { - A[i][j][k] = (B[i+ONE][j][k] - TWO * B[i][j][k] + B[i-ONE][j][k]) >> 4 - + (B[i][j+ONE][k] - TWO * B[i][j][k] + B[i][j-ONE][k]) >> 4 - + (B[i][j][k+ONE] - TWO * B[i][j][k] + B[i][j][k-ONE]) >> 4 + A[i][j][k] = ((B[i+ONE][j][k] - TWO * B[i][j][k] + B[i-ONE][j][k]) >> 4 ) + + ((B[i][j+ONE][k] - TWO * B[i][j][k] + B[i][j-ONE][k]) >> 4 ) + + ((B[i][j][k+ONE] - TWO * B[i][j][k] + B[i][j][k-ONE]) >> 4 ) + B[i][j][k]; //; } } } } -#pragma endscop } |