diff --git a/codes/gesummv/data.bin b/codes/gesummv/data.bin new file mode 100644 index 0000000000000000000000000000000000000000..7b4f23d406d69a2312caccf08ecc0408e7aefdd7 Binary files /dev/null and b/codes/gesummv/data.bin differ diff --git a/codes/gesummv/data.o b/codes/gesummv/data.o new file mode 100644 index 0000000000000000000000000000000000000000..c0ee4743d8c6414f9c9b97700288803f021c2710 Binary files /dev/null and b/codes/gesummv/data.o differ diff --git a/codes/gesummv/gesummv.c b/codes/gesummv/gesummv.c index c5e2cd6d2353f64f7f089302d4e1a5710840a457..fe523fed082fa48b6c9a4b6887adcdad619fb539 100644 --- a/codes/gesummv/gesummv.c +++ b/codes/gesummv/gesummv.c @@ -64,6 +64,25 @@ void print_array(int n, POLYBENCH_DUMP_FINISH; } +extern double _binary_data_bin_start; +extern double _binary_data_bin_end; + +static +void calc_error(int n, + DATA_TYPE POLYBENCH_1D(y,N,n)) +{ + int i; + double err = 0; + double *accurate = &_binary_data_bin_start; + double *test = &(y[0]); + + /* calculate the mean squared error */ + for (i = 0; i < n; i++) { + err += (accurate[i] - test[i])*(accurate[i] - test[i]); + } + err /= n; + printf("error: %f\n", err); +} /* Main computational kernel. The whole function will be timed, including the call and return. */ @@ -136,6 +155,8 @@ int main(int argc, char** argv) by the function call in argument. */ polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(y))); + calc_error(n, POLYBENCH_ARRAY(y)); + /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(B);