aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-07-04 14:18:10 +0100
committerNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-07-04 14:18:10 +0100
commitc62c0f75b5df4063c19d6a73378a4f3b49738a3d (patch)
tree57421af5a8581159a9d9b1acd309dc84aab5fb60
parent985f425eb77478a55e9cc8359229798128ff9840 (diff)
downloadvericert-kvx-c62c0f75b5df4063c19d6a73378a4f3b49738a3d.tar.gz
vericert-kvx-c62c0f75b5df4063c19d6a73378a4f3b49738a3d.zip
polybench medley
-rw-r--r--benchmarks/polybench-syn/medley/floyd-warshall.c89
-rw-r--r--benchmarks/polybench-syn/medley/nussinov.c104
2 files changed, 193 insertions, 0 deletions
diff --git a/benchmarks/polybench-syn/medley/floyd-warshall.c b/benchmarks/polybench-syn/medley/floyd-warshall.c
new file mode 100644
index 0000000..46f6774
--- /dev/null
+++ b/benchmarks/polybench-syn/medley/floyd-warshall.c
@@ -0,0 +1,89 @@
+/**
+ * This version is stamped on May 10, 2016
+ *
+ * Contact:
+ * Louis-Noel Pouchet <pouchet.ohio-state.edu>
+ * Tomofumi Yuki <tomofumi.yuki.fr>
+ *
+ * Web address: http://polybench.sourceforge.net
+ */
+/* floyd-warshall.c: this file is part of PolyBench/C */
+
+
+#define plus(i) i = i + ONE
+static
+void init_array (int n,
+ int path[ 60 + 0][60 + 0])
+{
+ int i, j;
+ int ONE = 1;
+ int N7 = 7;
+ int N11 = 11;
+ int N13 = 13;
+
+ for (i = 0; i < n; plus(i))
+ for (j = 0; j < n; plus(j)) {
+ path[i][j] = i*j%N7+ONE;
+ if ((i+j)%N13 == 0 || (i+j)%N7==0 || (i+j)%N11 == 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];
+ }
+ return res;
+}
+
+
+
+
+static
+void kernel_floyd_warshall(int n,
+ int path[ 60 + 0][60 + 0])
+{
+ int i, j, k;
+ int ONE = 1;
+
+#pragma scop
+ 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];
+ }
+#pragma endscop
+
+}
+
+
+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/medley/nussinov.c b/benchmarks/polybench-syn/medley/nussinov.c
new file mode 100644
index 0000000..fd33ec4
--- /dev/null
+++ b/benchmarks/polybench-syn/medley/nussinov.c
@@ -0,0 +1,104 @@
+/**
+ * This version is stamped on May 10, 2016
+ *
+ * Contact:
+ * Louis-Noel Pouchet <pouchet.ohio-state.edu>
+ * Tomofumi Yuki <tomofumi.yuki.fr>
+ *
+ * Web address: http://polybench.sourceforge.net
+ */
+/* nussinov.c: this file is part of PolyBench/C */
+
+typedef int base;
+
+#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;
+
+
+ for (i=0; i <n; plus(i)) {
+ seq[i] = (base)((i+ONE)%4);
+ }
+
+ for (i=0; i <n; plus(i))
+ for (j=0; j <n; plus(j))
+ table[i][j] = 0;
+}
+
+
+
+
+static
+int print_array(int n,
+ int table[ 60 + 0][60 + 0])
+
+{
+ int i, j;
+ int ONE = 1;
+ int res = 0;
+
+ for (i = 0; i < n; plus(i)) {
+ for (j = i; j < n; plus(j)) {
+ res ^= table[i][j];
+ }
+ }
+ return res;
+}
+
+static
+void kernel_nussinov(int n, base seq[ 60 + 0],
+ int table[ 60 + 0][60 + 0])
+{
+ int i, j, k;
+ int ONE = 1;
+ int THREE = 3;
+
+#pragma scop
+ for (i = n-ONE; i >= 0; i=i-ONE) {
+ for (j=i+ONE; j<n; plus(j)) {
+
+ if (j-ONE>=0)
+ table[i][j] = ((table[i][j] >= table[i][j-ONE]) ? table[i][j] : table[i][j-ONE]);
+ if (i+ONE<n)
+ table[i][j] = ((table[i][j] >= table[i+ONE][j]) ? table[i][j] : table[i+ONE][j]);
+
+ if (j-ONE>=0 && i+ONE<n) {
+
+ if (i<j-ONE)
+ table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0));
+ 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<j; plus(k)) {
+ table[i][j] = ((table[i][j] >= table[i][k] + table[k+ONE][j]) ? table[i][j] : table[i][k] + table[k+ONE][j]);
+ }
+ }
+ }
+#pragma endscop
+
+}
+
+
+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);
+
+}