|
From: | Andreas Weber |
Subject: | Re: Multithreaded FFTW3 in octave? |
Date: | Tue, 18 Dec 2012 11:51:00 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10 |
On 18.12.2012 05:08, Mike Miller wrote:
Hi Mike, I appreciate your comments,On Mon, Dec 17, 2012 at 1:04 PM, Jordi Gutiérrez Hermoso <address@hidden> wrote:On 16 December 2012 19:05, Andreas Weber <address@hidden> wrote:Hi Mike, I've attached a "first shot" patch whichI like this patch. At a glance, it looks like a very good addition. I'll wait for Mike's comments. If he doesn't merge it in within a couple of days, I will.Looks good overall, thanks for working on this. I just tested briefly and it works for me as expected, for the most part. I do have a few comments. Is there any "FFTW-compatible library"? I don't know one and as I kan see this also wasn't possible before my changes.The configure changes don't look quite right to me. I wouldn't make the HAVE_FFTW3_THREADS condition dependent on a separate fftw3_threads option. The way you have it here I don't think I can configure "--with-fftw3=somefftwlib" and have it detect whether some FFTW-compatible library has the threading API or not. And you do not want to be able to disable multithreading with "--disable-fftw-threads? So just check if its possible to compile and link with multithreaded libs, if not try the single threaded, if that fails try the FFTPACK? From the FFTW3 manual:It's also linking with both fftw3_threads and fftw3 (non-threaded). ...programs using the parallel complex transforms should be linked with -lfftw3_threads -lfftw3 -lm on Unix...also nm -D --defined-only libfftw3_threads.so doesn't show any DFT function. Please correct me if I'm wrong but I think ist correct to link with both. See aboveI'd rather see it test the existing FFTW3_LIBS and FFTW3F_LIBS whether they implement one of the threading functions. I can't see any benefit from doing this and want to ask some autotools pro for that.I'm not sure off the top of my head what's the cleanest way to do it that way *and* make it automatically use the libfftw3_threads library if it's installed. And how to express whether to use libfftw3_threads or libfftw3_omp? Worst case, we could require users to configure with "--with-fftw3=fftw3_threads --with-fftw3f=fftw3f_threads", this has pros and cons. I think I prefer that for now, it's the easiest and safest and we can always change it later. Okay, I thought a dual core is standard nowadays and users would benefit from this even when they didn't notice the change that they now can set the number of threads with fftw("threads",...)I would set the default number of threads to 1 at startup. Matches the default behavior of both the non-threaded and threaded FFTW libraries. Another way could be to set the default number of threads to the number of available cores on startup but, 1.) I don't like such type of "hidden automation" 2.) We first would have to implement some platform independent way to get the number of available CPU cores Okay, done thatThere is some trailing whitespace on a few lines that should be removed. Ah I didn't notice that you've fixed that on stable. I stumbled over this problem some days ago and had to fix it for my tests with fftw.I already fixed the method / do_method bug recently on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/f63a4f23bfe7), I think it simply hasn't been merged into the dev branch yet, so don't include that in this patch. When do you merge this from stable into default? Thank you very much. I want to talk with Jordi on IRC gerading some points and submit then a new patch.Other than that, looks real good. And I appreciate any further comments. I've further made changes that the "threads" getter and setter is only compiled if defined (HAVE_FFTW3F_THREADS) and the plan only gets discarded when there is a change in the number of threads. Regards, Andy |
[Prev in Thread] | Current Thread | [Next in Thread] |