Skip to content
Snippets Groups Projects
Commit 7d126836 authored by Daniel Maier's avatar Daniel Maier
Browse files

hotspot: error checking

parent 44da6e06
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,22 @@ void init_array (int m,
}
static
void calc_error(int m,
DATA_TYPE POLYBENCH_2D(corr,M,M,m,m))
{
int i, j;
double error = 0;
for (i = 0; i < m; i++)
for (j = 0; j < m; j++) {
error += (corr[i][j] - 1.0)*(corr[i][j] - 1.0);
}
error /= m*m;
error = sqrtf(error);
printf("error: %f\n", error);
}
/* DCE code. Must scan the entire live-out data.
Can be used also to check the correctness of the output. */
......@@ -158,6 +174,9 @@ int main(int argc, char** argv)
by the function call in argument. */
polybench_prevent_dce(print_array(m, POLYBENCH_ARRAY(corr)));
/* calculate error */
calc_error(m, POLYBENCH_ARRAY(corr));
/* Be clean. */
POLYBENCH_FREE_ARRAY(data);
POLYBENCH_FREE_ARRAY(corr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment