From 95861dbef966e2cb612b303615681fc29c3acd3d Mon Sep 17 00:00:00 2001 From: Nadesh Ramanathan Date: Wed, 11 Nov 2020 19:47:42 +0000 Subject: polybench edits --- benchmarks/polybench-syn/stencils/adi.c | 7 ++++--- benchmarks/polybench-syn/stencils/fdtd-2d.c | 8 -------- benchmarks/polybench-syn/stencils/jacobi-1d.c | 7 +++---- benchmarks/polybench-syn/stencils/jacobi-2d.c | 7 +++---- benchmarks/polybench-syn/stencils/seidel-2d.c | 10 +++++----- 5 files changed, 15 insertions(+), 24 deletions(-) (limited to 'benchmarks/polybench-syn/stencils') diff --git a/benchmarks/polybench-syn/stencils/adi.c b/benchmarks/polybench-syn/stencils/adi.c index 5dd406b..a424dec 100644 --- a/benchmarks/polybench-syn/stencils/adi.c +++ b/benchmarks/polybench-syn/stencils/adi.c @@ -9,6 +9,7 @@ */ /* adi.c: this file is part of PolyBench/C */ +#include "../include/misc.h" #define plus(i) i = i + ONE static @@ -64,10 +65,10 @@ void kernel_adi(int tsteps, int n, mul1 = B1 * DT / (DX * DX); mul2 = B2 * DT / (DY * DY); - a = -mul1 / 2; + a = -(sdivider(mul1,2)); b = 1+mul1; c = a; - d = -mul2 / 2; + d = -(sdivider(mul2,2)); e = 1+mul2; f = d; int ZERO = 0; @@ -107,7 +108,7 @@ void kernel_adi(int tsteps, int n, } -int main(int argc, char** argv) +int main() { int n = 20; diff --git a/benchmarks/polybench-syn/stencils/fdtd-2d.c b/benchmarks/polybench-syn/stencils/fdtd-2d.c index b699937..17acd34 100644 --- a/benchmarks/polybench-syn/stencils/fdtd-2d.c +++ b/benchmarks/polybench-syn/stencils/fdtd-2d.c @@ -9,7 +9,6 @@ */ /* fdtd-2d.c: this file is part of PolyBench/C */ -#include #define plus(i) i = i + ONE static @@ -65,10 +64,6 @@ int print_array(int nx, res ^= hz[i][j]; } -#ifndef SYNTHESIS - printf("finished: %u\n", res); -#endif - return res; } @@ -85,8 +80,6 @@ void kernel_fdtd_2d(int tmax, int t, i, j; int ONE = 1; -#pragma scop - for(t = 0; t < tmax; t=t+ONE) { for (j = 0; j < ny; plus(j)) @@ -105,7 +98,6 @@ void kernel_fdtd_2d(int tmax, } } -#pragma endscop } diff --git a/benchmarks/polybench-syn/stencils/jacobi-1d.c b/benchmarks/polybench-syn/stencils/jacobi-1d.c index 1c3cf79..95cbb35 100644 --- a/benchmarks/polybench-syn/stencils/jacobi-1d.c +++ b/benchmarks/polybench-syn/stencils/jacobi-1d.c @@ -9,6 +9,7 @@ */ /* jacobi-1d.c: this file is part of PolyBench/C */ +#include "../include/misc.h" #define plus(i) i = i + ONE static @@ -23,8 +24,8 @@ void init_array (int n, for (i = 0; i < n; plus(i)) { - A[i] = ((int) i+TWO) / n; - B[i] = ((int) i+THREE) / n; + A[i] = divider(((int) i+TWO), n); + B[i] = divider(((int) i+THREE), n); } } @@ -59,7 +60,6 @@ void kernel_jacobi_1d(int tsteps, int t, i; int ONE = 1; -#pragma scop for (t = 0; t < tsteps; plus(t)) { for (i = 1; i < n - ONE; plus(i)){ @@ -71,7 +71,6 @@ void kernel_jacobi_1d(int tsteps, A[i] = A[i] >> 2; } } -#pragma endscop } diff --git a/benchmarks/polybench-syn/stencils/jacobi-2d.c b/benchmarks/polybench-syn/stencils/jacobi-2d.c index 3a5b43c..11349f4 100644 --- a/benchmarks/polybench-syn/stencils/jacobi-2d.c +++ b/benchmarks/polybench-syn/stencils/jacobi-2d.c @@ -9,6 +9,7 @@ */ /* jacobi-2d.c: this file is part of PolyBench/C */ +#include "../include/misc.h" #define plus(i) i = i + ONE static @@ -24,8 +25,8 @@ void init_array (int n, for (i = 0; i < n; plus(i)) for (j = 0; j < n; plus(j)) { - A[i][j] = ((int) i*(j+TWO) + TWO) / n; - B[i][j] = ((int) i*(j+THREE) + THREE) / n; + A[i][j] = divider(((int) i*(j+TWO) + TWO), n); + B[i][j] = divider(((int) i*(j+THREE) + THREE), n); } } @@ -61,7 +62,6 @@ void kernel_jacobi_2d(int tsteps, int ONE = 1; int TWO = 2; -#pragma scop for (t = 0; t < tsteps; plus(t)) { for (i = 1; i < n - ONE; plus(i)) @@ -75,7 +75,6 @@ void kernel_jacobi_2d(int tsteps, A[i][j] = A[i][j] >> TWO; } } -#pragma endscop } diff --git a/benchmarks/polybench-syn/stencils/seidel-2d.c b/benchmarks/polybench-syn/stencils/seidel-2d.c index d4c7f98..23ddc74 100644 --- a/benchmarks/polybench-syn/stencils/seidel-2d.c +++ b/benchmarks/polybench-syn/stencils/seidel-2d.c @@ -9,6 +9,8 @@ */ /* seidel-2d.c: this file is part of PolyBench/C */ +#include "../include/misc.h" + #define plus(i) i = i + ONE static void init_array (int n, @@ -20,7 +22,7 @@ void init_array (int n, for (i = 0; i < n; plus(i)) for (j = 0; j < n; plus(j)) - A[i][j] = ((int) i*(j+TWO) + TWO) / n; + A[i][j] = divider(((int) i*(j+TWO) + TWO), n); } @@ -55,14 +57,12 @@ void kernel_seidel_2d(int tsteps, int TWO = 2; int NINE = 9; -#pragma scop for (t = 0; t <= tsteps - ONE; plus(t)) for (i = ONE; i<= n - TWO; plus(i)) for (j = ONE; j <= n - TWO; plus(j)) - A[i][j] = (A[i-ONE][j-ONE] + A[i-ONE][j] + A[i-ONE][j+ONE] + A[i][j] = divider((A[i-ONE][j-ONE] + A[i-ONE][j] + A[i-ONE][j+ONE] + A[i][j-ONE] + A[i][j] + A[i][j+ONE] - + A[i+ONE][j-ONE] + A[i+ONE][j] + A[i+ONE][j+ONE])/NINE; -#pragma endscop + + A[i+ONE][j-ONE] + A[i+ONE][j] + A[i+ONE][j+ONE]), NINE); } -- cgit