If geeks love it, we’re on it

Folding@Home on Multithreaded Windows PCs

Folding@Home on Multithreaded Windows PCs

Why you should consider it: The goals of the Folding at Home project is to understand how proteins “fold” to gain insight into why these proteins sometimes “mis-fold” and develop into diseases such as Alzheimer’s, Mad Cow (BSE), CJD, ALS, and Parkinson’s disease, to name a few. Sign up in Short-Media’s Forums and join Team93. It’s fun in the name of a good cause.


Installing Folding@Home as a Service on Multithreaded Windows PCs

Short-Media LLC, as well its owners, staff, members, and authors, take no responsibility for the use of the information contained in this guide, the related registry file, or Stanford’s Folding@Home client. Modify systems using this guide and registry file at your own risk. We imply no guarantee or warranty by publishing this guide.

Introduction:

If you own a multiprocessor system you are no doubt aware that most programs cannot take advantage of all the available processor resources in your system. The average single-processor machine can only execute instructions on a single thread. Systems featuring multiple processors, one or more dual-core processors, or one or more processors featuring hyperthreading are said to be multithreaded and as such capable of execution on multiple threads (one thread for each processor core and two for each hyperthreading processor). In order for a program to take advantage of the additional power provided by a multithreaded system it must be designed in such a way that the program spawns multiple processes that the operating system can move around between processors to balance the load. Designing programs in this fashion is called parallelizing and most software does not lend itself to being designed this way (notable exceptions include anything that requires vast amounts of repetitive actions like database queries and finite element analysis.) MediaMan has an excellent article explaining how dual-core technology works that explains multithreaded operation in greater detail.

In an ideal world, FAH would be multithreaded by nature and all we would need is a single instance of Folding@Home. But, here in the real world, very few programs are parallelized and can take advantage of multiple threads. Such as it is, you will need to run an instance of Folding@Home for each thread in your system. The lowest-maintenance way to do this is to install each instance of FAH as a system service so that FAH is always running in the background out of sight.

Throughout this guide I assume that you have administrative privileges on your machine and your computer is a dual-processor system using an up-to-date version of Windows 2000 or XP Professional, though the configuration is identical for those of you with dual-core or hyperthreading processors. If you have more than two processors or have two or more dual core or hyperthreading processors then your configuration is fairly intuitive, but I’ll note where the differences lie. The guide should also apply for those of you using Windows 2000 or 2003 Server on the IA32 architecture or Windows 2003 Server or XP 64-bit Edition on the AMD64 architecture in WoW mode, though I have not tested it myself. This guide might apply to Windows NT4 users but I have no way of knowing. Experiment!

This guide does not apply to systems using Windows 95, 98, 98SE, ME, XP Home, XP Media Center Edition, or XP Tablet PC Edition because these operating systems do not support multithreaded operation. Windows 95, 98, 98SE, and ME don’t even have system services in the NT sense so this guide doubly doesn’t apply. Windows 2003 Server and XP-64 IA64 users are on your own; you may be able to run Folding@Home in IA32 emulation mode, but it will be slow and likely error-prone.

If you have previous versions of Folding@Home installed then you should wait for their current unit to complete then shut them off and completely remove them from your system.

Step 1: Get the latest Folding@Home binary

Fire up your favorite web browser and surf your way over to http://folding.stanford.edu

Click the ‘Download’ link on the left navigation pane.

You will be presented with a list of Folding@Home client programs. Resist the temptation to download the graphical client or screensaver as you cannot run multiple instances of them. What you need is the latest version of ‘Windows NT/2000/XP “No-nonsense” text-only console’ (with built-in Windows-service-install option)’. The latest version as of this writing is 5.02.

Click the appropriate link to download it. It doesn’t really matter where you download it to (I just use my desktop). Just make sure you know the full path to wherever you download it.

Step 2: Preparing your system

You can do this through the Windows GUI (point and click interface) or through the command line. I’m going to show you how to do it on the command line because it’s a shorter guide that way ;) .

Click the ‘Start’ button and select ‘Run’.

Type ‘cmd’ into the dialog and press enter. You should now be looking at a shell (DOS) window. If for some reason you don’t have ‘Run’ on your Start Menu, cmd can also be found in Start->Programs->Accessories->Command Prompt.

Type the following commands verbatim to set up your Folding@Home workspace:

mkdir “C:\Program Files\Folding@Home”

mkdir “C:\Program Files\Folding@Home\Thread_0″

mkdir “C:\Program Files\Folding@Home\Thread_1″

The idea here is that we have a separate directory for each instance of FAH we’re planning to run. This means if you’re using quad processors you’ll need four directories, quad hyperthreading processors will need eight directories, etc.

Next, we copy the client into its new workspace. Obviously your path will be different from this one because odds are your Windows user name isn’t “drasnor.”

copy “C:\Documents and Settings\drasnor\DesktopFAH502-Console.exe” “C:\Program Files\Folding@Home\Thread_0″

copy “C:\Documents and Settings\drasnor\DesktopFAH502-Console.exe” “C:\Program Files\Folding@Home\Thread_1″

Continue copying until you have a client in each Thread_x directory.

Step 3: Installing the clients

I hope you didn’t close your shell window because we’re going to need it. It is absolutely imperative that you pass the -local tag to Folding@Home as follows. If you leave the -local tag off then the client configuration will be stored in the registry and each client will attempt to read each other’s. The short of it is that none of the instances will Fold and may cause “unpredictable behavior” which is a polite way of saying it will probably crash your computer.

cd “C:\Program Files\Folding@Home\Thread_0″

FAH502-Console.exe -local -configonly

At this point, Folding will ask you a bunch of questions. Here’s what I said.

Note: Please read the license agreement (FAH502-Console.exe -license). Further

use of this software requires that you have read and accepted this agreement.

Using local directory for work files

Folding@Home User Configuration

— Opening Log file [January 16 04:59:18]

# Windows Console Edition #####################################################

###############################################################################

Folding@Home Client Version 5.02

http://folding.stanford.edu

###############################################################################

###############################################################################

Launch directory: C:Program FilesFolding@HomeThread_0

Executable: FAH502-Console.exe

Arguments: -local -configonly

[04:59:18] Configuring Folding@Home…

User name [Anonymous]? drasnor

Team Number [0]? 93

Launch automatically at machine startup, installing this as a

service (yes/no) [no]? yes

The program will continue in non-service mode now, working in C:\Program Files\Folding@Home\Thread_0.

The next time the computer is starts up, you should see work automatically

continue there. Note that when this service is running, you should not try

to manually run F@H from that directory at the same time.

Ask before fetching/sending work (no/yes) [no]? no

Use Internet Explorer Settings (no/yes) [no]? yes

Allow receipt of work assignments and return of work results greater than

5MB in size (such work units may have large memory demands) (no/yes) [no]? yes

Change advanced options (yes/no) [no]? yes

Core Priority (idle/low) [idle]? idle

CPU usage requested (5-100) [100]? 100

Disable highly optimized assembly code (no/yes) [no]? no

Pause if battery power is being used (useful for laptops) (no/yes) [no]? no

Interval, in minutes, between checkpoints (3-30) [15]? 15

Request work units without deadlines (no-pref/no/yes) [no-pref]? no-pref

Ignore any deadline information (mainly useful if

system clock frequently has errors) (no/yes) [no]? no

Machine ID (1-8) [1]? 1

[05:00:28] – Ask before connecting: No

[05:00:28] – Use IE connection settings: Yes

[05:00:28] – User name: drasnor (Team 93)

[05:00:28] – User ID: 4B8984410A8D4095

[05:00:28] – Machine ID: 1

[05:00:28]

[05:00:28] -configonly flag given, so exiting.

You can answer whatever you like for name and team number though Team 93 is suggested ;) . You’ll want to say ‘no’ to ‘Allow receipt of work assignments and return of work results greater than 5MB in size?‘ if your computer has less than 1GB of RAM. You will need to say yes to ‘Launch automatically at machine startup, installing this as a service?’ and you will need to say 1 for ‘Machine ID?‘.

Next we set up the other clients.

cd “C:\Program Files\Folding@Home\Thread_1″

FAH502-Console.exe -local -configonly

Configuration is identical except for the ‘Machine ID?‘ question; answer 2 this time. Folding@Home uses the Machine ID variable to differentiate between the different clients running on your machine, so it’s important for every instance of FAH running on your machine to have a unique Machine ID. If your system has more than two threads you’ll want to continue configuring all your clients in this manner. It’s interesting to note that Stanford imposes a limit of 8 possible Machine ID’s which is more than enough for just about everyone though future users of eight-way dual-core Opteron servers will need to figure something else out.

Step 4: Finishing up

Though completely optional, you’ll want to do some registry tweaking to get the start parameters set properly. If you’re feeling lazy and have followed this guide nearly exactly (as in, you only have two threads and FAH is installed at C:Program FilesFolding@HomeThread_0 and Thread_1) then you can just merge the attached registry file.

Download the registry file here.

Advisory: Changing your registry is done at user risk even though we have tested the .reg download extensively. Downloading and installing is by user choice.

It will configure your clients with the -local and -svcstart tags and a short blurb about FAH in your Services applet. If you’re feeling a bit more ambitious and want to set additional tags like -advmethods or -forceasm, the locations of the client configurations are at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FAH@C:+Program Files+Folding@Home+Thread_0+FAH502-Console.exe

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FAH@C:+Program Files+Folding@Home+Thread_1+FAH502-Console.exe

And so on. Just add the tags you want on to the end of the ‘ImagePath’ value.

You should reboot now. Check your FAH logs manually to make sure they get a work unit and start working on it. You may wish to install a folding monitor like EMIII at your convenience. I hope you’ve found this guide useful regardless of which team you Fold for. Welcome to the Folding@Home project.

-drasnor

Comments

  1. primesuspect
    primesuspect awesome article, drasnor! Thanks!
  2. drasnor
    drasnor Wow, send that one back it needs some more editing. I didn't realize the VB tags didn't work outside the forums. :eek:

    -drasnor :fold:
  3. Lincoln
    Lincoln
    drasnor said:
    Wow, send that one back it needs some more editing. I didn't realize the VB tags didn't work outside the forums. :eek:

    -drasnor :fold:
    I expected it to work too, actually. :scratch: I'll fix it. :)

    //edit: I changed all the "code" items to bold.

    Good work, mate. :cheers:
  4. TheBaron
    TheBaron all of his \'s and /'s were removed, someone needs to manually put them back in
  5. _k_
    _k_ the easiest thing to do is run the four clients for part of a day and use FAHMon to check your ppd then switch over to the SMP for half a day and check your ppd with it, then of course pick the set up that yields the highest production for you.

    The other thing you might want to do is run dual SMP clients on your quad, same concept applied with SMP as with single core clients. Generally thats what a lot of quad users do if they have more than 2 GBs of ram, 2 SMP clients eat up some ram when they are running.
  6. QCH
    QCH Two SMP's will smoke 4 instances of the regular F@H... I'd say 7,000 points per day (ppd) verses 1,500 ppd. :wow2: