The ultimate megaguide to Folding@Home
Author Message
hiigaran Offline
Chief Bogan

Posts: 2,417
Threads: 134
Joined: 2012 Dec
The ultimate megaguide to Folding@Home
Folding@Home - Distributed-Computing


Basic: Advanced:

What is Folding@Home and distributed-computing?

In the realm of science, one of the most time-consuming challenges are that of data handling and processing. Many samples and repetitions are required to achieve a consistent and reliable result, and there are few fields of science this is more important in, than in biology, and more specifically, medical science. Technology has evolved to greatly assist in this endeavour, but with the complexity and raw work that is required to complete tasks, working on something such as a nanosecond of protein simulation can be surprisingly difficult to complete.

This is where distributed-computing comes into play. If one task would take years to complete on a single computer, there would be very little progress to be made. A supercomputer would be the next best option, if it wasn't so expensive to even rent one out. So the solution comes from distributed-computing; the process by which a task is split up into thousands of pieces or more, and delivered to other computers to complete. Once completed, the results are sent back, and put together in the right order.

In the case of Folding@Home, the originating location is Pande Lab, in Stanford University, and the computers these pieces are sent to are volunteers around the world. Folding@Home is one of the oldest voluntary projects that uses distributed-computing, focusing primarily on research involving cancer, Alzheimer's, Parkinson's and Huntington's. More specifically, the proteins that are involved with these diseases.

Why are proteins such a big deal?

While many associate proteins with muscles, proteins extend far beyond that. As the second most plentiful substance in your body after water, they are one of the most basic components to life itself. Not even bacteria or viruses can exist without proteins.

Proteins begin in the DNA of your cells. A molecule called RNA polymerase attaches to your DNA and races along a portion of its length, unzipping your DNA in a process called transcription. It essentially reads the four variables that make up your DNA (adenine, cytosine, guanine and thymine), and in the case of protein synthesis, creates a type of RNA strand with complementary bases. For example, if a length of your DNA contains the bases A, C, G and T, their complementary bases are U, G, C and A, where U is uracil; a replacement for thymine in RNA. The transcription process will continue for the necessary length, while the produced RNA peels away from the DNA.

An analogy could be that DNA and RNA are two different languages. The RNA Polymerase acts as a translator to convert DNA into RNA. This is oversimplified of course, and there is an additional process called translation later on that is different to the transcription process.

Once the transcription process is complete, the RNA strand, more specifically known as mRNA, or messenger RNA, leaves the nucleus of the cell and attaches to a ribosome to begin the process of translation (not to be confused with the analogy above). Within cells, ribosomes are responsible for creating the actual protein. The mRNA feeds through the ribosome like a tape, being read three bases at a time. Each combination of three bases is called a codon, and corresponds to a specific amino acid. Though four bases in three combinations results in 4^3 = 64 possible codons, there are only 20 (arguably 21) amino acids for humans and most animals, which means that some amino acids correspond to more than one codon.

While each codon is fed through, another type of RNA called tRNA, or transfer RNA, will bring a specific type of amino acid in to the ribosome. One end holds the amino acid, while the other end attaches to the mRNA, provided that the codon of the mRNA matches the anticodon of the tRNA. This works once again on the concept of complementary bases, though some bases may accept more than one match, which is why we end up with 20 amino acids, rather than 64. As each tRNA is accepted, the amino acid brought with it will attach to the ever growing chain that is being built. This chain, or string is what eventually becomes a protein, once the mRNA finishes running through the ribosome.

Theoretically, there is no limit on amino acid combinations, which means that any protein would have 20^n amino acids in it. The largest known protein in the human body is called Titin, with 27000 to 33000 amino acids, and makes up approximately half a kilo of an average adult human.

So why is this a big deal? Look at the process and the theoretical limits, then look at the thousands of proteins successfully simulated by Folding@Home since it began in 2000. The average number of amino acids in a protein is a little under 500, so if you were to calculate 20^500, this would be the approximate result for the potential number of protein combinations, just up until the average:


Of course, not every single one of those potential proteins would even exist, but it does show how quickly the numbers rise, when we deal with such variables. Folding@Home then focuses on particular types of proteins; those that are involved with the diseases that they work towards understanding, and how they cause the damage that they do.

How do I get started?

First, visit the Folding@Home website. At the top of the page, go to Start Folding. The page should automatically select the right download for you, but if not, there is a link underneath for alternative downloads. You can then follow the installation instructions for Windows, Linux, or Mac systems. You'll also need a passkey for security, and to qualify for bonus points.

Once you have the software installed, the software will ask for your username, team number and passkey. The team number for Brony@Home is 212997. You can then adjust basic configuration options to determine how Folding@Home will use your computing power


Do I need a constant internet connection?
By default, Folding@Home will download a new work unit when the current one is at 99% completion. Work units are no more than a few MB. So while you do need an internet connection, you don't have to have 100% uptime on it. It is however preferable, as you might face periods of inactivity.

Can my old computer even make a difference?
Brony@Home, and by extension, the entire Folding@Home project is all about strength in numbers. While there are a lot of users on our team and others in the project that have powerful systems, or access to large numbers of computers, the majority of users do not have that luxury. And that is fine. Every bit helps as far as science is concerned.

How do I know any progress is made? Cancer still hasn't been cured.
Folding@Home is not a magical 'cure for cancer' project, because we aren't at that stage yet. To prevent and cure cancer, we must first understand it, and to do that, we must understand the underlying causes, which are primarily issues with proteins. This is why cancer in particular is such a difficult field. However, for the curious, Folding@Home regularly publishes papers and other news articles, which can be found on their news page.

Won't this cost me a lot of money in power bills?
While there is an increase in power bills, this is typically no more than a few dollars for the average user per month. You could easily mitigate that by foregoing standby power on all your appliances and switching them off completely. For those in colder climates, you can also avoid using heaters and using the heat generated by your computer to warm your room instead!

Isn't heat bad for computers?
Your hardware is designed to run at full power on stock settings 24/7. The issue of heat generally comes into play when your cooling system has issues. This can be caused by large amounts of dust building up in your case, or a heatsink that is improperly attached to your CPU/GPU. There is no hard and fast rule on how hot is too hot for hardware, as different products will have different tolerances. The best way to check safe operating temperatures is to do a search online for "*your hardware model here* maximum temperature". Many tech review sites will display these values.

Remember, whether or not you are running Folding@Home, if you experience high temperatures, get it looked at regardless. Otherwise, something as simple as badly coded javascript from a website might give your wallet a nasty surprise down the track.

Will this slow down my computer?
For the most part, no. The CPU-based work units run on low priority, so it only ever uses whatever is not going towards your own needs. If you are gaming, Folding@Home will adjust accordingly. If you are idle, it will use all available power. This adjustment is done in real time to prevent interruptions or lag. That said, most GPUs currently do not have this feature, meaning that any task that is given to it, be it Folding@Home, rendering, or gaming, will be done at 100% power, and all simultaneous tasks will have shared power. For high end GPUs, this typically won't be a problem, but for slower GPUs, you may need to either manually pause and resume GPU folding as required, or set the power slider to an appropriate setting.

Can I run more than one computer under my name?
Absolutely. All you have to do is make sure your username, team number and passkey are the same across all systems, so that all stats are properly attached to your name.

Linux installation guide for nVidia GPU systems:

Many people love using Windows because if nothing else, it just works. It might have its issues with privacy, security or performance, but if you want to get a system set up, the amount of work typically required would be exponentially less on Windows, than it would be for a system running Linux.

Problem is, when dealing with the realm of citizen science, particularly the vast majority of projects that focus on using computing power to complete tasks, Windows falls short on two key factors: Performance and reliability. The following guide aims to walk you though setting up a system running Linux in a (hopefully) simple and straightforward manner.

Please note that this guide is for users with nVidia cards.

For this guide, I recommend using Ubuntu 18.04 as your distro, or any variation of it. It's among the simpler to use, and there is a large community for support. Once downloaded to your Windows computer, you'll want to download a tool like PowerISO on your Windows system to burn the .ISO file to a disc, or make a bootable flash drive using something like Rufus.

After your removable media is prepared, insert it into the computer you wish to install Ubuntu on, and boot it up. Keep an eye on the very first thing you see on your screen when the computer turns on, as it will mention somewhere that you should press a certain key to take you to a boot order setting. The boot order option might not exist, in which case you need to look out for the key you need to press to enter the BIOS or UEFI. Press it before the screen disappears. If you're entering through the BIOS/UEFI, look for the boot menu. There will be a boot order list which you will need to swap around, so that your removable media becomes the first in the boot order. Once this is done, save and exit.

Ubuntu should then boot. Either a simple interface will appear with a few options, such as "Install Ubuntu", or it will load a desktop that would appear as if the system is already installed. If the latter, you will find an icon on the desktop to install the system, which would bring up the same installer. Follow these instructions as they come. Most should be simple to go through. I recommend selecting the "Minimal Install" option when it appears, so cut down on unnecessary software. Once finished, the installer will ask you to remove the disc/flash drive and restart. Normally the computer should then boot into the installed operating system, but if it gets stuck, return to the boot order and set the first device to the one you installed Ubuntu to.

As soon as you get to the desktop, you'll want to open up the command line, which henceforth will be referred to as the terminal. You can usually find a button at the bottom of the screen to open it up, or you can simply use Ctrl + Alt + T. Type each command as shown below, followed by the enter key:

sudo add-apt-repository ppa:graphics-drivers/ppa

For nVidia users, you need nVidia drivers. This repository is a place for your system's updater to look for different software packages. In this particular case, the packages are all related to the different nVidia driver versions. After pressing enter, a lot of text will appear. This is just general information about the repository itself. Press enter again when prompted to complete the process.

sudo apt update

This will initiate the first part of the update process. When the command is run, the system will check all repositories for the most up to date list of available packages, and then compare them to what is installed on your system. This does two things. First, it compares available to installed packages to see what needs updating, and it gives your system the most up to date list of packages that can be installed.

sudo apt full-upgrade

This will be the actual updating procedure as most people would know it. Anything that can be updated, will be updated. After pressing enter, it will then prompt you with a yes or no question regarding whether you want to proceed. Type Y, and enter.

sudo apt install nvidia-384 nvidia-cuda-toolkit

Next, we will install two packages. First is the actual driver software, and the second is the CUDA software required for F@H GPU work units. Note that a single package with multiple words is never separated by a space. Spaces separate two packages, so you can install multiple packages without having to initiate the install procedure once for each package. Again, if prompted to continue with the installation, type Y and enter.


Now we're going to download the main F@H software. On Linux, there are two main packages. The client, and the controller. The controller is the graphical interface you are familiar with. This one isn't necessary. Only the client is needed. The command above will download the package straight from Stanford's servers. The reason this installation procedure is different to the other packages is because it is not part of Ubuntu's own repositories.

Also, you may have noticed in the URL at this is a beta version of the F@H software. At the time of this writing, the stable release is v7.4.4.

sudo dpkg -i fahclient_7.4.16_amd64.deb

Once the package has been downloaded, you need to install it. The above command will do this for you. During the installation, you will be prompted for your username, team number, and passkey, then asked about folding usage and whether or not F@H should be started automatically on boot.

sudo wget -P /var/lib/fahclient/

The last step is to update the list of supported GPUs for the F@H software. The command above will download the relevant file, then place it in the appropriate directory.

sudo reboot now

And lastly, time to restart.

sudo /etc/init.d/FAHClient stop
sudo nano /etc/fahclient/config.xml

Next, you need to configure F@H, so firstly, we need to shut it down, assuming you have set it to start automatically on boot. If you plan on starting it manually, ignore the first line. The second line is the configuration file we will edit. The following is my own config.xml contents:

 <!-- Network -->
 <proxy v=':8080'/>

 <!-- Slot Control -->
 <power v='full'/>

 <!-- User Information -->
 <passkey v='xxx'/>
 <team v='212997'/>
 <user v='hiigaran'/>

 <!-- Folding Slots -->
 <slot id='0' type='CPU'/>
 <slot id='1' type='GPU'/>
 <slot id='2' type='GPU'/>
 <slot id='3' type='GPU'/>
 <slot id='4' type='GPU'/>

Breaking this down by each section, the network and proxy lines are default values and can be ignored. Slot control and power are based on what you selected when you installed the fahclient package. You can change the value from here if need be. User information is self explanatory. I omitted my passkey for obvious reasons, but you should have your own key in place of the xxx. Folding slots is what you will need to look at. Each slot will have a unique ID. The number doesn't matter, as long as it's unique, and an integer of 0 or greater. The type is also obvious. I have one slot for my CPU, and four slots for my GPUs. Depending on your hardware, this data will likely be different to my own.

For nVidia users, the recommended setup is to have one slot per GPU. Remember that each GPU requires one core on your CPU, so if you have a quad core CPU and four GPUs, there's no point having a CPU slot that will use any remaining cores. Same would apply in a dual core CPU setup with two GPUs.

Once you are finished with your configuration file, press Ctrl+X to quit. You will be asked if you want to save changes. Y and enter.

In most cases, the F@H software will automatically detect your hardware and start folding normally

sudo /etc/init.d/FAHClient restart

This command will restart F@H. If it was running while you were configuring the file, the changes would not take place until it was restarted, so the command will stop, then start F@H. If it was already stopped, then it will just start it, plain and simple. Give the software a minute or two to start up and download some work units. Then open up the log:

nano /var/lib/fahclient/log.txt

Scroll to the end using the down or page down keys and read the lines backwards. Look for anything that suggests that there might be issues with getting work units running. Repeated BAD WORK UNIT messages, or missing messages from configured slots (eg, FS01 is slot 1). If your GPU slots are not folding, then they may be misconfigured. Normally, this should not happen on a single GPU system. Issues usually arise in multi GPU systems due to conflicts. In these cases, you would need to return to the config.xml file and edit the slot information. An example is provided below:

 <slot id='1' type='GPU'>
   <cuda-index v='1'/>
   <gpu-index v='1'/>
   <opencl-index v='1'/>

First note that the slash at the end of the slot line was removed, and a closing slot tag was added at the end. Between the tags are three index options. One is for the GPU index, and the other two are for CUDA and OpenCL indexes. In conflict situations, you likely won't need to have all three tags, so the best thing to do is to start by adding the GPU index tag first, and in the value, set it to a certain number. Start with 0, save and exit, then restart FAHClient, as shown previously. Then run the following command:


This will give you details on your GPUs. Of importance is your GPU utilisation percentage. If it's not a high value, it's not doing anything. You can also inspect the F@H log.

If it starts working as intended, you're done. If it doesn't, edit the config.xml file again, and increase the index by 1. Repeat this until it works. If you've gone into double digits, the GPU index probably isn't the issue. Remove it, and replace it with the CUDA and OpenCL tags instead. Repeat as before, and match the CUDA and OpenCL values to each other per slot. If it still doesn't work, add the GPU index as well, and repeat. It's an annoying process, but it should eventually work. Just make sure you're restarting FAHClient each time you save the config.xml file.

Keep in mind that even though the index values can be identical between the three tags in one slot, they should not match the values in any other slot for their given index.

By this point, you're hopefully folding on Linux. But the fun does not stop there. You may wish to set a custom fan speed for your cards. Unfortunately, software like PrecisionX or Afterburner do not exist for Linux systems, so fire up the terminal once more and type the following:

sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration

This enables fan control and overclocking functions on your GPUs. Nothing actually changes just yet. It just enables it for the future.

nano fancontrols

You will now open up the nano text editor with a blank file. This file does not exist, but we are naming it fancontrols, so when it is saved, the created file will be named as such. In this file, we will add one command per line to control various aspects of each GPU. The commands we will look at are as follows:

nvidia-settings -a [gpu:0]/GPUFanControlState=
nvidia-settings -a [fan:0]/GPUTargetFanSpeed=
nvidia-settings -a [gpu:0]/GPUGraphicsClockOffset[3]=
nvidia-settings -a [gpu:0]/GPUMemoryTransferRateOffset[3]=

The first line enables or disables fan controlling commands. Add a 0 to the end of the line without any spaces to disable, or add a 1 to enable. We obviously want the latter. The second line sets the fan speed as a percentage value, and so you want to add any number from 0 to 100 to the end of the line. Doing this will disable the GPU's own fan controller, and set the fans to a constant speed. If your GPU runs hot and you want the fans running faster, these first two lines are what you need to set.

The last two lines will adjust your GPU and VRAM speeds respectively. Adding a number to the end of each line will offset the stock speeds by the specified amount. It is very important to keep in mind that this is an offset from the stock clocks. Forgetting this little detail can damage your card. If your stock core is 1000 MHz and you want to overclock to 1100 MHz, do NOT type in 1100, or you'll basically tell the software to run your GPU at 2100 MHz. Instead, type in 100.

You'll also notice that for each line, there is a [gpu:0] or [fan:0]. If you have multiple cards, change the number from 0 to something else to each card that you have. These settings will only affect the card/fan specified by the number. Below are the commands used in my own file:

nvidia-settings -a [gpu:0]/GPUFanControlState=1
nvidia-settings -a [fan:0]/GPUTargetFanSpeed=100
nvidia-settings -a [gpu:0]/GPUGraphicsClockOffset[3]=50
nvidia-settings -a [gpu:1]/GPUFanControlState=1
nvidia-settings -a [fan:1]/GPUTargetFanSpeed=100
nvidia-settings -a [gpu:1]/GPUGraphicsClockOffset[3]=50
nvidia-settings -a [gpu:2]/GPUFanControlState=1
nvidia-settings -a [fan:2]/GPUTargetFanSpeed=100
nvidia-settings -a [gpu:2]/GPUGraphicsClockOffset[3]=50
nvidia-settings -a [gpu:3]/GPUFanControlState=1
nvidia-settings -a [fan:3]/GPUTargetFanSpeed=100
nvidia-settings -a [gpu:3]/GPUGraphicsClockOffset[3]=50

As you can see, each type of command must be run for each individual card.

Now, whether you choose to overclock or just set fan speeds, save the file and exit. Now type:

sudo chmod +x fancontrols

This allows the file to be executable. To test whether the file works, type:


If it works, you should see a lot of lines appearing stating that the values of each option have been assigned their relevant values as per the file's contents. If not, then you'll need to see what messages are displayed instead and look up the cause of it. If you're overclocking, be sure to let the system run at full load for at least a few hours to ensure the clocks are stable. During this time, monitor your F@H log and look for any lines that might indicate a work unit has ended early. If you're getting a lot of failed units, your overclock is borderline unstable, and will not work for F@H. Dial the settings back a bit by editing the overclocking commands, then try again.

This next part will be done outside of the terminal, mostly because I still haven't been able to get it working any other way. Once you are sure your clocks are stable, go to your startup applications list. This will be listed in your system settings menu, or through a search for startup applications. Add a new startup entry and browse for the file you just saved. If you followed the commands before opening the text editor, it should be in your home directory, or ~. Select the file, give it a name, and save. If you reboot, you should hear your fans adjusting to your set speeds when the system starts up.

This should cover the basics. While this all looks like it would be a pain in the ass to do, F@H performs better with Linux, as does BOINC. A dedicated folding rig should always run Linux, and unless you're gaming, you could probably also make the switch if you have the patience to learn a little.
[Image: sigimage.php?FAHUser=hiigaran&FAHTeam=21...hangeling1]
(This post was last modified: 2018-04-29, 02:29:53 AM by hiigaran.)
2017-12-30, 01:33:28 PM
Website Find Reply
hiigaran Offline
Chief Bogan

Posts: 2,417
Threads: 134
Joined: 2012 Dec
RE: The ultimate megaguide to Folding@Home
Guys, with the release of Ubuntu 18.04, I have revised the guide for Linux installations. Compared to what I've had to do before, getting GPU folding up and running is now so much easier.
[Image: sigimage.php?FAHUser=hiigaran&FAHTeam=21...hangeling1]
2018-04-29, 02:17:34 AM
Website Find Reply