SETI Forum | Linux Forum

Site Navigation:

Get Firefox!

Compile SETI for BOINC on Linux

Note

This tutorial is now somewhat out of date. Whilst I have no specific plans to update it at the current time, the information contained herein is still generally applicable, and as such, I will leave it here in the hope that it remains useful.

If you're reading this guide, then you have probably just read the guide to compile BOINC on Linux. This guide is designed as a follow on, so if you haven't read the previous guide, may I suggest you read that guide first.

To compile the SETI source code you will need to have all the appropriate development packages installed on your system. A list of required development packages is available here (as we are only going to be compiling the client applications, we do not need to have MySQL installed). I used Fedora Core 2 with gcc-3.3.3-7 and make-3.80-3 for this tutorial.

The SETI@home client is the program that actually does the processing of work units.  By optimizing the SETI@home client we hope to reduce the amount of time taken to process a work unit. So, the first thing we need to do is obtain the source code. You will need a copy of the boinc_public source code as used to compile the BOINC client earlier, and a copy of the SETI source code from the same nightly build. Make sure to get the boinc_public-cvs.tar.gz version of the BOINC source and the corresponding seti_boinc-client-cvs.tar.gz, not the windows zip files.

Preparing to Build the SETI Client


Note

Important: If you have just compiled the BOINC client as described previously, please delete the BOINC source build directory that you used now. Before we can build the SETI client, we must rebuild the BOINC source as shared libraries from BOINC are required for the SETI client to build. Further, please make sure all your environment variables are reset. If you used the export command as used above, simply close the shell windows previously used to build the BOINC client and open a fresh shell window for this project. Following these steps will help minimize any problems when compiling the SETI client.

Once you have downloaded the source files, place both the boinc_public and seti_boinc-client source tar.gz files in your source build directory (I used /usr/src ) and extract them:

cd /usr/src
tar xvzf boinc_public-cvs-2004-09-30.tar.gz
tar xvzf seti_boinc-client-cvs-2004-09-30.tar.gz

You should now have two directories off /usr/src called /boinc_public and /seti_boinc. Important: Rename the /boinc_public directory to /boinc. If you now have two directories off /usr/src called /boinc and /seti_boinc then you are ready to start compiling the SETI client.

Compiling the SETI Client

Before we can compile the seti client, we must first set a few environment variables including the compiler optimizations, and configure and compile the BOINC client to build the shared libraries required by the SETI client. I used the standard set of optimization as used to build the BOINC client earlier with one important exception. Because we are now compiling the SETI client, and the SETI client is used to actually do all the science, it is extremely important not to use any maths optimizations that may invalidate the results generated by the SETI client. For this reason you must not use the -ffast-math optimization used previously. If you use optimizations that invalidate your results, they will be rejected by the project and you will not receive any credit for them.

First we set our environment variables, change to the /boinc directory, configure and compile the BOINC client:

export MYSQL_CONFIG=true
export CFLAGS="-march=athlon-xp -O3 -fomit-frame-pointer -funroll-loops -fforce-addr -ftracer"
export CXXFLAGS=$CFLAGS
cd /boinc
./configure
make -k

The make stage will result in some errors as it most likely will not be able to build the server parts of the project (unless you have MySQL installed and configured), but these are not needed by us. Using the -k switch with make ensures that make will continue to compile upon such errors. To check if this stage worked satisfactorily, check for the existence of the /boinc/lib/boinc_api.o file. If this file is present then this stage should have worked and you may proceed to build the SETI client.

Next change to the /usr/src/seti_boinc directory, configure and compile the seti client:

cd ..
cd /seti_boinc
./configure
make -k

If everything worked, you should now have a /seti_boinc/client subdirectory that contains your newly compiled SETI client. Mine was called setiathome_4.3_i686-pc-linux-gnu.

Testing Your Compiled SETI Client

It is imperative that we test our newly compiled SETI client using a reference work unit and compare the results against those from the standard download SETI client. First we need to make a couple of directories in which to test our SETI client. Create a directory off your home directory called /seti_test. Make two more directories in /seti_test called /download and /compiled. Copy your freshly compiled SETI client into the /seti_test/compiled directory and place a copy of the downloaded SETI client found in your BOINC directory (/boinc/projects/setiathome.berkeley.edu) in the /seti_test/download directory. Next, there is a reference work unit located in your /usr/src/seti_boinc/client/test_workunits directory called reference_work_unit.sah. Copy this file to both of your test client directories and rename the file to work_unit.sah.

We are now ready to process the reference work unit using both the standard downloaded SETI client and our freshly compiled SETI client. This serves two purposes; firstly, using the reference work unit allows us to validate the results generated by our newly compiled SETI client, and secondly, it allows us to accurately benchmark our new SETI client against the original downloaded SETI client for speed. To execute, simply change to the appropriate directory and run the SETI client in both the /download and /compiled directories:

cd /home/username/seti_test/download
./setiathome_4.3_i686-pc-linux-gnu


cd /home/username/seti_test/compiled
./setiathome_4.3_i686-pc-linux-gnu

Run one client at a time, and try not to use the computer excessively while the work unit is processing. The SETI client will not output any data to the screen and will simply return control to the terminal window when finished. Once both work units have been completed, there will be a result.sah file containing the results in each of the test directories. We need to check these two files for differences in order to validate the results generated by our compiled SETI client against those generated by the standard downloaded client. This may be done either by opening the two result.sah files into an application such as Kompare (part of the KDE environment) or by using diff to generate a difference file. The following command will compare the two results file and output the differences between them to the seti_result_diff file:

diff /path/to/file1 /path/to/file 2 > seti_result_diff


There will be differences between the two sets of generated results (I found 27 sets of lines containing differences). When using a self compiled SETI client it is important to monitor your results to ensure they are being validated by the SETI@home project. If you find a large number of results are being marked as invalid I suggest you stop using your compiled SETI client and see if that fixes the issue. However, my results were all well within validation limits and I wouldn't expect your client to significantly vary from this either.

Next on to the main reason for recompiling the SETI client, speed. The time taken to process the reference work unit (in seconds) is stored in the init_data.xml file under the <wu_cpu_time> field and may be compared for the two SETI clients. OK, now for the bad news. The times returned for my test system by the standard and compiled SETI clients were 4:48 and 4:45 (hr:min), respectively, making the compiled SETI client only 3 minutes (1%) faster than the standard client.

Obviously this is an extremely disappointing result as the Windows SETI client is typically 10-20% faster than the Linux SETI client on the same hardware. In a desperate attempt to try and improve on this result I tried recompiling using the -ffast-math optimization previously warned against. This did offer some improvement (8%) over the original SETI client but the results generated by this compiled SETI client differed significantly from the results generated by the standard client. Most notably, lines 489-514 for <best_gaussian> significantly differed and were well outside of allowable tolerances. My results files generated from runs with the standard, compiled and compiled with -ffast-math SETI clients (result1.sah, result2.sah and result3.sah, respectively) may be downloaded for comparison. I would be extremely cautious about using the -ffast-math optimization flag. Further, a reference_result.sah file together with the validation limits used by the SETI project when validating results are now available (thanks to Eric J. Korpela).

Installing Your Compiled SETI Client

General instructions on using the BOINC anonymous platform are provided on the BOINC web site here. Place your Boinc client in it's own directory, run the client and attach to the project. This will cause a /projects/setiathome.berkeley.edu directory to be created. Now exit the client. Create an app_info.xml file for your new SETI client and place this together with your SETI client in the /projects/setiathome.berkeley.edu directory. Run the core client again and when it requests work from the server, it will report the platform as anonymous and will now use your new SETI client.

Please drop by to our forums and let me know how you get on.