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.
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.
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.
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
Please drop by to our forums and let me know how you get on.