Overview

 

A friend of my wife recently lost her husband to a rare form of Cancer. From diagnosis to death it was only 1.5 years. It breaks my heart to know you can lose someone you plan on spending the rest of your life with so quickly, and at such a young age. Unfortunately, I am not a Doctor, so it isn’t like I can go to work and cure something. But where can I contribute? Folding@Home, a project by Stanford University.

They distribute the data they need to crunch, we do the work and send the results back. In other words, we are acting as distributed computing nodes for the guys at Stanford. A CPU will do an okay job at this, but GPUs are better. If you keep up with the site at all, you will note I have just recently been building a Crypto Mining Rig. While it is much more profitable to be mining, than folding, it seems like a worthy cause to let the Rig spend an hour a day on Folding@Home at full power.

In doing this, I noticed most of the instructions are intended for people using a GUI. There was also a lack of direction on using it from the CLI, or even a basic explanation of whats going on. So, maybe if I post some, I can entice other people to contribute some of their Rig’s power.  

Installation

 

First, think up a username, and head here to get a passkey. Next, we obviously need the software installed. I am using Ubuntu 17.10, without a GUI, so it should be fairly similar to any recent version of Debian.

There are three components: fahclient, fahcontrol, and fahviewer.
I managed to get away with just the fahclient package.

# wget --no-check-certificate https://fah.stanford.edu/file-releases/public/release/fahclient/debian-testing-64bit/v7.4/fahclient_7.4.4_amd64.deb
# dpkg -i --force-depends fahclient_7.4.4_amd64.deb

Now, when I did the above, I noticed I got an error when it tried to add itself to the start up scripts.

update-rc.d: error: no runlevel symlinks to modify, aborting!

To resolve this, I ran:

# update-rc.d FAHClient defaults
# dpkg -i --force-depends fahclient_7.4.4_amd64.deb

What we did was pre-add it to the startup script, and then force the install to appease the post-install script. This time you’ll notice the dpkg installs without a problem. It also started with a basic ncurses configuration script.  

Advanced config

 

I wasn’t pleased with what the configuration script gave me. I didn’t want the CPUs on this rig folding, and it didnt even try to add the GPUs. I also wanted to be able to see the status remotely. So I wiped the config, and started with the following:

root@rig1:~# cat config.xml 
<config>
  <!-- HTTP Server -->
  <allow v='127.0.0.1 10.0.0.101 10.0.0.102'/>

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

  <!-- User Information -->
  <passkey v='YOURPASSKEY'/>
  <team v='111065'/>
  <user v='YOURUSERNAME'/>

  <!-- Web Server -->
  <web-allow v='127.0.0.1 10.0.0.201 10.0.0.102'/>

  <!-- Folding Slots -->
  <slot id='0' type='GPU'/>
  <slot id='1' type='GPU'/>
  <slot id='2' type='GPU'/>
  <slot id='3' type='GPU'/>
</config>
root@rig1:~# 

When you start the FAHClient, you will notice it starts up a daemon on port 7396. This is a webserver that you can use to see what project you are crunching for, and the status. The page seemed pretty finicky, and sometimes required that I hard refresh it(ctrl+f5) or it would just continuously load. Start by replacing my 10.0.0.x ips in the allow and web-allow fields with the ips of the machines you would like to be able to view this page from. This is not the IP of the webserver. This is an allow list, to allow the IP you will be viewing it from. eg: Your cell phone on the LAN, or your desktop.

Next we have user, you want to pick something unique here to make sure your stats are your own. So, make sure to replace YOURUSERNAME with, well, your username. Do the same thing with YOURPASSKEY, if you went to the link earlier, to sign up for one, you should have this in your email. Replace the YOURPASSKEY with the passkey from your email.

Now, team is a bit tricky. Some teams offer incentives. For example, I chose to join team EVGA. EVGA will give you up to $10 credit per month on their site if you fold enough to earn 4 million points. It isn’t much, when you factor in hardware, electricity, etc… but its a very nice gesture on their part. Details here

Last, this machine has 4 GPUs. So I added 4 slots. You will obviously want to adjust that for how many GPUs your rig has. Side note, I have not found any method to control which GPU it uses. With 1 slot configured, it would pick my third GPU despite changing the slot numbers, or passing it in via gpu-index. Unfortunately this prevents me from being able to simply dedicate one card to folding.
 

Start folding!

 

Typically, I start with screen, so I can detach from the client and come back later to check status. With my configuration file(from above) saved in the currect directory as config.xml, I run:

FAHClient --config=./config.xml

 
That seems easy enough right? Well, it gets better. Open up a browser, and navigate to the machine on port 7396. For me, this would be http://10.0.0.97:7396. On the webpage, that stop folding button is handy, and can be used to tell it to stop, or to finish up. But this is focused on command line, so lets explore more of those options.  

Command Line usage

 
When you start the client, it starts an API on port 36330. From what I understand, you can actually telnet to it and issue commands directly. But I chose to use the facilities offered by the client. In other words, you can use the client to send commands to the API. At this point, I assume the client is running, and you are detached from the screen session, or it is daemonized.
 

Stop when finished with current work units:

root@rig1:~# FAHClient --config=./config.xml --send-finish
20:47:10:INFO(1):Read GPUs.txt
20:47:10:Connecting to 127.0.0.1:36330
root@rig1:~# 

Should see in original console:
20:47:10:FS00:Finishing
20:47:10:FS01:Finishing
20:47:10:FS02:Finishing
20:47:10:FS03:Finishing

 
Pause/Unpause:

FAHClient --config=./config.xml --send-pause
FAHClient --config=./config.xml --send-unpause

 
Send config options:

FAHClient --config=./config.xml --send-command 'options client-type=advanced'
FAHClient --config=./config.xml --send-command save

 
This sets your client up to receive some of the more advanced work units. It then saves the config. This option can be swapped out with any option you would normally list in the config file.
 

Stats

 
I like to be able to view my stats, it gives me a good idea for how I am doing, and it also gets me a bit competitive. The stats on EVGAs site only update once a day, which is not how often I check. So I needed a better place to view my stats. Stanford publishes a raw log of the stats every hour, other sites use this file to update their stats and draw us pretty graphs. The best one I have found so far is Extreme Overclocking. Search for your username on the left side.  

I realize it may not help as much as donating a million dollars. Unfortunately I don’t have a million dollars. But, it does give us the ability to help the guys doing the work much more directly. Maybe, working together, we can make a difference.