Skip to content
Snippets Groups Projects
Commit 94155cc8 authored by Lars Bilke's avatar Lars Bilke
Browse files

Removed -march switch on Mac gcc 4.2.1 and correctly set OpenMP settings.

Wrapped OpenMP includes in #ifdefs.
parent a595c74f
No related branches found
No related tags found
No related merge requests found
......@@ -4,23 +4,35 @@ cmake_minimum_required(VERSION 2.6)
# Project name
project( OGS-6 )
# Set cmake module path
# Set cmake module path
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/scripts/cmake/cmake"
"${CMAKE_SOURCE_DIR}/scripts/cmake")
# Set cmake module path
#SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeConfiguration")
INCLUDE(GetCompilerInfoString)
# Finds
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
### For GNU C/CXX
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
get_gcc_version(GCC_VERSION)
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
MESSAGE(STATUS "Set GCC release flags")
SET(CMAKE_CXX_FLAGS "-O3 -march=native -mtune=native -msse4.2 -DNDEBUG")
IF(APPLE AND GCC_VERSION VERSION_LESS "4.3" AND NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode" )
# -march=native does not work here when on normal gcc compiler
# see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33144
SET(CMAKE_CXX_FLAGS "-O3 -mtune=native -msse4.2 -DNDEBUG")
ELSE()
SET(CMAKE_CXX_FLAGS "-O3 -march=native -mtune=native -msse4.2 -DNDEBUG")
ENDIF()
ENDIF()
# -g
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wall -Wextra -fno-nonansi-builtins")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ADD_DEFINITIONS(
-DGCC
)
......
......@@ -7,7 +7,9 @@
#include <limits>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "MathTools.h"
#include "blas.h"
......
#ifndef CRSMATRIXDIAGPRECOND_H
#define CRSMATRIXDIAGPRECOND_H
//#include <omp.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "CRSMatrix.h"
#include "sparse.h"
......
......@@ -7,7 +7,9 @@
#include "amuxCRS.h"
#include <cstddef>
#ifdef _OPENMP
#include <omp.h>
#endif
#ifdef HAVE_PTHREADS
#include <pthread.h>
#endif
......
......@@ -12,7 +12,9 @@
#include <cmath>
#include <limits>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "Point.h"
......
......@@ -2,7 +2,6 @@
#include <iostream>
#include <cmath>
#include <limits>
#include <omp.h>
#include <cstdlib>
#include "sparse.h"
#include "LinAlg/Sparse/CRSMatrix.h"
......@@ -11,6 +10,10 @@
#include "RunTimeTimer.h"
#include "CPUTimeTimer.h"
#ifdef _OPENMP
#include <omp.h>
#endif
int main(int argc, char *argv[])
{
if (argc < 4) {
......
......@@ -2,7 +2,6 @@
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <omp.h>
#include "LinAlg/Solvers/BiCGStab.h"
#include "LinAlg/Sparse/CRSMatrixDiagPrecond.h"
#include "sparse.h"
......@@ -10,6 +9,10 @@
#include "RunTimeTimer.h"
#include "CPUTimeTimer.h"
#ifdef _OPENMP
#include <omp.h>
#endif
int main(int argc, char *argv[])
{
if (argc != 4) {
......
......@@ -2,7 +2,6 @@
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <omp.h>
#include "LinAlg/Solvers/CG.h"
#include "LinAlg/Sparse/CRSMatrixDiagPrecond.h"
#include "sparse.h"
......@@ -10,6 +9,10 @@
#include "RunTimeTimer.h"
#include "CPUTimeTimer.h"
#ifdef _OPENMP
#include <omp.h>
#endif
int main(int argc, char *argv[])
{
if (argc != 4) {
......
#include <fstream>
#include <iostream>
#include <omp.h>
#include "LinAlg/Solvers/CG.h"
#include "LinAlg/Sparse/CRSMatrix.h"
#include "sparse.h"
#include "vector_io.h"
//#include "timeMeasurement.h"
#ifdef _OPENMP
#include <omp.h>
#endif
int main(int argc, char *argv[])
{
(void) argc;
......
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