From 045c0dc29fc31a8d3f15da8b3130dbc4706ea581 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 13 Aug 2020 23:24:40 +0100 Subject: Add modified polybench benchmarks --- .../polybench-syn/linear-algebra/blas/trmm.c | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 benchmarks/polybench-syn/linear-algebra/blas/trmm.c (limited to 'benchmarks/polybench-syn/linear-algebra/blas/trmm.c') diff --git a/benchmarks/polybench-syn/linear-algebra/blas/trmm.c b/benchmarks/polybench-syn/linear-algebra/blas/trmm.c new file mode 100644 index 0000000..79b384d --- /dev/null +++ b/benchmarks/polybench-syn/linear-algebra/blas/trmm.c @@ -0,0 +1,96 @@ +/** + * This version is stamped on May 10, 2016 + * + * Contact: + * Louis-Noel Pouchet + * Tomofumi Yuki + * + * Web address: http://polybench.sourceforge.net + */ +/* trmm.c: this file is part of PolyBench/C */ + + +#define plus(i) i = i + ONE +static +void init_array(int m, int n, + int *alpha, + int A[ 20 + 0][20 + 0], + int B[ 20 + 0][30 + 0]) +{ + int i, j; + int ONE = 1; + + *alpha = 3; + for (i = 0; i < m; plus(i)) { + for (j = 0; j < i; plus(j)) { + A[i][j] = (int)((i+j) % m)/m; + } + A[i][i] = 1; + for (j = 0; j < n; plus(j)) { + B[i][j] = (int)((n+(i-j)) % n)/n; + } + } + +} + + + + +static +int print_array(int m, int n, + int B[ 20 + 0][30 + 0]) +{ + int i, j; + int ONE = 1; + int res = 0; + + for (i = 0; i < m; plus(i)) + for (j = 0; j < n; plus(j)) { + res ^= B[i][j]; + } + return res; +} + + + + +static +void kernel_trmm(int m, int n, + int alpha, + int A[ 20 + 0][20 + 0], + int B[ 20 + 0][30 + 0]) +{ + int i, j, k; + int ONE = 1; +#pragma scop + for (i = 0; i < m; plus(i)) + for (j = 0; j < n; plus(j)) { + for (k = i+ONE; k < m; plus(k)) + B[i][j] += A[k][i] * B[k][j]; + B[i][j] = alpha * B[i][j]; + } +#pragma endscop + +} + + +int main() +{ + + int m = 20; + int n = 30; + + + int alpha; + int A[20 + 0][20 + 0]; + int B[20 + 0][30 + 0]; + + + init_array (m, n, &alpha, A, B); + + + kernel_trmm (m, n, alpha, A, B); + + return print_array(m, n, B); + +} -- cgit