diff options
author | Michalis Pardalos <m.pardalos@gmail.com> | 2021-08-26 19:27:17 +0100 |
---|---|---|
committer | Michalis Pardalos <m.pardalos@gmail.com> | 2021-08-26 19:27:17 +0100 |
commit | b067e5c7b0ecce9ffbf21e9c4a7ff96328dec2ba (patch) | |
tree | d36a28e84827fe0bb8d7b87d9afa8475b7b2008e /benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c | |
parent | 4dca6dbd48d3e71eb550297d3325555f5e039bb8 (diff) | |
parent | 0c021173b3efb1310370de4b2a6f5444c745022f (diff) | |
download | vericert-b067e5c7b0ecce9ffbf21e9c4a7ff96328dec2ba.tar.gz vericert-b067e5c7b0ecce9ffbf21e9c4a7ff96328dec2ba.zip |
Merge branch 'oopsla21' into sharing-merge
Diffstat (limited to 'benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c')
-rw-r--r-- | benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c b/benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c new file mode 100644 index 0000000..3fdbc45 --- /dev/null +++ b/benchmarks/polybench-syn-div/linear-algebra/blas/trmm.c @@ -0,0 +1,99 @@ +/** + * 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 + */ +/* trmm.c: this file is part of PolyBench/C */ + +#ifndef SYNTHESIS + #include <stdio.h> +#endif +#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]; + } +#ifndef SYNTHESIS + printf("finished %u\n", res); +#endif + 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; + 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]; + } + +} + + +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); + +} |