aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/stencils
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-11-17 09:11:01 +0000
committerYann Herklotz <git@yannherklotz.com>2020-11-17 09:11:01 +0000
commit7d9057a6ca6f591851ee5c6e8d74e3833aae3903 (patch)
tree7577f9b16008a7ceb6158eb836909f1fa636dbc8 /benchmarks/polybench-syn/stencils
parent6aa7ea660f19e7bde920b5b22c1c0c93f1be2fd7 (diff)
parent38b249970456a55f0a69ff28070887367e113205 (diff)
downloadvericert-kvx-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.tar.gz
vericert-kvx-7d9057a6ca6f591851ee5c6e8d74e3833aae3903.zip
Merge branch 'dev-experiments'
Diffstat (limited to 'benchmarks/polybench-syn/stencils')
-rw-r--r--benchmarks/polybench-syn/stencils/fdtd-2d.c21
-rw-r--r--benchmarks/polybench-syn/stencils/heat-3d.c27
-rw-r--r--benchmarks/polybench-syn/stencils/jacobi-1d.c7
-rw-r--r--benchmarks/polybench-syn/stencils/jacobi-2d.c8
-rw-r--r--benchmarks/polybench-syn/stencils/seidel-2d.c7
5 files changed, 51 insertions, 19 deletions
diff --git a/benchmarks/polybench-syn/stencils/fdtd-2d.c b/benchmarks/polybench-syn/stencils/fdtd-2d.c
index f9f4a84..d92183e 100644
--- a/benchmarks/polybench-syn/stencils/fdtd-2d.c
+++ b/benchmarks/polybench-syn/stencils/fdtd-2d.c
@@ -13,6 +13,13 @@
#include <stdio.h>
#endif
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
+
+#include "../include/misc.h"
+
#define plus(i) i = i + ONE
static
void init_array (int tmax,
@@ -25,18 +32,16 @@ void init_array (int tmax,
{
int i, j;
int ONE = 1;
- int TWO = 1;
- int THREE = 1;
for (i = 0; i < tmax; plus(i))
_fict_[i] = (int) i;
for (i = 0; i < nx; plus(i))
for (j = 0; j < ny; plus(j))
- {
- ex[i][j] = ((int) i*(j+ONE)) / nx;
- ey[i][j] = ((int) i*(j+TWO)) / ny;
- hz[i][j] = ((int) i*(j+THREE)) / nx;
- }
+ {
+ ex[i][j] = sdivider(i*(j+1) , nx);
+ ey[i][j] = sdivider(i*(j+2) , ny);
+ hz[i][j] = sdivider(i*(j+3) , nx);
+ }
}
@@ -70,7 +75,7 @@ int print_array(int nx,
#ifndef SYNTHESIS
printf("finished: %u\n", res);
#endif
-
+
return res;
}
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
}
diff --git a/benchmarks/polybench-syn/stencils/jacobi-1d.c b/benchmarks/polybench-syn/stencils/jacobi-1d.c
index 95cbb35..7b1d692 100644
--- a/benchmarks/polybench-syn/stencils/jacobi-1d.c
+++ b/benchmarks/polybench-syn/stencils/jacobi-1d.c
@@ -11,6 +11,10 @@
#include "../include/misc.h"
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -45,6 +49,9 @@ int print_array(int n,
{
res ^= A[i];
}
+#ifndef SYNTHESIS
+ printf("finished %u\n", res);
+#endif
return res;
}
diff --git a/benchmarks/polybench-syn/stencils/jacobi-2d.c b/benchmarks/polybench-syn/stencils/jacobi-2d.c
index 11349f4..2d61d76 100644
--- a/benchmarks/polybench-syn/stencils/jacobi-2d.c
+++ b/benchmarks/polybench-syn/stencils/jacobi-2d.c
@@ -11,6 +11,11 @@
#include "../include/misc.h"
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
+
#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -46,6 +51,9 @@ int print_array(int n,
for (j = 0; j < n; plus(j)) {
res ^= A[i][j];
}
+#ifndef SYNTHESIS
+ printf("finished %u\n", res);
+#endif
return res;
}
diff --git a/benchmarks/polybench-syn/stencils/seidel-2d.c b/benchmarks/polybench-syn/stencils/seidel-2d.c
index 23ddc74..eb48acc 100644
--- a/benchmarks/polybench-syn/stencils/seidel-2d.c
+++ b/benchmarks/polybench-syn/stencils/seidel-2d.c
@@ -11,6 +11,10 @@
#include "../include/misc.h"
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -41,6 +45,9 @@ int print_array(int n,
for (j = 0; j < n; plus(j)) {
res ^= A[i][j];
}
+#ifndef SYNTHESIS
+ printf("finished %u\n", res);
+#endif
return res;
}