Commit 026a9410 authored by Michael Kuron's avatar Michael Kuron
Browse files

Intel 2018 OpenMP support and fix for -qopenmp in 2015 and higher

Also adds OpenMP support for macOS (requires Xcode 7.0, CMake 3.12 and separate libomp from MacPorts/Homebrew)
parent e803bb59
......@@ -1027,26 +1027,14 @@ endif()
option ( WALBERLA_THREAD_SAFE_LOGGING "Enables/Disables thread-safe logging" ON )
if ( WALBERLA_BUILD_WITH_OPENMP )
if ( WALBERLA_CXX_COMPILER_IS_INTEL )
add_flag ( CMAKE_C_FLAGS "-openmp" )
add_flag ( CMAKE_CXX_FLAGS "-openmp" )
elseif ( CMAKE_COMPILER_IS_GNUCXX )
add_flag ( CMAKE_C_FLAGS "-fopenmp" )
add_flag ( CMAKE_CXX_FLAGS "-fopenmp" )
elseif ( WALBERLA_CXX_COMPILER_IS_CLANG )
add_flag ( CMAKE_C_FLAGS "-fopenmp" )
add_flag ( CMAKE_CXX_FLAGS "-fopenmp" )
elseif ( WALBERLA_CXX_COMPILER_IS_MSVC )
add_flag ( CMAKE_C_FLAGS "/openmp" )
add_flag ( CMAKE_CXX_FLAGS "/openmp" )
elseif ( WALBERLA_CXX_COMPILER_IS_IBM )
add_flag ( CMAKE_C_FLAGS "-qsmp=omp" )
add_flag ( CMAKE_CXX_FLAGS "-qsmp=omp" )
# There has been an internal compiler error with the IBM compiler, so WALBERLA_THREAD_SAFE_LOGGING is disabled by default for this compiler
set ( WALBERLA_THREAD_SAFE_LOGGING OFF CACHE BOOL "Enables/Disables thread-safe logging" FORCE )
elseif ( WALBERLA_CXX_COMPILER_IS_NEC )
if ( WALBERLA_CXX_COMPILER_IS_NEC )
add_flag ( CMAKE_C_FLAGS "-Popenmp" )
add_flag ( CMAKE_CXX_FLAGS "-Popenmp" )
else()
find_package( OpenMP )
add_flag ( CMAKE_C_FLAGS "${OpenMP_C_FLAGS}" )
add_flag ( CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}" )
list ( APPEND SERVICE_LIBS ${OpenMP_CXX_LIBRARIES} )
endif()
else()
if ( WALBERLA_CXX_COMPILER_IS_CRAY )
......
......@@ -63,7 +63,7 @@ void Abort::defaultAbort( const std::string & logMessage, const std::string & ca
#ifdef _OPENMP
#pragma omp critical (abort)
#pragma omp critical (Abort_abort)
{
#endif
......
......@@ -43,7 +43,7 @@ std::mt19937 & getGenerator() // std::mt19937_64
void seedRandomGenerator( const std::mt19937::result_type & seed )
{
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
internal::getGenerator().seed( seed );
}
......
......@@ -59,7 +59,7 @@ INT intRandom( const INT min, const INT max, std::mt19937 & generator )
INT value;
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
{ value = distribution( generator ); }
......@@ -76,7 +76,7 @@ inline char intRandom<char>( const char min, const char max, std::mt19937 & gene
char value;
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
{ value = static_cast<char>( distribution( generator ) ); }
......@@ -93,7 +93,7 @@ inline unsigned char intRandom<unsigned char>( const unsigned char min, const un
unsigned char value;
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
{ value = static_cast<unsigned char>( distribution( generator ) ); }
......@@ -110,7 +110,7 @@ inline signed char intRandom<signed char>( const signed char min, const signed c
signed char value;
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
{ value = static_cast<signed char>( distribution( generator ) ); }
......@@ -168,7 +168,7 @@ REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), std::mt1993
REAL value;
#ifdef _OPENMP
#pragma omp critical (random)
#pragma omp critical (Random_random)
#endif
{ value = distribution( generator ); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment