diff --git a/codes/2mm/2mm.c b/codes/2mm/2mm.c
index a1b42ee6ed95e638dcc559b036e619d7ebb3098e..7c78512bc0e4c2d4f6df940a22aa3de928358c0f 100644
--- a/codes/2mm/2mm.c
+++ b/codes/2mm/2mm.c
@@ -69,6 +69,25 @@ void print_array(int ni, int nl,
   POLYBENCH_DUMP_FINISH;
 }
 
+extern double _binary_data_bin_start;
+extern double _binary_data_bin_end;
+
+static
+void calc_error(int ni, int nl,
+		 DATA_TYPE POLYBENCH_2D(D,NI,NL,ni,nl))
+{
+    int i;
+    double err = 0;
+    double *accurate = &_binary_data_bin_start;
+    double *test = &(D[0][0]);
+
+    /* calculate the mean squared error */
+    for (i = 0; i < ni*nl; i++) {
+        err += (accurate[i] - test[i])*(accurate[i] - test[i]);
+    }
+    err /= ni*nl;
+    printf("error: %f\n", err);
+}
 
 /* Main computational kernel. The whole function will be timed,
    including the call and return. */
@@ -149,6 +168,8 @@ int main(int argc, char** argv)
      by the function call in argument. */
   polybench_prevent_dce(print_array(ni, nl,  POLYBENCH_ARRAY(D)));
 
+  calc_error(ni, nl,  POLYBENCH_ARRAY(D));
+
   /* Be clean. */
   POLYBENCH_FREE_ARRAY(tmp);
   POLYBENCH_FREE_ARRAY(A);
diff --git a/codes/2mm/data.bin b/codes/2mm/data.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e09d253e2e399650dd03a2549e8e2af99b851143
Binary files /dev/null and b/codes/2mm/data.bin differ
diff --git a/codes/2mm/data.o b/codes/2mm/data.o
new file mode 100644
index 0000000000000000000000000000000000000000..4e379af9a2ac4eaf9a3fbe8eb4f4777b364f4ae8
Binary files /dev/null and b/codes/2mm/data.o differ