[mlpack-git] master: Handle MSVC compiler properly; Visual Studio only supports OpenMP 2.5. OpenMP 3.0 is where unsigned indices are supported. (50629c1)

gitdub at mlpack.org gitdub at mlpack.org
Wed Feb 17 12:03:38 EST 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/c751e61c8e37360c93b664597c189fb984f32de2...50629c1d76780dc0c37c24b1dedb7794f4aa5447

>---------------------------------------------------------------

commit 50629c1d76780dc0c37c24b1dedb7794f4aa5447
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Feb 17 09:03:38 2016 -0800

    Handle MSVC compiler properly; Visual Studio only supports OpenMP 2.5.
    OpenMP 3.0 is where unsigned indices are supported.
    
    See also:
    
    https://github.com/VespucciProject/MLPACK_for_MSVC
    http://stackoverflow.com/questions/2820621/why-arent-unsigned-openmp-index-variables-allowed


>---------------------------------------------------------------

50629c1d76780dc0c37c24b1dedb7794f4aa5447
 src/mlpack/methods/det/dt_utils.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/det/dt_utils.cpp b/src/mlpack/methods/det/dt_utils.cpp
index 0bd0e11..78e15fd 100644
--- a/src/mlpack/methods/det/dt_utils.cpp
+++ b/src/mlpack/methods/det/dt_utils.cpp
@@ -177,10 +177,18 @@ DTree* mlpack::det::Trainer(arma::mat& dataset,
   regularizationConstants.fill(0.0);
 
   Timer::Start("cross_validation");
-  // Go through each fold.
+  // Go through each fold.  On the Visual Studio compiler, we have to use
+  // intmax_t because size_t is not yet supported by their OpenMP
+  // implementation.
+#ifdef _WIN32
+  #pragma omp parallel for default(none) \
+      shared(testSize, cvData, prunedSequence, regularizationConstants, dataset)
+  for (intmax_t fold = 0; fold < (intmax_t) folds; fold++)
+#else
   #pragma omp parallel for default(none) \
       shared(testSize, cvData, prunedSequence, regularizationConstants, dataset)
   for (size_t fold = 0; fold < folds; fold++)
+#endif
   {
     // Break up data into train and test sets.
     size_t start = fold * testSize;




More information about the mlpack-git mailing list