Folding At Home: Install/Config

UPDATE: Now with Nvidia GPU folding! I’m still using an AMD RX580 as my primary video card with kernel amdgpu drivers, but I installed an Nvidia GTX 750Ti in a second slot to do the folding. I’ve modified the text below.

With the recent outbreak of COVID-19, Folding@Home is now sending out work units to help understand and combat this new virus. It is easy to install, configure, and run in both GUI and CLI Linux installs. The only issue I’ve seen is that I need to set it to run on idle only when playing games like ESO or framerates might drop.

The following instructions can be followed to install and run the client — instructions are based on Fedora/CentOS but it can give you an idea how to run it on your own distro.

Known Issues

There are a few known issues that I’ve run across running F@H in Linux. They are summarized here:

  • The web interface will keep trying to reload itself in Chrome-based browsers periodically. I believe this happens when a new work-unit is started but i’m not exactly sure. This problem is supposed to be fixed in an upcoming release of F@H.
    • The workaround is to always open the web interface in a private window or to use Firefox.
  • The FAHControl program will not install on Fedora. It relies on Python2 libraries and much of Fedora is on Python3.
    • You can get a working Python3 version of FAHControl from this github repo https://github.com/neek78/fah-control-py3.git and it appears to work with one change in Fedora. Around line 211 in Client.py you’ll need to change the value.encode(‘string_escape’) to value.encode(‘unicode_escape’). After that change, the program runs correctly on my system.
  • Don’t forget to open the necessary ports in your firewall so you can view the web interface.

Downloading

Download the client from the https://foldingathome.org/start-folding/ website. There is also a viewer and and control program for download but note the control program does not appear to install on Fedora/CentOS due to python2 requirements. The viewer program is a nice visualization but it is really not needed.

F@H Passkey

You can also create a passkey that uniquely identifies you on F@H stats page. More information can be found on the F@H Support page for passkeys located at https://foldingathome.org/support/faq/points/passkey/

F@H installation

Install the client on your computer using your installer:
Fedora: sudo dnf install fahclient*.rpm
Debian: sudo apt install fahclient*.deb

This installs the main program in /etc/init.d on Fedora; I assume it is the same on Debian-based systems. It might also be placed under /opt. The configuration file is stored at /etc/fahclient/config.xml on Fedora.

GPU drivers

In my system I now have two GPUs: my primary AMD RX580 and a secondary Nvidia 750Ti dedicated to folding. Note: folding on the AMD is not possible in Linux due to the lack of OpenCL in the kernel driver. You might use the amdgpu pro driver but I prefer to use the kernel driver so it is always up-to-date when the kernel is updated.

To install the Nvidia drivers, I just used the rpmfusion instructions:

sudo dnf update -y
sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda

After the first dnf update -y, you should update your grub.cfg if this update installs a new kernel and then reboot into the latest kernel.

If you are running RHEL or CentOS, you can substitute kmod-nvidia for akmod-nvidia in the second step. And you’ll need the cuda driver to be able to fold using the GPU.

Note: the akmod-nvidia install failed for me; for some reason installing that package failed to create the akmods group. I manually added the group using groupadd akmods and then reinstalled akmod-nvidia via dnf reinstall akmod-nvidia.

GPU configuration for F@H

When setting up the config file for GPU folding when you have multiple video cards, you’ll need to know what gpu-index to use. The way I found it was to change the config to allow GPU folding and then just put in index=0 and checked the web interface to see what card was discovered; as i expected, the Nvidia card was index=1.

At this point, the GPU would still not fold because it could not find the opencl libraries; for Nvidia, it needs CUDA not OpenCL. So I had to specify the opencl-index as 0. Leaving the cuda-index at -1 allowed it to find the necessary libraries and start folding.

I also added an extra line to make sure my card didn’t overheat but that apparently only works in F@H if you have a single card. By using the Nvidia X Server Settings program i noticed that the temps never got high enough while folding to worry about it. I’m also running the Thermal Monitor widget in KDE in my top panel so I can always see the GPU temp. I left the extra settings in the config file for documentation sake, even though it will throw a few errors in the log.

Configuration file

The config file is stored in /etc/fahclient/config.xml and my sanitized version is shown below. This sets my username and passkey as well as my team number which is FedoraFolders (37988). It also allows me to remotely connect to its website controller from my local network (192.168.1.1/24).

<config>
  <!-- HTTP Server -->
  <allow v='192.168.1.1/24'/>
  <web-allow v='192.168.1.1/24'/>

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

  <!-- Remote Command Server -->
  <password v='REMOTE_PASSWORD'/>

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

  <!-- User Information -->
  <passkey v='YOUR_PASSKEY'/>
  <team v='YOUR_TEAM'/>
  <user v='YOUR_USERNAME'/>

  <!-- Folding Slots -->
  <slot id='0' type='CPU'/>
  <slot id='1' type='GPU'>
    <gpu-index v='1'/>
    <opencl-index v='0'/>
    <extra-core-args v='-tmax=80 -twait=900'/>
  </slot>
</config>

FAHClient commands

The FAHClient has the following commands:
start,stop,restart,reload,status,log
Once you update your config.xml file, be sure to do a sudo ./FAHClient reload to update the config settings.

Firewall

If you are running a firewall program like firewalld, be sure to open port 7396 to view the work being performed and control the client using your website at http://localhost:7396 or a remote computer on your local network by replacing localhost with the machine’s name or IP.

For users of firewalld, use the following commands. The first command shows you the active firewall zone; use that zone in the second command to add the firewall rule to open the F@H port on your active zone. Then restart the firewall service.
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --permanent --zone=YOURZONE --add-port=7396/tcp

sudo systemctl restart firewalld

F@H in a container

This has also been tested and is running well in a Proxmox container. I am using CentOS but it should also work with any distro in the container. I’d recommend using a lightweight distro (server CLI) to use less resources on the Proxmox server.