Difference between revisions of "Folding@home"

From ArchWiki
Jump to: navigation, search
m (Handy Multi-Core command: Clarification of username and FAH_USER)
m (Added lots of sudo's that were missing plus a few little tweaks)
Line 3: Line 3:
 
= What is Folding@Home =
 
= What is Folding@Home =
 
From the [http://aur.archlinux.org/packages.php?do_Details=1&ID=11852&O=0&L=&C=&K=folding&SB=&SO=&PP=&do_MyPackages=&do_Orphans=&SeB= AUR package page] "Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases."
 
From the [http://aur.archlinux.org/packages.php?do_Details=1&ID=11852&O=0&L=&C=&K=folding&SB=&SO=&PP=&do_MyPackages=&do_Orphans=&SeB= AUR package page] "Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases."
 +
 +
Please see the [http://folding.stanford.edu/ Folding@Home site] for a fuller description.
  
 
= Installing Folding@Home =
 
= Installing Folding@Home =
Line 14: Line 16:
 
If you are using [[Aurbuild]], it's as simple as:
 
If you are using [[Aurbuild]], it's as simple as:
  
  aurbuild -s foldingathome
+
  sudo aurbuild -s foldingathome
  
 
If you are using [http://archlinux.fr/yaourt-en yaourt] , it's as simple as:
 
If you are using [http://archlinux.fr/yaourt-en yaourt] , it's as simple as:
  
  yaourt -S --aur foldingathome
+
  sudo yaourt -S --aur foldingathome
  
  
Line 30: Line 32:
  
 
Run  
 
Run  
  pacman -U foldingathome-version-number.pkg.tar.gz
+
  sudo pacman -U foldingathome-version-number.pkg.tar.gz
 
being sure to replace version-number first ;)
 
being sure to replace version-number first ;)
  
Line 42: Line 44:
 
Firstly, you will want to open your /etc/conf.d/foldingathome config file, with your editor of choice.
 
Firstly, you will want to open your /etc/conf.d/foldingathome config file, with your editor of choice.
  
  nano /etc/conf.d/foldingathome
+
  sudo nano /etc/conf.d/foldingathome
  
 
The config is self explanatory, if you wish to have Folding@Home run as a user other than root (handy on single user systems, probably more secure on multi-user systems), or in a different group, then change these values.
 
The config is self explanatory, if you wish to have Folding@Home run as a user other than root (handy on single user systems, probably more secure on multi-user systems), or in a different group, then change these values.
Line 52: Line 54:
 
give it a few seconds and then run  
 
give it a few seconds and then run  
  
  /etc/rc.d/foldingathome stop
+
  sudo /etc/rc.d/foldingathome stop
  
 
You will find under your /opt/fah/ directiory, either new files or a new folder, if you set the user variable in /etc/conf.d/foldingathome. You will find a file called client.cfg, either in the /opt/fah dir or the /opt/fah/FAH_USER folder.
 
You will find under your /opt/fah/ directiory, either new files or a new folder, if you set the user variable in /etc/conf.d/foldingathome. You will find a file called client.cfg, either in the /opt/fah dir or the /opt/fah/FAH_USER folder.
  
  nano /opt/fah/client.cfg
+
  sudo nano /opt/fah/client.cfg
 
or
 
or
  nano /opt/fah/FAH_USER/client.cfg  # Replacing FAH_USER first
+
  nano /opt/fah/FAH_USER/client.cfg  # Replace FAH_USER first
  
  
Line 66: Line 68:
 
*username, username associated to the work-units you return (not related to the FAH_USER variable in /etc/conf.d/foldingathome).
 
*username, username associated to the work-units you return (not related to the FAH_USER variable in /etc/conf.d/foldingathome).
  
*team, the team number you wish to contribute points to (earned for work units returned), you will of course want to fill in 45032, the arch-linux team number;)
+
*team, the team number you wish to contribute points to (earned for work units returned), you will of course want to fill in 45032, the arch-linux team number ;)
  
*bigpackets, defines whether you will accept memory intesive work loads. If you have no problem with Folding@Home using up your RAM, then set this to yes (atleast 512MB of RAM recommended).
+
*bigpackets, defines whether you will accept memory intesive work loads. If you have no problem with Folding@Home using up more of your RAM, then set this to yes (atleast 512MB of RAM recommended).
  
 
*machineid, covered in the Multi-Core section.
 
*machineid, covered in the Multi-Core section.
Line 82: Line 84:
 
Assuming it all ran correctly, you'll want to put it in /etc/rc.conf to run on startup, so
 
Assuming it all ran correctly, you'll want to put it in /etc/rc.conf to run on startup, so
  
  nano /etc/rc.conf
+
  sudo nano /etc/rc.conf
  
 
and add @foldingathome to your DAEMONS variable (the @ causes it to start in the background, so as not to slow startup, see [[Daemons]]).
 
and add @foldingathome to your DAEMONS variable (the @ causes it to start in the background, so as not to slow startup, see [[Daemons]]).
Line 136: Line 138:
  
  
if they exist, this way you won't be working on the work-unit that the original thread was working on twice.
+
if they exist, this way the new process won't start working on the same work-unit as the original thread.
  
 
You now have to open up the config for the new process
 
You now have to open up the config for the new process
  
  nano /opt/fah2/client.cfg
+
  nano /opt/fah2/FAH_USER/client.cfg
  
and change the machine ID to a different number to that of /opt/fah/client.cfg.
+
and change the '''machineid''' to a number different to the one in /opt/fah/client.cfg.
  
If you're using the bigpackets option in client.cfg, you should only have it set to yes for '''one''' of your Folding@Home processes as it can overwhelm your system otherwise.
+
If you're using the bigpackets option in client.cfg, you should only have it set to yes for '''one''' of your Folding@Home processes as it can overwhelm your system unless you have plenty of free RAM (1GB at least).
  
 
=== Editing Init Scripts ===
 
=== Editing Init Scripts ===
Line 152: Line 154:
 
First, some initial editing has to be done to the current script and saved under another name
 
First, some initial editing has to be done to the current script and saved under another name
  
  nano /etc/rc.d/foldingathome
+
  sudo nano /etc/rc.d/foldingathome
  
  
Line 197: Line 199:
 
Make a copy of the script
 
Make a copy of the script
  
  cp /etc/rc.d/foldingathome1 /etc/rc.d/foldingathome2
+
  sudo cp /etc/rc.d/foldingathome1 /etc/rc.d/foldingathome2
  
 
Now you have to find and replace instances of /opt/fah with /opt/fah2 in this script, double checking you aren't getting any false positives (there shouldn't be any, but scripts change). Make sure you get the one in the PID variable, otherwise the whole pgrep bit was a bit pointless ;)
 
Now you have to find and replace instances of /opt/fah with /opt/fah2 in this script, double checking you aren't getting any false positives (there shouldn't be any, but scripts change). Make sure you get the one in the PID variable, otherwise the whole pgrep bit was a bit pointless ;)

Revision as of 09:37, 24 September 2007


What is Folding@Home

From the AUR package page "Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases."

Please see the Folding@Home site for a fuller description.

Installing Folding@Home

Folding@Home is no longer in the community repository due to licensing issues. However, it is still possible to build it from AUR. If you are familiar with PKGBUILDS and AUR then build it and skip to configuration.


Automatic Install

If you are using Aurbuild, it's as simple as:

sudo aurbuild -s foldingathome

If you are using yaourt , it's as simple as:

sudo yaourt -S --aur foldingathome


Manual Install

To install manually, first download everything under the files section of the Folding@Home AUR page to a folder. Open a console and cd to the directory you downloaded to. Now it's just a matter of running

makepkg

and if there are no errors you will be left with a package called foldingathome-version-number.pkg.tar.gz.

Run

sudo pacman -U foldingathome-version-number.pkg.tar.gz

being sure to replace version-number first ;)

If all went well, Folding@Home should now be installed.



Configuration

Firstly, you will want to open your /etc/conf.d/foldingathome config file, with your editor of choice.

sudo nano /etc/conf.d/foldingathome

The config is self explanatory, if you wish to have Folding@Home run as a user other than root (handy on single user systems, probably more secure on multi-user systems), or in a different group, then change these values.

Now run the Folding@Home process for the first time with

sudo /etc/rc.d/foldingathome start

give it a few seconds and then run

sudo /etc/rc.d/foldingathome stop

You will find under your /opt/fah/ directiory, either new files or a new folder, if you set the user variable in /etc/conf.d/foldingathome. You will find a file called client.cfg, either in the /opt/fah dir or the /opt/fah/FAH_USER folder.

sudo nano /opt/fah/client.cfg

or

nano /opt/fah/FAH_USER/client.cfg  # Replace FAH_USER first


The most important settings here are:


  • username, username associated to the work-units you return (not related to the FAH_USER variable in /etc/conf.d/foldingathome).
  • team, the team number you wish to contribute points to (earned for work units returned), you will of course want to fill in 45032, the arch-linux team number ;)
  • bigpackets, defines whether you will accept memory intesive work loads. If you have no problem with Folding@Home using up more of your RAM, then set this to yes (atleast 512MB of RAM recommended).
  • machineid, covered in the Multi-Core section.


After editing that, run

sudo /etc/rc.d/foldingathome start

again, to start Folding@Home up.


Assuming it all ran correctly, you'll want to put it in /etc/rc.conf to run on startup, so

sudo nano /etc/rc.conf

and add @foldingathome to your DAEMONS variable (the @ causes it to start in the background, so as not to slow startup, see Daemons).


Folding@Home is now installed and running!


Handy commands

Add

fahstat() {
	echo
	echo `date`
	echo
	cat /opt/fah/FAH_USER/unitinfo.txt   #(replacing FAH_USER first)
}

to your .bashrc , .zshrc or .whateverrc, for a summary of what Folding@Home is up to.

Also, replacing the cat command with tail -n1

fahstat() {
	echo
	echo `date`
	echo
	tail -n1 /opt/fah/FAH_USER/unitinfo.txt   #(replacing FAH_USER first)
}

will give you just the percentage of work-unit complete.

Multi-Core Cpu's and Folding@Home

A Quick Note On Hyperthreading

If you have a single-core hyperthreading CPU, you may be tempted to follow the multi-core instructions. It's highly recommened you don't do this as the Folding@Home team prefer fewer results quickly, than more results slowly. There's also a time-limit on work-units, so if it runs slower, your work-units may not be returned in time, and so distributed to another user. If you have one core, run one folding process.

Multiple Folding@Home Installs

Setting up Multiple Folding@Home installs

It's very simple to set up an extra install, although after each (rare) upgrade of the Folding@Home package, you will have to perform some maintenance, unless you wish to build separate packages with custom PKGBUILDS / scripts (beyond the scope of this tutorial). This method should also scale to however many cores/processors you have.

First, stop Folding@Home if it's running

sudo /etc/rc.d/foldingathome stop

next

sudo cp -r /opt/fah /opt/fah2

If you wish to call it something different, then by all means do. This tutorial will assume you're using /opt/fah2 for your second install and that you have the FAH_USER directory.

Now

rm -rf /opt/fah2/FAH_USER/work  /opt/fah2/FAH_USER/queue.dat


if they exist, this way the new process won't start working on the same work-unit as the original thread.

You now have to open up the config for the new process

nano /opt/fah2/FAH_USER/client.cfg

and change the machineid to a number different to the one in /opt/fah/client.cfg.

If you're using the bigpackets option in client.cfg, you should only have it set to yes for one of your Folding@Home processes as it can overwhelm your system unless you have plenty of free RAM (1GB at least).

Editing Init Scripts

Now comes the fun part. A second init script needs to be created and a little editing needs to be done, but this way you can turn each process on and off as wanted and it's simpler than one script managing both.


First, some initial editing has to be done to the current script and saved under another name

sudo nano /etc/rc.d/foldingathome


After

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/foldingathome

Add

FAH_VER=504


This is to cut down on later maintance.


Next, change

PID=`pidof -o %PPID /opt/fah/FAH504-Linux.exe`

to

PID=`pgrep -f /opt/fah/FAH${FAH_VER}-Linux.exe -u $FAH_USER`

The reason for this is that pidof detects the first and second Folding@Home process as the same and so stopping one init script will kill both processes. On the other hand, pgrep will find the proccess associated filename/location. The "-u $FAH_USER" part is tacked on as a precaution, in case you are doing something strange with Folding@Home threads and users. You'll also notice the FAH_VER has slipped in there.

There should be two more instances of /opt/fah/FAH504-Linux.exe, change them to

/opt/fah/FAH${FAH_VER}-Linux.exe


You can also change the

stat_busy "Starting Folding@Home"

stat_busy "Stopping Folding@Home"

lines to have some extra description such as "on Core 1" if you need to.

Now save the file as /etc/rc.d/foldingathome1 , this is to prevent it being over-written by a package upgrade.


Make a copy of the script

sudo cp /etc/rc.d/foldingathome1 /etc/rc.d/foldingathome2

Now you have to find and replace instances of /opt/fah with /opt/fah2 in this script, double checking you aren't getting any false positives (there shouldn't be any, but scripts change). Make sure you get the one in the PID variable, otherwise the whole pgrep bit was a bit pointless ;)

Now, save this script and open up /etc/rc.conf and add @foldingathome1 and @foldingathome2 to the DEAMONS variable. Start up the two processes

sudo /etc/rc.d/foldingathome1 start
sudo /etc/rc.d/foldingathome2 start

and if all goes well, you've got 2 Folding@Home processes running!


Maintenance

When upgrading the Folding@Home package, it's recommended you stop both Folding@Home init-scripts first

sudo /etc/rc.d/foldingathome1 stop
sudo /etc/rc.d/foldingathome2 stop

On upgrading, /opt/fah/FAH504-Linux.exe will be replaced with a new version, this needs to be copied into your /opt/fah2 directory and the old executable deleted.

You then just have to change the FAH_VER variable in both scripts to reflect the new version number. You can then restart both scripts with

sudo /etc/rc.d/foldingathome1 start
sudo /etc/rc.d/foldingathome2 start

It may also be worth checking that there have been no other significant changes to the updated original script.

Handy Multi-Core command

As with the handy command for single core .whateverrc, this

fahstat() {
        echo
        echo `date`
        echo
        echo "Core 1:";cat /opt/fah/FAH_USER/unitinfo.txt      #(replace FAH_USER first)
        echo
        echo "Core 2:";cat /opt/fah2/FAH_USER/unitinfo.txt     #(replace FAH_USER first)
}

may be useful.

Folding@Home SMP Support

Folding@Home SMP Client on AUR

Folding@Home SMP Client FAQ


External Links

Folding@Home Site

Folding@Home FAQ

Folding@Home Configuration FAQ

Arch Folding@Home team page

Extended Arch team statistics on extremeoverclocking.com