Mercurial > octave-dspies
diff liboctave/numeric/oct-fftw.cc @ 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 | 648dabbb4c6b |
children | d63878346099 |
line wrap: on
line diff
--- a/liboctave/numeric/oct-fftw.cc Mon Jan 14 20:26:36 2013 -0500 +++ b/liboctave/numeric/oct-fftw.cc Mon Jan 14 21:01:49 2013 +0100 @@ -35,6 +35,10 @@ #include "oct-locbuf.h" #include "singleton-cleanup.h" +#if defined (HAVE_FFTW3_THREADS) +#include "nproc.h" +#endif + octave_fftw_planner *octave_fftw_planner::instance = 0; // Helper class to create and cache FFTW plans for both 1D and @@ -65,6 +69,16 @@ inplace[0] = inplace[1] = false; n[0] = n[1] = dim_vector (); +#if defined (HAVE_FFTW3_THREADS) + int init_ret = fftw_init_threads (); + if (!init_ret) + (*current_liboctave_error_handler) ("Error initializing FFTW threads"); + //Use number of processors available to the current process + //This can be later changed with fftw ("threads", nthreads) + nthreads = num_processors (NPROC_CURRENT); + fftw_plan_with_nthreads (nthreads); +#endif + // If we have a system wide wisdom file, import it. fftw_import_system_wisdom (); } @@ -395,6 +409,16 @@ inplace[0] = inplace[1] = false; n[0] = n[1] = dim_vector (); +#if defined (HAVE_FFTW3F_THREADS) + int init_ret = fftwf_init_threads (); + if (!init_ret) + (*current_liboctave_error_handler) ("Error initializing FFTW3F threads"); + //Use number of processors available to the current process + //This can be later changed with fftw ("threads", nthreads) + nthreads = num_processors (NPROC_CURRENT); + fftwf_plan_with_nthreads (nthreads); +#endif + // If we have a system wide wisdom file, import it. fftwf_import_system_wisdom (); }