diff --git a/codes/trmm/data.bin b/codes/trmm/data.bin new file mode 100644 index 0000000000000000000000000000000000000000..b472a763d050e87386ac682cf1e02c1c0c8e9e39 Binary files /dev/null and b/codes/trmm/data.bin differ diff --git a/codes/trmm/data.o b/codes/trmm/data.o new file mode 100644 index 0000000000000000000000000000000000000000..268f3a4ad3a018cecafb0a9b20b74e735bc16a6a Binary files /dev/null and b/codes/trmm/data.o differ diff --git a/codes/trmm/trmm.c b/codes/trmm/trmm.c index 5b8ab595ece26898d4be34c948d98c82d3a25801..062cf1e3087bb43128bd8f0571cd6635e262565d 100644 --- a/codes/trmm/trmm.c +++ b/codes/trmm/trmm.c @@ -63,6 +63,25 @@ void print_array(int m, int n, POLYBENCH_DUMP_FINISH; } +extern double _binary_data_bin_start; +extern double _binary_data_bin_end; + +static +void calc_error(int m, int n, + DATA_TYPE POLYBENCH_2D(B,M,N,m,n)) +{ + int i; + double err = 0; + double *accurate = &_binary_data_bin_start; + double *test = &(B[0][0]); + + /* calculate the mean squared error */ + for (i = 0; i < m*n; i++) { + err += (accurate[i] - test[i])*(accurate[i] - test[i]); + } + err /= m*n; + printf("error: %f\n", err); +} /* Main computational kernel. The whole function will be timed, including the call and return. */ @@ -122,6 +141,8 @@ int main(int argc, char** argv) by the function call in argument. */ polybench_prevent_dce(print_array(m, n, POLYBENCH_ARRAY(B))); + calc_error(m, n, POLYBENCH_ARRAY(B)); + /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B);