diff liboctave/numeric/oct-fftw.h @ 15960:bde7731b2b83

added FFTW multithreaded library support build-aux/common.mk: added FFTW3_THREADS_LIBS and FFTW3F_THREADS_LIB configure.ac: added checks for threaded fftw libs and --disable-fftw-threads switch libinterp/dldfcn/fftw.cc: added fftw ("threads", ...) getter and setter liboctave/numeric/oct-fftw.cc: added use of multithreaded FFT liboctave/numeric/oct-fftw.h: added nthreads getter and setter
author Andreas Weber <andy.weber.aw@gmail.com>
date Mon, 14 Jan 2013 21:01:49 +0100
parents 142de7308ebf
children d63878346099
line wrap: on
line diff
--- a/liboctave/numeric/oct-fftw.h	Mon Jan 14 20:26:36 2013 -0500
+++ b/liboctave/numeric/oct-fftw.h	Mon Jan 14 21:01:49 2013 +0100
@@ -98,6 +98,24 @@
     return instance_ok () ? instance->do_method (_meth) : dummy;
   }
 
+#if defined (HAVE_FFTW3F_THREADS)
+  static void threads (int _nthreads)
+  {
+    if (instance_ok () && _nthreads != threads ())
+      {
+        instance->nthreads = _nthreads;
+        fftw_plan_with_nthreads (_nthreads);
+        //Clear the current plans
+        instance->rplan = instance->plan[0] = instance->plan[1] = 0;
+      }
+  }
+
+  static int threads ()
+  {
+    return instance_ok () ? instance->nthreads : 0;
+  }
+#endif
+
 private:
 
   // No copying!
@@ -169,6 +187,11 @@
   dim_vector rn;
 
   bool rsimd_align;
+
+#if defined (HAVE_FFTW3_THREADS)
+  //number of threads when compiled with Multi-threading support
+  int nthreads;
+#endif
 };
 
 class
@@ -235,6 +258,24 @@
     return instance_ok () ? instance->do_method (_meth) : dummy;
   }
 
+#if defined (HAVE_FFTW3F_THREADS)
+  static void threads (int _nthreads)
+  {
+    if (instance_ok () && _nthreads != threads ())
+      {
+        instance->nthreads = _nthreads;
+        fftwf_plan_with_nthreads (_nthreads);
+        //Clear the current plans
+        instance->rplan = instance->plan[0] = instance->plan[1] = 0;
+      }
+  }
+
+  static int threads ()
+  {
+    return instance_ok () ? instance->nthreads : 0;
+  }
+#endif
+
 private:
 
   // No copying!
@@ -306,6 +347,11 @@
   dim_vector rn;
 
   bool rsimd_align;
+
+#if defined (HAVE_FFTW3F_THREADS)
+  //number of threads when compiled with Multi-threading support
+  int nthreads;
+#endif
 };
 
 class