aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/linear-algebra/solvers
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/polybench-syn/linear-algebra/solvers')
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c8
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/durbin.c43
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/lu.c45
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c9
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c13
5 files changed, 45 insertions, 73 deletions
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c b/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c
index 05e85ea..b43402b 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c
@@ -11,6 +11,10 @@
#include "../../include/misc.h"
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
# define SQRT_FUN(x) sqrtf(x)
#define plus(i) i = i + ONE
@@ -63,6 +67,10 @@ int check_array(int n,
for (j = 0; j <= i; plus(j)) {
if(A[i][j]!=0) res = 1;
}
+ #ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+ #endif
+
return res;
}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
index 5c853a7..b51adca 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
@@ -52,45 +52,6 @@ int sdivider(int N, int D) {
}
}
-unsigned int divider(unsigned int x, unsigned int y)
-{
- unsigned int r0, q0, y0, y1;
-
- r0 = x;
- q0 = 0;
- y0 = y;
- y1 = y;
- do
- {
- y1 = 2 * y1;
- } while (y1 <= x);
- do
- {
- y1 = y1 / 2;
- q0 = 2 * q0;
- if (r0 >= y1)
- {
- r0 = r0 - y1;
- q0 = q0 + 1;
- }
- } while ((int)y1 != (int)y0);
- return q0;
-}
-
-int sdivider(int N, int D) {
- if (D < 0) {
- if (N < 0)
- return divider(-N, -D);
- else
- return -divider(N, -D);
- } else {
- if (N < 0)
- return -divider(-N, D);
- else
- return divider(N, D);
- }
-}
-
#define plus(i) i = i + ONE
/* Include polybench common header. */
static
@@ -118,11 +79,11 @@ int print_array(int n,
int res = 0;
for (i = 0; i < n; plus(i)) {
- res += y[i];
+ res ^= y[i];
}
#ifndef SYNTHESIS
- printf("finished = %u\n", res);
+ printf("finished: %u\n", res);
#endif
return res;
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c b/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
index d925db8..759d6ff 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
@@ -17,7 +17,11 @@
#include "../../include/misc.h"
-#define plus(n) ((n = n + 1))
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
+#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -25,11 +29,14 @@ void init_array (int n,
{
int i, j;
- for (i = 0; i < n; i++) {
- for (j = 0; j <= i; j++)
- A[i][j] = (-j % n) / n + 1;
- for (j = i+1; j < n; j++) {
- A[i][j] = 0;
+ for (i = 0; i < n; plus(i))
+ {
+ for (j = 0; j <= i; plus(j))
+ A[i][j] = sdivider(smodulo(-j, n), n) + ONE;
+ for (j = i+1; j < n; plus(j)) {
+ A[i][j] = 0;
+ }
+ A[i][i] = 1;
}
A[i][i] = 1;
}
@@ -53,27 +60,6 @@ void init_array (int n,
}
-
-/*static
- void print_array(int n,
- int A[ 40 + 0][40 + 0])
-
- {
- int i, j;
-
- fprintf(stderr, "==BEGIN DUMP_ARRAYS==\n");
- fprintf(stderr, "begin dump: %s", "A");
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++) {
- if ((i * n + j) % 20 == 0) fprintf (stderr, "\n");
- fprintf (stderr, "%d ", A[i][j]);
- }
- fprintf(stderr, "\nend dump: %s\n", "A");
- fprintf(stderr, "==END DUMP_ARRAYS==\n");
- }
-*/
-
-
static
void kernel_lu(int n,
int A[ 40][40])
@@ -107,6 +93,9 @@ int check_array(int n,
for (i = 0; i < n; plus(i))
for (j = 0; j < n; plus(j))
if(A[i][j] !=0) res = 1;
+ #ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+ #endif
return res;
}
@@ -123,8 +112,6 @@ int main()
init_array (n, A);
-
-
kernel_lu (n, A);
return check_array(n, A);
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c b/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c
index f37d983..0f4522e 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c
@@ -11,6 +11,10 @@
#include "../../include/misc.h"
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
#define plus(i) i = i + ONE
static
@@ -71,8 +75,11 @@ int check_array(int n,
int res = 0;
for (i = 0; i < n; plus(i)) {
- res += x[i];
+ res ^= x[i];
}
+#ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+#endif
return res;
}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c b/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
index 8e76231..2f636df 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.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,
@@ -23,7 +28,7 @@ void init_array(int n,
for (i = 0; i < n; plus(i))
{
- x[i] = - 999;
+ x[i] = -999;
b[i] = i ;
for (j = 0; j <= i; plus(j))
L[i][j] = (int) divider((i+n-j+ONE)*(ONE+ONE), n);
@@ -42,8 +47,12 @@ int check_array(int n,
int res = 0;
int ONE = 1;
for (i = 0; i < n; plus(i)) {
- res += x[i];
+ res ^= x[i];
}
+
+#ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+#endif
return res;
}