octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multithreaded FFTW3 in octave?


From: Andreas Weber
Subject: Multithreaded FFTW3 in octave?
Date: Wed, 12 Dec 2012 13:56:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10

Dear maintainers,

Why does octave not use the multithreaded FFTW3 libs or am I missing a configure flag?

I tried some changes (set nthreads fixed to 6)

diff -r 0dcaf0e68a79 liboctave/numeric/oct-fftw.cc
--- a/liboctave/numeric/oct-fftw.cc    Wed Dec 12 10:02:46 2012 +0100
+++ b/liboctave/numeric/oct-fftw.cc    Wed Dec 12 13:43:46 2012 +0100
@@ -64,6 +64,9 @@
   simd_align[0] = simd_align[1] = false;
   inplace[0] = inplace[1] = false;
   n[0] = n[1] = dim_vector ();
+
+  fftw_init_threads();
+  fftw_plan_with_nthreads(6);

   // If we have a system wide wisdom file, import it.
   fftw_import_system_wisdom ();


And another quick&dirty hack to link octave against "libfftw3_threads" in src/Makefile

After these 3 changes and compilation I run "make check" and all fft test ran fine. Then I made a little test:

for k=1:5
    a=rand(5000,5000);
    tic;
    b=fft2(a);
    toc;
endfor

Output without multithreading FFTW:
Elapsed time is 1.37438 seconds.
Elapsed time is 1.38043 seconds.
Elapsed time is 1.3756 seconds.
Elapsed time is 1.37472 seconds.
Elapsed time is 1.4059 seconds.

Output with multithreading FFTW (above 3 changes):
Elapsed time is 0.521382 seconds.
Elapsed time is 0.519745 seconds.
Elapsed time is 0.519839 seconds.
Elapsed time is 0.52183 seconds.
Elapsed time is 0.518955 seconds.

Used CPU is AMD Phenom(tm) II X6 1055T Processor

Regards, Andy

--
Mit freundlichen Grüßen

Dipl.-Ing.(FH) Andreas Weber
Akademischer Mitarbeiter
Fakultät Elektrotechnik und Informationstechnik

Hochschule Offenburg - University of Applied Sciences Offenburg
Badstraße 24
77652 Offenburg
Telefon +49 781 205-386



reply via email to

[Prev in Thread] Current Thread [Next in Thread]