Welcome, Guest. Please login or register.
Did you miss your activation email?
12 Feb 2007, 05:21:48 pm

Login with username, password and session length
  
 
 

 
 
Seti@Home optimized science apps and information  |  Articles
[How-To documents] How to make your own optimized Seti@Home client for Windows by Simon
by Simon Zadra (KWSN – Chicken of Angnor)
27 Jun 2006, 11:33:31 pm
How-To documents This article explains in detail how to compile and test your own optimized Windows Seti@Home enhanced client application. You will find links and instructions for all necessary tools inside.

Do you have a comment or think something should be added? You are welcome to discuss this article on the forums (you will have to register before you can post).

Please share your success or problems so I can continue to improve this How-To.

How to make your own optimized Seti@Home client for Windows



Prerequisites and where to get them

  • Windows 2000/XP/2003
  • Development Tools (Note: these tools are only available as commercial and/or trial versions!)
  • Eric Korpela’s Source Tarball (modified by yours truly)
  • Patience.



Getting and installing required software
(you will only have to do this once to be able to compile things on your system)

 

 
Development Tools

There are a number of  software packages you will need to successfully make your own optimized client. The main performance gain compared to the default client you get via BOINC  comes from using Intel’s Compiler and Mathematics libraries. Unfortunately, on Windows these tools are not available for free - but you can find Visual C++ on eBay or elsewhere pretty cheaply.


Part 1 – Microsoft Visual C++ 2003/.NET (Microsoft Visual Studio .Net/2003)

Windows does not include software development tools by default. To compile your own programs, you will need a compiler and an IDE (Integrated Development Environment) like Microsoft's Visual Studio. In this particular case, we'll be using Visual C++ (you do not need the whole Visual Studio, just VC++).

Refer to the installation instructions how to go about setting it up - if you just pop in the CD/DVD, it will tell you what to do and install all necessary prerequisites on its own.

When you've got Visual Studio installed, it's time to install Intel's compiler and libraries. They are what makes optimized clients faster on PCs.
 

Part 2 – Intel compiler and library packages


For this part, you’ll have to download a couple of large files from Intel.

http://www.intel.com/cd/software/products/asmo-na/eng/download/eval/index.htm

You will find all links to the software here – there are also links to very extensive online documentation. They even offer free support, if you want it.

This download page is for the commercial trial versions available. The disadvantage with these packages is that they expire, and can not be renewed. If you want to continue to use them after the trial period, you will have to buy them. Read the license carefully so you do not inadvertently put yourself at legal risk!

What you’ll need to get –

In the “Compilers” section, click on “Download Intel C++ compiler for Windows” and follow the instructions.

In the “Performance Libraries” section, do the same for the IPP (Integrated Performance Primitives) library for Windows.

So when you finally have them all downloaded (it’ll take a while), you can simply double-click them to install. Start with the Intel C++ compiler, then install IPP. This order is important. Also, you will have to have Visual C++ installed before you install the Intel packages, as explained in the previous section.

When you download things from Intel, you have to enter your email address and confirm you will be using the software for trial use only. They will send you an email containing a serial number, as well as a .lic file as an attachment. Copy these .lic files to somewhere on your system and note down their names. You will need them to install.

Start up the installer which will tell you all you need to do.

The .lic files you copied before come into play now – for every package, point the installer to its associated license file (the ones you got via email). You can rename them but make sure they keep the .lic extension or it will not recognize them.

It will ask you whether you want to install everything or individual packages. I recommend installing the whole package and checking the box that asks you whether you want the installer to automatically update your environment variables. It will ask this a couple of times, always check the box.

Repeat this procedure for the IPP package.


That concludes the requirements (which actually take the most time).


 
Making the client
(the good part)



Eric Korpela has put his development directories and archives of his sources online. This is where I got my initial source tarball from.

You can either grab his sources from here (you’ll need boinc.tar.gz and seti_boinc.tar.gz) -

http://setiathome.berkeley.edu/~korpela/build/i686-linux/

or my modified source tarball from here (all in one file, will unpack 2 directories) –

http://lunatics.at/index.php?module=Downloads;sa=download;id=5;mirror=1

Be advised that Eric’s sources did not build for me as they were. He might have updated them in the meantime,  so I can’t guarantee  for them being the same still when you read this as when I wrote it.

However, my modified source package linked above will always be one that I have tested and gotten to compile, so I’d advise you to use mine if you run into problems with Eric’s or other sources (or if you just don’t want to waste time trying). They also include some test scripts I’ve written to make testing and result verification as automatic as can be (the instructions below are tailored to them). Currently, my sources are at version 5.15. The credit multiplier has also been adjusted from Eric’s sources (client/seti.h, “LOAD_STORE_ADJUSTMENT”, was 3.51 in his) to 3.35 as with 5.12.

If you use his sources and don’t adjust the value, your client will claim the wrong amount of credit. This is not a good thing. Don’t try to cheat by increasing this value, as it is very easy to detect and ignore. The quorum system takes care of that very well (as well as project staff having an eye on hugely inflated claims). You have been warned.

The credit multiplier might change in future versions. This will be announced on the Seti@Home forums.

You will need sufficient memory and swap space configured to successfully compile and link the Seti@Home client - at least 512MB RAM and 2GB swap space is recommended. More RAM will make your build a lot faster because it doesn't need to swap to your hard disk as much.

Download my sources with the above link, then unpack them. This will create a directory called "boincstuff" containing two more directories, “boinc” and “seti_boinc”.

So –

it's finally time to fire up Visual C++!

Here's where it starts getting a bit complicated, so I'll resort to a lot of screenshots. They should make it much easier to see what I'm writing about.

Go to the directory you unpacked the sources to (c:\boincstuff for me), then go to seti_boinc\client\win_build\ and find the file "seti_boinc.sln" - if you have Windows set to hide file extensions, look at the file type, it will be called "Microsoft Visual Studio Solution Object". Double-click it to open the "Solution" (a solution is a collection of projects, in Microsoft-Speak).

Microsoft Visual C++ should fire up and you should see some entries on the right side looking like these:



Right click the automatically selected entry "seti_boinc" and choose "Properties".

This will pop open a dialog window with all compiler and linker options like this -



The first thing you will have to do is make sure all paths are set up correctly - if you installed everything into the suggested directory, they should be fine. Still, please check them. This will give you a first look at how to change compiler and linker settings with Visual C++.

There are a few places where these paths are hidden - I'll show you all of them and what you need to check.



These are the "Include" paths - that means where to find header (.h) files it needs.

Click on the drop-down list arrow on the right and choose "Edit". This will pop up another window like the following:



Check the paths that are highlighted.

Next we'll check the library paths -



Check these paths like the include paths above (the procedure is identical, you just need to check the first couple of paths).

Finally, I'll show you how to select the proper optimization options - this is most easily done by adding to the command line section of the compiler settings:



Look at the highlighted section - the most likely thing you'll want to change is /QxW. This parameter tells the Intel compiler to optimize for a specific platform - in this case, "W" means it will generate code that will run on any SSE2-enabled machine. You can also use "N" for SSE2 Pentium4-specific optimizations - I have not found any speed improvements over using "W" in my testing, though. Also, you could use "P", which would enable SSE3. This has also not yielded any noticeable speed improvement over SSE2, so my advice is to stay with "W" for maximum compatibility and speed for SSE2. The last possible setting you could use is "K", which tells the compiler to optimize for SSE/Pentium 3 and also works on SSE-enabled AMD chips.
If you want to compile for MMX, delete the /QxW option completely.

Note: if you change any of the pre-set options, make sure you change them in all projects, not just seti_boinc! Just click on any other project while you're inside the editor window, it will switch automatically. Failure to do this will result in build problems, so take care when editing them.

The second part of the optimization settings can be found inside the "Preprocessor Options":



Click on the preprocessor options to make it show a dropdown-arrow, then choose edit and you will see a window like this:



The first ones that are highlighted are USE_IPP and USE_SSE2 - USE_IPP tells it to use the Intel IPP library that you downloaded and installed earlier. USE_SSE2 tells it to use SSE2 - you probably guessed. You will have to adjust this if you compile MMX/SSE/SSE3 instead of SSE2-optimized clients.

The second highlight tells it to not compile the graphics part of the client - change NBOINC_APP_GRAPHICS to BOINC_APP_GRAPHICS if you want to include them - but be aware this makes your client slower! I'd advise against including them, since the object of this How-To is making an optimized client.

To help you choose –

Intel CPUs: a Pentium 3 supports SSE, a Pentium 4 supports SSE2 or maybe even SSE3 (if it’s a new one). Anything below a P3 will usually support MMX.

AMD CPUs: Athlon 64s all support SSE2, the newer ones and all dual-core ones support SSE3 as well. Athlon XPs support SSE, except for Bartons, which support SSE2. Durons  and Athlons faster than 1 GHz support SSE, earlier CPUs support MMX (mostly).

Be aware that if you select something your CPU does not support (like SSE2 on a P3), the build will fail and tell you that the compiler cannot create executables. You can find out what your specific processor supports by downloading and running a utility like CPU-Z (Homepage). Just unpack this Zip file and run cpu-z.exe. A window will pop up showing you what your CPU supports:



The machine I'm writing this on is a laptop, so it says it's a 3.06 GHz P4 mobile, but you can see it's running at 1.6 GHz because I'm not doing anything CPU intensive. This utility can also tell you helpful data about your motherboard and RAM. Click around.


So let’s finally get it all compiled!

Right-click the topmost entry called "Solution 'seti_boinc' (7 projects)" and choose "Rebuild Solution". You'll have time to make some coffee and get a snack until the build gets done.

Building software takes time. On my development system, a 3.06 P4 laptop with 1GB RAM, a typical optimized build took around 10-15 minutes - linking and optimizing takes the most time.

So, assuming all went well, you will now have your very first self-made optimized Seti@Home client.

You can find it in the client/Release directory (if you didn't change the version to be compiled to "Debug". Don't.). It will be called “setiathome_5.15_windows_intelx86.exe” by default.

Inside this folder you will find a script called benchmark.cmd. Open it up in a text editor by right-clicking it and choosing "Edit". You will see it's a text file that runs the default client vs. yours (I put a copy of the default 5.15 client inside that directory, too. Don't delete it!). You may want to edit it for your purposes if you compile different versions so it uses different file names. Just look for the lines that only have "xxxx.exe" on them and edit to your taste. Also, adjust the line that says "

By default, it will use one of some artificially "shortened" WUs (they just don't take as long, thanks Josef!) that I pulled off my clients.

When you’re satisfied with your settings, save and execute the benchmark by either running it from a command prompt (recommended) or just double-clicking on it. Make sure nothing else CPU-intensive is running so your benchmark is reliable.

It’ll take a bit. Did I mention sit back and relax? It’s good for your blood pressure, you’ll live longer Grin

The script will tell you what it’s doing and echo the start and end time for each client (sorry, didn't find a utility that measures execution time....calculate the time differential yourself for now, please Wink). It will also save the results (result.sah and state.sah) as well as how long it took to run into the folder testData/ with the same file name but with the client name as a postfix. You’ll see when you look at the results after your run.

NEVER SKIP THE FOLLOWING IMPORTANT STEP!


So when it’s finished (and hopefully was quicker than the default, which is called “default-515.exe”, go into the testData/ directory. Do:

[cmd]
rescmp result.sah.default-515-1.txt result.sah.optimized-1.txt
[/cmd]


This is a very important step in testing what you just created. It will tell you whether your client produces valid results or not.

It’ll either say “results are strongly similar”, in which case all is well, or “weakly similar”, which can SOMETIMES happen, but not often. It’s more likely that your client is not compiled correctly. It could also say “these are different”, in which case your client is totally borked. This may happen if you decide to tune my build scripts and play with the compiler settings etc.

NEVER SKIP THIS IMPORTANT STEP! If what you compile doesn’t produce valid results, it has no place crunching for credits. This cannot be stressed enough. You would be doing everyone a large disservice.

So, you tested your client, and all was well. It was quicker than what you had before, and you’re so proud you want to show people what you did - and not the message I put into the Sources, which includes my name. To achieve this, try opening client/analyzeFuncs.cpp. Search for “Work Unit Info” and change the text near there. Of course, it’d be nice to credit those who helped you Wink Not a requirement, though. After editing this file, you will need to recompile seti_boinc, so just right-click the solution and choose "Rebuild Solution" again. It will clean up and start over for you.


 
So you got this far, and now you want to test your client online?


Again, I cannot stress enough how important result validation is. It doesn’t matter if your client is a hundred times faster if the results it produces are invalid. That’s exactly what I made the benchmark script for – time and result testing. Use it.

When you’re happy with your tests, you’re ready to run your new optimized app. Simply copy it to your BOINC/projects/setiathome.berkeley.edu folder. Then, you’ll need to create a file called app_info.xml. Any of you familiar with using optimized crunchers will know what I’m talking about, so skip ahead.

Everyone else, paste the following into a text editor and save it as “app_info.xml” inside BOINC/projects/setiathome.berkeley.edu (replace yourfilename.exe with your client’s filename):

[app_info.xml]
<app_info>
    <app>
        <name>setiathome_enhanced</name>
    </app>
    <file_info>
        <name>yourfilename.exe</name>
        <executable/>
    </file_info>
    <app_version>
        <app_name>setiathome_enhanced</app_name>
        <version_num>512</version_num>
        <file_ref>
            <file_name>yourfilename.exe</file_name>
            <main_program/>
        </file_ref>
    </app_version>
    <app_version>
        <app_name>setiathome_enhanced</app_name>
        <version_num>513</version_num>
        <file_ref>
            <file_name>yourfilename.exe</file_name>
            <main_program/>
        </file_ref>
    </app_version>
    <app_version>
        <app_name>setiathome_enhanced</app_name>
        <version_num>514</version_num>
        <file_ref>
            <file_name>yourfilename.exe</file_name>
            <main_program/>
        </file_ref>
    </app_version>
    <app_version>
        <app_name>setiathome_enhanced</app_name>
        <version_num>515</version_num>
        <file_ref>
            <file_name>yourfilename.exe</file_name>
            <main_program/>
        </file_ref>
    </app_version>
</app_info>

[/app_info.xml]


The reason for all versions being included is so you can easily resume your 5.12 WUs that you had until now. So you don’t need to empty your cache, you can just stop BOINC, replace the files and add app_info.xml, then start it again. It should resume your cached WUs with your new optimized cruncher. Be sure you didn't forget to replace all instances of "yourfilename.exe" with the file name you actually give your new Seti@Home client!


Be aware that to go back to the default client does require emptying your cache. The 5.12 as distributed will not do anything with WUs you downloaded with the optimized program (5.15).

 

Please share your results and whether this information worked for you!

Good luck, and thanks to everyone who helped – especially, in no particular order:

Hans Dorn, Josef Segur, Tetsuji Maverick Rai, Eric Korpela, and our good friends at Intel Corp. Smiley

 

Simon Zadra
KWSN – Chicken of Angnor

Ni!


Last updated: 27 Jun 2006, 11:33:31 pm Reviewed by: Simon

Pages: Back to Articles

Article Archive


Quote!
Two wrongs are only the beginning.
- Murphy's Law

 
Site Statistics
Total Members:320
Total Posts:2347
Total Topics:166
Downloads
Apps
Windows Rev 1.x20478
Windows Rev 2.x15255
Linux Rev 1.x4480
Subtotal:40213
Source packs:2179
Tool/WU packs:2571
Total:44963
GBs dl'd:123.67
Pages served
Today:3630
Total:732617
(since 6/26/2006)
21 Donations to S@H
U.S. Dollars:312.00
Euros:32.00
Last 24h:$ 8.00
Avg./24h:$ 131.85
Estimated total:$ 353.60
Latest Member:
kev1701e
 
 
Seti@Home optimized science apps and information | Powered by Enigma 2.0 (RC1).
© 2003-2007, LSP Dev Team. All Rights Reserved.
Seti@Home optimized science apps and information Forums | Powered by SMF.
© 2005, Simple Machines LLC. All Rights Reserved.
Erektile DysfunktionPowered by MySQL Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!