From d4ba40a24b5a44157c500634ccbba79aa9daff39 Mon Sep 17 00:00:00 2001 From: "Dmitry Yu. Naumov" <github@naumov.de> Date: Wed, 26 Sep 2018 14:04:58 +0200 Subject: [PATCH] [MaL] Remove OPENMP_LOOP_TYPE. Use int. --- MathLib/MathTools.h | 29 ++++------------------------- scripts/cmake/CompilerSetup.cmake | 2 -- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/MathLib/MathTools.h b/MathLib/MathTools.h index ae888eaa343..63d2643d7ba 100644 --- a/MathLib/MathTools.h +++ b/MathLib/MathTools.h @@ -28,17 +28,10 @@ template<typename T, int N> inline T scalarProduct(T const * const v0, T const * const v1) { T res (v0[0] * v1[0]); -#ifdef _OPENMP - OPENMP_LOOP_TYPE k; #pragma omp parallel for reduction (+:res) - for (k = 1; k<N; k++) { - res += v0[k] * v1[k]; - } -#else - for (std::size_t k(1); k < N; k++) + for (int k = 1; k < N; k++) res += v0[k] * v1[k]; -#endif return res; } @@ -51,28 +44,14 @@ double scalarProduct<double,3>(double const * const v0, double const * const v1) return res; } -template<typename T> inline -T scalarProduct(T const * const v0, T const * const v1, unsigned n) +template <typename T> +inline T scalarProduct(T const* const v0, T const* const v1, int const n) { T res (v0[0] * v1[0]); -#ifdef _OPENMP - OPENMP_LOOP_TYPE k; #pragma omp parallel for reduction (+:res) -#ifdef WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4018 ) -#endif - for (k = 1; k<n; k++) { - res += v0[k] * v1[k]; - } -#ifdef WIN32 -#pragma warning ( pop ) -#endif -#else - for (std::size_t k(1); k < n; k++) + for (int k = 1; k < n; k++) res += v0[k] * v1[k]; -#endif return res; } diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 25469f34206..5a355c5e582 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -47,7 +47,6 @@ if(COMPILER_IS_GCC OR COMPILER_IS_CLANG OR COMPILER_IS_INTEL) add_compile_options( -Wall -Wextra - -DOPENMP_LOOP_TYPE=unsigned ) # Profiling @@ -116,7 +115,6 @@ if(MSVC) /W3 /wd4290 /wd4267 /wd4996 /bigobj - -DOPENMP_LOOP_TYPE=int # Missing OpenMP 3.0 implementation fix for Windows, this fixes #6 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_XNONSTDC_NO_WARNINGS -- GitLab