From aa986aacbb80e9f92f77d65de74ba5051054eac7 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 11 Jul 2021 01:19:52 +0200 Subject: Add divider benchmarks --- benchmarks/polybench-syn-div/medley/Makefile | 3 + .../polybench-syn-div/medley/floyd-warshall.c | 91 +++++++++++++++++ benchmarks/polybench-syn-div/medley/nussinov.c | 111 +++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 benchmarks/polybench-syn-div/medley/Makefile create mode 100644 benchmarks/polybench-syn-div/medley/floyd-warshall.c create mode 100644 benchmarks/polybench-syn-div/medley/nussinov.c (limited to 'benchmarks/polybench-syn-div/medley') diff --git a/benchmarks/polybench-syn-div/medley/Makefile b/benchmarks/polybench-syn-div/medley/Makefile new file mode 100644 index 0000000..816a0ce --- /dev/null +++ b/benchmarks/polybench-syn-div/medley/Makefile @@ -0,0 +1,3 @@ +TARGETS := floyd-warshall nussinov + +include ../common.mk diff --git a/benchmarks/polybench-syn-div/medley/floyd-warshall.c b/benchmarks/polybench-syn-div/medley/floyd-warshall.c new file mode 100644 index 0000000..74d5c9b --- /dev/null +++ b/benchmarks/polybench-syn-div/medley/floyd-warshall.c @@ -0,0 +1,91 @@ +/** + * This version is stamped on May 10, 2016 + * + * Contact: + * Louis-Noel Pouchet + * Tomofumi Yuki + * + * Web address: http://polybench.sourceforge.net + */ +/* floyd-warshall.c: this file is part of PolyBench/C */ + +#ifndef SYNTHESIS + #include +#endif + +#define plus(i) i = i + ONE +static +void init_array (int n, + int path[ 60 + 0][60 + 0]) +{ + int i, j; + int ONE = 1; + + for (i = 0; i < n; plus(i)) + for (j = 0; j < n; plus(j)) { + path[i][j] = i*(j % 7)+ONE; + //if (((i+j)%13 == ZERO || (i+j)%7== ZERO || (i+j)%11 == ZERO ) != 0 ) + if(((((i+j) % 13) == (int)0 || ((i+j) % 7) == (int)0)!=0 || ((i+j) % 11) == (int)0 ) != 0) + path[i][j] = 999; + } +} + + + + +static +int print_array(int n, + int path[ 60 + 0][60 + 0]) + +{ + int i, j; + int res = 0; + int ONE = 1; + + for (i = 0; i < n; plus(i)) + for (j = 0; j < n; plus(j)) { + res ^= path[i][j]; + } +#ifndef SYNTHESIS + printf("finished %u\n", res); +#endif + return res; +} + + + + +static +void kernel_floyd_warshall(int n, + int path[ 60 + 0][60 + 0]) +{ + int i, j, k; + int ONE = 1; + + for (k = 0; k < n; plus(k)) + { + for(i = 0; i < n; plus(i)) + for (j = 0; j < n; plus(j)) + path[i][j] = path[i][j] < path[i][k] + path[k][j] ? + path[i][j] : path[i][k] + path[k][j]; + } + +} + + +int main() +{ + + int n = 60; + + + int path[60 + 0][60 + 0]; + + init_array (n, path); + + kernel_floyd_warshall (n, path); + + return print_array(n, path); + + return 0; +} diff --git a/benchmarks/polybench-syn-div/medley/nussinov.c b/benchmarks/polybench-syn-div/medley/nussinov.c new file mode 100644 index 0000000..e2e06d3 --- /dev/null +++ b/benchmarks/polybench-syn-div/medley/nussinov.c @@ -0,0 +1,111 @@ +/** + * This version is stamped on May 10, 2016 + * + * Contact: + * Louis-Noel Pouchet + * Tomofumi Yuki + * + * Web address: http://polybench.sourceforge.net + */ +/* nussinov.c: this file is part of PolyBench/C */ + +typedef int base; + +#ifndef SYNTHESIS + #include +#endif + +#define plus(i) i = i + ONE +static +void init_array (int n, + base seq[ 60 + 0], + int table[ 60 + 0][60 + 0]) +{ + int i, j; + int ONE = 1; + int FOUR = 4; + + + for (i=0; i = ZERO; i=i-ONE) { + for (j=i+ONE; j=ZERO) + table[i][j] = ((table[i][j] >= table[i][j-ONE]) ? table[i][j] : table[i][j-ONE]); + if (i+ONE= table[i+ONE][j]) ? table[i][j] : table[i+ONE][j]); + + if ((j-ONE>=ZERO && i+ONE= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)); + else + table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]) ? table[i][j] : table[i+ONE][j-ONE]); + } + + for (k=i+ONE; k= table[i][k] + table[k+ONE][j]) ? table[i][j] : table[i][k] + table[k+ONE][j]); + } + } + } + +} + + +int main() +{ + + int n = 60; + + + base (seq)[60 + 0]; + int (table)[60 + 0][60 + 0]; + + + init_array (n, seq, table); + + kernel_nussinov (n, seq, table); + + return print_array(n, table); + +} -- cgit