From 81f24412cd625e32f5ea4bc7fb2444d553f87eaf Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Fri, 16 Dec 2011 10:12:35 +0100
Subject: [PATCH] added some compile options for using the intel compiler

---
 CMakeLists.txt                                        | 11 +++++++++++
 .../ConjugateGradientDiagonalPreconditioned.cpp       |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfc224cfd15..175d3fb4781 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,17 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
         )
 ENDIF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
 
+IF (${CMAKE_C_COMPILER} MATCHES "icc.*$" OR ${CMAKE_CXX_COMPILER} MATCHES "icpc.*$") 
+        IF( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
+                MESSAGE(STATUS "Set Intel release flags")
+                SET(CMAKE_CXX_FLAGS "-O3 -DNDEBUG")
+        ENDIF()
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wall")
+        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp")
+ENDIF(${CMAKE_C_COMPILER} MATCHES "icc.*$" OR ${CMAKE_CXX_COMPILER} MATCHES
+"icpc.*$")
+
+
 # Set build directories
 SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
 SET( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib )
diff --git a/SimpleTests/SolverTests/ConjugateGradientDiagonalPreconditioned.cpp b/SimpleTests/SolverTests/ConjugateGradientDiagonalPreconditioned.cpp
index 44855d11098..d533628c419 100644
--- a/SimpleTests/SolverTests/ConjugateGradientDiagonalPreconditioned.cpp
+++ b/SimpleTests/SolverTests/ConjugateGradientDiagonalPreconditioned.cpp
@@ -64,7 +64,11 @@ int main(int argc, char *argv[])
 	if (num_omp_threads == 1) {
 		MathLib::CG(mat, b, x, eps, steps);
 	} else {
+		#ifdef _OPENMP
 		MathLib::CGParallel(mat, b, x, eps, steps, num_omp_threads);
+		#else
+		std::cout << "OpenMP is not switched on" << std::endl;
+		#endif
 	}
 
 	cpu_timer.stop();
-- 
GitLab