Code

OpenMP fix for Linux & OS X
authorJosh Andler <scislac@gmail.com>
Wed, 21 Jul 2010 19:41:17 +0000 (12:41 -0700)
committerJosh Andler <scislac@gmail.com>
Wed, 21 Jul 2010 19:41:17 +0000 (12:41 -0700)
configure.ac
src/display/nr-filter-gaussian.cpp

index 8305429105421577f48271f68aec9d2b03f27ae0..b3c9fd06a9f75bd4ad5c5a54eee96c65a0ed65dd 100644 (file)
@@ -192,6 +192,7 @@ if test "x$openmp_ok" = "xyes"; then
        dnl We have it, now set up the flags
        CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
        AC_CHECK_HEADER(omp.h)
+       AC_DEFINE(HAVE_OPENMP, 1, [Use OpenMP])
 fi
 
 dnl ******************************
index 9509eaef7f2e4b02e3aeb19c25c5aac57d6252c5..a45e838da1ac4e3197fe3f744346b79f4ef07d31 100644 (file)
@@ -590,7 +590,8 @@ int FilterGaussian::render(FilterSlot &slot, FilterUnits const &units)
     double const deviation_y_org = _deviation_y * trans.expansionY();
     int const PC = NR_PIXBLOCK_BPP(in);
 #if HAVE_OPENMP
-    int const NTHREADS = std::max(1,std::min(8, Inkscape::Preferences::get()->getInt("/options/threading/numthreads", omp_get_num_procs())));
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    int const NTHREADS = prefs->getIntLimited("/options/threading/numthreads", omp_get_num_procs(), 1, 256);
 #else
     int const NTHREADS = 1;
 #endif // HAVE_OPENMP