From c581a41d9c0a7e2c293faad1de1bb6db6cc78d1b Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 2 Jul 2012 15:42:35 +0200
Subject: [PATCH] added OpenMP guards and reformated output

---
 .../MatrixTests/MatVecMultNDPermOpenMP.cpp       | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/SimpleTests/MatrixTests/MatVecMultNDPermOpenMP.cpp b/SimpleTests/MatrixTests/MatVecMultNDPermOpenMP.cpp
index ca4e08c52fa..0077a6279f0 100644
--- a/SimpleTests/MatrixTests/MatVecMultNDPermOpenMP.cpp
+++ b/SimpleTests/MatrixTests/MatVecMultNDPermOpenMP.cpp
@@ -35,6 +35,10 @@
 #include "BuildInfo.h"
 #endif
 
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
 /**
  * new formatter for logog
  */
@@ -129,8 +133,16 @@ int main(int argc, char *argv[])
 		INFO("\tParameters read: n=%d, nnz=%d", n, nnz);
 	}
 
+#ifdef _OPENMP
+	omp_set_num_threads(n_threads);
 	MathLib::CRSMatrixReorderedOpenMP mat(n, iA, jA, A);
-
+#else
+	delete [] iA;
+	delete [] jA;
+	delete [] A;
+	ERROR("program is not using OpenMP");
+	return -1;
+#endif
 	double *x(new double[n]);
 	double *y(new double[n]);
 
@@ -185,7 +197,7 @@ int main(int argc, char *argv[])
 	run_timer.stop();
 
 	if (verbose) {
-		INFO("\t[MVM] - took %e sec\t %e sec", cpu_timer.elapsed(), run_timer.elapsed());
+		INFO("\t[MVM] - took %e sec cpu time, %e sec run time", cpu_timer.elapsed(), run_timer.elapsed());
 	}
 
 	delete [] x;
-- 
GitLab