diff --git a/MathLib/LinAlg/Solvers/CGParallel.cpp b/MathLib/LinAlg/Solvers/CGParallel.cpp index bdfa4cfb32ca3967c03b9ca0b115ab1ea66b0b7c..36caa026c381f4cefce333189a0419498a1b5f57 100644 --- a/MathLib/LinAlg/Solvers/CGParallel.cpp +++ b/MathLib/LinAlg/Solvers/CGParallel.cpp @@ -67,7 +67,7 @@ unsigned CGParallel(CRSMatrix<double,unsigned> const * mat, double const * const return 0; } - unsigned k; + OPENMP_LOOP_TYPE k; for (unsigned l = 1; l <= nsteps; ++l) { #ifndef NDEBUG std::cout << "Step " << l << ", resid=" << resid / nrmb << std::endl; diff --git a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h index cce05d48ad6da4df17c730bcc5fc388472f5b4cc..7fa2cf0ec399e71fde91f204068c74861a8f91a8 100644 --- a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h +++ b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h @@ -72,7 +72,7 @@ public: void precondApply(double* x) const { { - unsigned k; + OPENMP_LOOP_TYPE k; // #pragma omp parallel for for (k=0; k<_n_rows; ++k) { x[k] = _inv_diag[k]*x[k]; diff --git a/MathLib/LinAlg/Sparse/amuxCRS.h b/MathLib/LinAlg/Sparse/amuxCRS.h index 584ef3190a92d9299b07355e55fdd9f18951bf0d..bcc354f4541603017088c0ea2c57446d40c9e23d 100644 --- a/MathLib/LinAlg/Sparse/amuxCRS.h +++ b/MathLib/LinAlg/Sparse/amuxCRS.h @@ -28,7 +28,7 @@ void amuxCRSParallelOpenMP (FP_TYPE a, unsigned n, IDX_TYPE const * const __restrict__ iA, IDX_TYPE const * const __restrict__ jA, FP_TYPE const * const A, FP_TYPE const * const __restrict__ x, FP_TYPE* __restrict__ y) { - unsigned i; + OPENMP_LOOP_TYPE i; { #pragma omp parallel for for (i = 0; i < n; i++) { diff --git a/MathLib/MathTools.cpp b/MathLib/MathTools.cpp index 8058f11cc6421fc39a7be220fbd56c6382592103..de68f0338d476b7dabfde5e795d9ffaade5a3336 100644 --- a/MathLib/MathTools.cpp +++ b/MathLib/MathTools.cpp @@ -13,7 +13,7 @@ namespace MathLib { double scpr(double const * const v, double const * const w, unsigned n) { long double res (v[0]*w[0]); - unsigned k; + OPENMP_LOOP_TYPE k; #pragma omp parallel for reduction (+:res) for (k = 1; k<n; k++) { diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 4d414a8d6c76084f59505916b917fee631dcb500..8421b1eefc3973c37e5b760df34cbec945861324 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -63,3 +63,10 @@ IF (WIN32) ADD_DEFINITIONS( -DGCC ) ENDIF (MSVC) ENDIF (WIN32) + +# Missing OpenMP 3.0 implementation fix for Windows, this fixes #6 +IF(MSVC) + ADD_DEFINITIONS(-DOPENMP_LOOP_TYPE=int) +ELSE() + ADD_DEFINITIONS(-DOPENMP_LOOP_TYPE=unsigned) +ENDIF()