Page 1 of 16 1234511 ... LastLast
Results 1 to 15 of 227
  1. #1
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Post [Linux] Compiling optimized SETI client using FFTW3

    One of the biggest problems we face when trying to optimize the seti source code using compiler optimizations is that a large part of the work that seti does isn't actually coded within the seti source code. Seti performs mostly single precision floating point maths and rather than rewrite the code that performs this, the developers simply call standard maths routines already present in library files on your computer. Consequently, optimizing the seti source code using compiler optimizations has no affect at all on this, thus we only see relatively small improvements compared to say, optimizing the boinc benchmarks code.

    However, there is a Fast Fourier Transform (FFT) library capable of performing single precision floating point maths available, developed at MIT and designed to be both fast and portable. FFTW (Fastest Fourier Tranform in the West) is available for UNIX/Linux, and in addition, Eric Heien of the Seti project has made available (on SourceForge.net) adapted source code to use these routines. This allows us to let seti use a more optimized set of maths routines to perform it's calculations hopefully resulting in increased performance.

    First, you will need to install FFTW version 3.0.1. I installed from the source code available directly from the site. Before installing, check out the installation notes. The main thing to note is we need single-precision (float) instead of the default double-precision (double), so use the following configure switch:

    Code:
    ./configure --enable-float
    make
    make install
    I didn't investigate any of the SIMD options, as my understanding is that there is nothing in the seti source code that can take advantage of the mmx, sse, 3dnow etc instruction sets. However, others may like to experiment further with this.

    Additionally, you can optimize your install of FFTW using standard compiler flags (CFLAGS). I went all out for an aggresive set of optimization flags:

    Code:
    export CFLAGS="-march=athlon-xp -O3 -falign-functions=4 -fprefetch-loop-arrays -fomit-frame-pointer -funroll-loops -fforce-addr -ffast-math -ftracer"
    I don't know what effect aggresive compiler flags will have on stability, but mine compiled and installed fine (and my client has subsequently returned a couple of results that have now been validated - still early days though!!). Presumably optimizing the FFTW library for your system will further increase performance. The default build produces a static library, rather than a shared library file, which is probably appropriate given our goal of compiling a static version of the seti client. If all went well, you should have the library file /usr/local/lib/libfftw3f.a and header file /usr/local/include/fftw3.h. These should be on your library and include paths, respectively.

    Next up, the seti source code. I've repackaged the seti source code from 1st Dec 2004 and patched it with the fftw3 code provided by Eric Heien and added a few further patches to cure a potential sigsegv segmentation fault (in seti.cpp) and a whole bunch of failed linking errors in the makefile when you try to compile (thanks Paolo!). I chose to use the 1st Dec source as I've used it extensively for previous testing and I have plenty of benchmark data for it, plus I know it compiles cleanly giving a v4.70 seti client.

    The fully patched source (1.2M) is available here (md5sum is: 40e441c58a9f462d4814728c39398f7f seti_boinc-client-fftw3-2004-12-01.tar.gz)

    I've done all the hard work for you here, just extract the source and compile against the boinc source as you normally would - I compiled against the boinc source from 28th Jan 2005 (v4.19). Because the fftw3f library is a static library, by default it is compiled statically into the seti app regardless of whether or not you specify -static, increasing the binary size to 1.2M in my compile. The only thing to really watch out for is linker errors, most likely caused if libfftw3f is not located on your library path. This can be resolved either by moving it to somewhere like /lib or /usr/lib that is on the default path, or adding the path to the LD_LIBRARY_PATH environment variable. Anyway, it should build cleanly.

    So now for the results. I benchtested using the reference work unit, and using the standard berkeley native linux v4.02 client to give a 100% reference point:

    Seti 4.02 (Standard berkeley seti app): 11068 secs = 3h05min - 100% reference
    Seti 4.70 (1/12/04) compiled against Boinc 4.19, (28/1/05) with basic opt flags: 9887 secs = 2h45min - 89% (11% faster)
    Seti 4.70 (1/12/04) compiled against Boinc 4.19, (28/1/05) with Chris' extra 2 opt flags: 9608 secs = 2h40min - 87% (13% faster)

    And with Chris' extra 2 opt flags AND FFTW3:

    Seti 4.70 (1/12/04 patched to use FFTW3) compiled against Boinc 4.19, (28/1/05) and Chris' extra 2 opt flags: 8488 secs = 2h21min - 76% (24% faster)


    So using the FFTW3 library in addition to previously discussed optimization flags affords an additional 12% performance increase over my previous fastest client (doubling it's overall performance gain) and gives a client that completes the reference WU in 76% of the time taken by the standard native linux client.

    I don't have like for like Linux and Windows boxes to accurately compare, but I think this now makes my Linux client faster than my Windows client, and used with my optimized boinc clients they certainly request more credit

    ** EDIT **

    I've uploaded my seti client build to here (an app_info.xml file is included). It's an Athlon XP build, and will only run on an Athlon XP.

    It's not a completely static build, so you'll have to solve any dependancies yourself, but you don't need to install the FFTW3 libraries. However, your system must meet the following so check that they are all present and of the correct version before running:

    Code:
            libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00c33000)
            libz.so.1 => /usr/lib/libz.so.1 (0x0068a000)
            librt.so.1 => /lib/tls/librt.so.1 (0x004a9000)
            libnsl.so.1 => /lib/libnsl.so.1 (0x007d2000)
            libdl.so.2 => /lib/libdl.so.2 (0x00952000)
            libm.so.6 => /lib/tls/libm.so.6 (0x0092d000)
            libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00be9000)
            libc.so.6 => /lib/tls/libc.so.6 (0x0080f000)
            libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00a45000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x007f6000)
    It will run fine on FC3, and I also have it running on FC2 after installing libstdc++.so.6.

    Ned

    Note: This was done on a standard fully updated Fedora Core 3 installation using gcc-3.4.2.
    Last edited by Ned Slider; 04-12-2005 at 01:02 PM.

  2. #2
    Joined
    Mar 2005
    Location
    Switzerland
    Age
    44
    Posts
    103

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Excellent work Ned!

    I can't wait to try it on my boxes... however the earliest will be the comming weekend since I am attending a trade show for the best part of the day....

    It will be especially interesting on my Athlon MP box, so far the improved clients do not show an improved performance in real live because of the memory bandwith restriction of this system. Maybe the FFTW will show some effect?

    I will post here once I have some results...

    Have a relaxing evening after all this hard work
    Chris

  3. #3
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Well, the good news is that results are validating OK and performance on real WUs is excellent

    Also, I've copied the binary client (compiled on FC3) to my FC2 system and it runs fine on that too (after I made libstdc++.so.6 available on the system), you don't need fftw3 installed to run. Thus, my binary should probably run on any system that has the appropriate glibc and libstdc++ (v6) versions if anyone wants to try it.

    The full list of dependencies is:

    Code:
            libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00c33000)
            libz.so.1 => /usr/lib/libz.so.1 (0x0068a000)
            librt.so.1 => /lib/tls/librt.so.1 (0x004a9000)
            libnsl.so.1 => /lib/libnsl.so.1 (0x007d2000)
            libdl.so.2 => /lib/libdl.so.2 (0x00952000)
            libm.so.6 => /lib/tls/libm.so.6 (0x0092d000)
            libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00be9000)
            libc.so.6 => /lib/tls/libc.so.6 (0x0080f000)
            libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00a45000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x007f6000)
    Ned

  4. #4
    Joined
    Dec 2000
    Location
    myrtle beach,south carolina, U. S. of A.!
    Posts
    12,696

    Re: [Linux] Compiling optimized SETI client using FFTW3

    great work ned!

    hell bill g. nah-nah-nah-nah!

    24% is awesome results!

  5. #5
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Quote Originally Posted by thelmores
    great work ned!

    hell bill g. nah-nah-nah-nah!

    24% is awesome results!
    Yeah - nice little performance upgrade for the farm that didn't cost anything

  6. #6
    Joined
    Mar 2005
    Location
    Switzerland
    Age
    44
    Posts
    103

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Hi Ned,

    I need your help, there seems to be a problem when trying to compile the seti client.
    I compiled and installed FFTW3 on my machine, I moved the files to /usr/lib and the header to /usr/include

    The Boinc compile whent smooth. The Seti configure completes but as soon I give the make command I get the following:

    chris@boss2 seti_boinc]$ make
    (cd client; make all)
    make[1]: Entering directory `/home/chris/Boinc/seti_source/seti_boinc/client'
    Makefile:30: *** missing separator. Schluss.
    make[1]: Leaving directory `/home/chris/Boinc/seti_source/seti_boinc/client'
    make: *** [all] Fehler 2
    I tried it on two of my boxes and get the same error.
    Do you have any idea what I might be doing wrong?

    Thanks in Advance
    Chris

  7. #7
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Sorry Chris - my bad

    Yes, just confirmed, I see the same error. That'll teach me for not thoroughly testing before posting it. Anyway, I've fixed and repackaged the source and uploaded to my server (note the new md5 checksum), there was an error in the /client/Makefile.in.

    I downloaded my fixed source and tested it this time, and it compiled fine

    Also, Make sure you clear your browser download cache, or at least check the md5 checksum as initially my browser just pulled the old version from it's cache

    Ned

  8. #8
    Joined
    Mar 2005
    Location
    Switzerland
    Age
    44
    Posts
    103

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Well had such a mishap myself a few days ago... as we say sh.. happens.
    I will give it another go.

    Chris

  9. #9
    Joined
    Mar 2005
    Location
    Switzerland
    Age
    44
    Posts
    103

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Ok the client compiled with no problem on both machines.
    The binaries have a size of 1.2MB they can not be static since ldd shows the following:

    [chris@boss4 x86_64_4.19]$ ldd ./setiathome_4.7_x86_64-unknown-linux-gnu-fftw
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003b61100000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b5ed00000)
    librt.so.1 => /lib64/tls/librt.so.1 (0x0000003b63900000)
    libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003b64300000)
    libelf.so.1 => /usr/lib64/libelf.so.1 (0x0000003b60d00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003b5eb00000)
    libm.so.6 => /lib64/tls/libm.so.6 (0x0000003b5e900000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003b60f00000)
    libc.so.6 => /lib64/tls/libc.so.6 (0x0000003b5e600000)
    libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003b5f300000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003b5e400000)

    I will post the results once the first WU's are validated.

    Chris

  10. #10
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    That's pretty much what I got Chris. The client still isn't static, but you'll notice that libfftw3f isn't on that list, so it hasn't additionally complicated the static build problem.

    My client has been running on 2 machines for 3-4 days solid and all results have validated fine. Speed is excellent, and I'm seeing times under 2 hours for the first time

    Ned

  11. #11
    Joined
    Mar 2005
    Location
    Switzerland
    Age
    44
    Posts
    103

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Hi Ned

    Here my first results:

    Both clients Athlon MP on 32bit Fedora3 and Athlon 64 on 64bit Fedora3 are running fine with results validating without problems.
    Not too many results in so far so here some preliminary comparison with real work units. I Compared an average of several validated WU's.

    Athlon MP 2400+ on 32 bit Fedora Core3:
    Orig. Berkeley Linux client: 16000s=100%
    MP oprimized compile: 16000s= no gain
    Optimized compile with fftw: 13400s= 16% improvement

    Athlon 64 3500+ on 64bit Fedora Core3:
    Orig. Win client on WinXP: 7800s=100%
    Orig. Linux client: 9000s= 15% worse than Win client
    x86_64 compile: 7300s= 7% better than Win client
    x86_64 compile with fftw: 6000s= 23% faster than Win client

    I was quite conservative calculating the averages, maybe the improvement is even larger over more results.

    I tried to do the fftw compile as well on my P3 on Fedora2. Unfortunately something went wrong and the Seti client exits with an error message. I will try again when I am back from my business trip next weekend.

    So far it looks promising some big improvements...
    Thanks again for your work!

    Cheers
    Chris

  12. #12
    Joined
    Apr 2004
    Location
    Wisconsin
    Age
    49
    Posts
    39

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Linux newb here, and have a few questions......
    I did your FFTW thing here, is there anything I have to do after I do the make install????

    I also compiled the BOINC client with the optimizations you had in the other thead, but it starts on boot I think cause I tryed to run the bench and it says another instance of BOINC is running, I need to stop that.
    Do I copy the whole BOINC folder to /home or do I leave it in /usr/src/????
    As for Seti, I dloaded it from your link here, still trying to figure out what to do with it......
    Once I get it, I am sure I will have more questions.........


    EDIT:
    Ok got it to run the benchies....
    1 down, several thing to do to go.....
    Last edited by Slagathor; 04-10-2005 at 01:19 PM.

  13. #13
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Make sure you first check out my general guides for compiling boinc and seti software here:

    http://www.pperry.f2s.com/boinc-compile.htm

    http://www.pperry.f2s.com/boinc-compile-seti.htm

    Read them carefully, then if you have an specific problems we can talk you through it.

    Ned

  14. #14
    Joined
    Apr 2004
    Location
    Wisconsin
    Age
    49
    Posts
    39

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Ok, that didnt work, I got tons of errors, and the files your tut said should be there wernt....heh.
    I am prolly missing of the development toold, but the link is broke so I am not sure which ones.
    So I am going to try using the optimised BOINC I made earlier as per your tut.
    anywase, I copied the boinc exe and got it all running.
    Reading your seti tut, is it really worth oprimising the seti client as opposed to just using the one boinc dloaded for a few minutes, unless I am missing something....

    But I am gonna try this and see what the times are.........


    EDIT:
    Should I have to su to root to run this?????
    Last edited by Slagathor; 04-10-2005 at 03:20 PM.

  15. #15
    Joined
    Jul 2001
    Location
    UK
    Age
    51
    Posts
    20,229

    Re: [Linux] Compiling optimized SETI client using FFTW3

    Thanks for spotting the broken link for the development packages. I'm not sure which one's are specifically required as I have most dev packages installed, but obviously you'll need gcc and make tools.

    You don't need to be root (so long as you have full write permissions in the build directory) as there's no make install step - we're only compiling and then manually copying the binary once compiled.

    If you read through this thread (and the preceding one by cboss) you'll see that better gains are possible for the seti client than I first got in my tutorial - I have got around to updating that page yet. It is worth it, and it's not too difficult, but you do need to be able to follow instructions in linux in terms of compiling sourcecode.

    Ned

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •