aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/medley/floyd-warshall.c
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-08-13 23:24:40 +0100
committerYann Herklotz <git@yannherklotz.com>2020-08-13 23:24:40 +0100
commit045c0dc29fc31a8d3f15da8b3130dbc4706ea581 (patch)
tree56e9eb2ec6c318648e47c43d6b8abb2458ae236e /benchmarks/polybench-syn/medley/floyd-warshall.c
parent3971466fbdd9aa1883a4468de3d67fdf90fee02d (diff)
downloadvericert-kvx-045c0dc29fc31a8d3f15da8b3130dbc4706ea581.tar.gz
vericert-kvx-045c0dc29fc31a8d3f15da8b3130dbc4706ea581.zip
Add modified polybench benchmarks
Diffstat (limited to 'benchmarks/polybench-syn/medley/floyd-warshall.c')
-rw-r--r--benchmarks/polybench-syn/medley/floyd-warshall.c89
1 files changed, 89 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;
+}