diff --git a/codes/gemver/data.bin b/codes/gemver/data.bin new file mode 100644 index 0000000000000000000000000000000000000000..1092681e1971a58a2c960e2d813b34116dcbacbf Binary files /dev/null and b/codes/gemver/data.bin differ diff --git a/codes/gemver/data.o b/codes/gemver/data.o new file mode 100644 index 0000000000000000000000000000000000000000..6c0c4a638820502902f15f7dff0d59ad85862cb6 Binary files /dev/null and b/codes/gemver/data.o differ diff --git a/codes/gemver/gemver.c b/codes/gemver/gemver.c index a8008a81e0309be1a3fee958fce88d657c89051c..8c300358add26076d7c0774ceacf4bc255903277 100644 --- a/codes/gemver/gemver.c +++ b/codes/gemver/gemver.c @@ -77,6 +77,26 @@ 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(w,N,n)) +{ + int i; + double err = 0; + double *accurate = &_binary_data_bin_start; + double *test = &(w[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. */ @@ -171,6 +191,8 @@ int main(int argc, char** argv) by the function call in argument. */ polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(w))); + calc_error(n, POLYBENCH_ARRAY(w)); + /* Be clean. */ POLYBENCH_FREE_ARRAY(A); POLYBENCH_FREE_ARRAY(u1);