Commit 3ad4a4a1 authored by Michael Kuron's avatar Michael Kuron
Browse files

Fix tests failing with new OpenMP on Intel compiler

- NearestNeighborFieldInterpolator::get needs to break out of all loops, just not the current one. While the test seemed to succeed anyway, it crashed with corrupted memory during exit when compiled with Intel 17 in Release mode.
- FftTest should not use thread-unsafe RNG in parallel section. Otherwise the Intel 16 compiler crashes.
- Revert to -openmp on Intel < 16.0.3, which crashes while processing some of our OpenMP loops (e.g. BoundaryHandling::treatDirection).
parent 026a9410
......@@ -1027,19 +1027,22 @@ endif()
option ( WALBERLA_THREAD_SAFE_LOGGING "Enables/Disables thread-safe logging" ON )
if ( WALBERLA_BUILD_WITH_OPENMP )
if ( WALBERLA_CXX_COMPILER_IS_NEC )
add_flag ( CMAKE_C_FLAGS "-Popenmp" )
add_flag ( CMAKE_CXX_FLAGS "-Popenmp" )
if ( WALBERLA_CXX_COMPILER_IS_INTEL AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "16.0.3" )
add_flag ( CMAKE_C_FLAGS "-openmp" )
add_flag ( CMAKE_CXX_FLAGS "-openmp" )
elseif ( 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} )
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 )
add_flag ( CMAKE_C_FLAGS "-h noomp" )
add_flag ( CMAKE_CXX_FLAGS "-h noomp" )
add_flag ( CMAKE_C_FLAGS "-h noomp" )
add_flag ( CMAKE_CXX_FLAGS "-h noomp" )
endif()
endif()
############################################################################################################################
......
......@@ -121,7 +121,7 @@ public:
*interpolationResultBegin = baseField_(curCell, f);
++interpolationResultBegin;
}
break;
return;
}
}
}
......
......@@ -41,7 +41,7 @@ int main (int argc, char** argv)
{
Field_T *data_in = block->getData< Field_T >( originalFieldId );
Field_T *data_out = block->getData< Field_T >( fftFieldId );
WALBERLA_FOR_ALL_CELLS_XYZ(data_in, {
WALBERLA_FOR_ALL_CELLS_XYZ_OMP(data_in, omp critical, {
Vector3<real_t> point( real_c(x), real_c(y), real_c(z) );
blocks->transformBlockLocalToGlobal(point, *block);
data_in->get(x,y,z) = real_c(std::ranlux48_base(uint_c(point[0])+(uint_c(point[1])*L+uint_c(point[2]))*L)())*real_c(std::pow(2,-48));
......
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