Folding@Home with GPU support on Ubuntu 18.04 (mar 2020)

I ran into a few gotchas getting the GPU compute to work with folding@home on Ubuntu. Here is a quick rundown on how to get it working.

Install your GPU graphics drivers

This depends on your GPU and there’s a good chance you have this done already. If not, I recommend using the pop!_os PPA to get the latest version automatically through apt. With your new found interest in high performance computing you may consider installing CUDA using the same PPA (optional).

# set up sources
sudo echo "deb http://apt.pop-os.org/proprietary bionic main" | sudo tee -a /etc/apt/sources.list.d/pop-proprietary.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 204DD8AEC33A7AFF
sudo apt update

## install the driver
sudo apt-get install system76-driver-nvidia

## optional!  install CUDA
sudo apt install system76-cuda-latest

Sources

https://support.system76.com/articles/cuda/

https://support.system76.com/articles/system76-driver/

Install OpenCL

sudo apt install clinfo
sudo apt install ocl-icd-opencl-dev

Install Folding@Home

Go to the folding at home and install all 3 deb packages you find there. https://foldingathome.org/start-folding/

Fix the config file!

For some reason the default config file disables GPU compute and I haven’t found a way to enable through the GUI so we need to fix it manually.

sudo gedit /etc/fahclient/config.xml

find the line that says

  <!-- Folding Slot Configuration -->
  <gpu v='false'/>

and set gpu to true!

Now you need to restart the client:

sudo /etc/init.d/FAHClient stop

sudo /etc/init.d/FAHClient start

Configure and start folding

Open FAHControl. Click configure. Click slots tab. Click add. Select gpu. Click ok then save.

Now you you should see your folding slot on the FAHControl main page. If it looks good click the “fold” button.

How to NTP a Raspberry Pi 4 via GPS and PPS

This also works on Pi 3.

  • Hardware: A GPS with serial connected to the Pi’s serial port, and PPS connected to gpio 18 (physical pin 12 on the GPIO connector)
  • If possible, configure GPS to output GPZDA at 9600 baud. GPSD will find other baud rates, but takes approximately 8 minutes to get to 115200, and 9600 is the first one it tries.

sudo raspi-config, disable serial console login, enable hardware serial port
sudo apt install pps-tools gpsd gpsd-clients python-gps chrony
edit /etc/modules, add:

pps-gpio

edit /boot/firmware/config.txt (or /boot/config.txt), add:

dtoverlay=pps-gpio,gpiopin=18

edit /etc/default/gpsd, set device to “/dev/ttyS0”, options to “-n -b”
sudo systemctl enable gpsd

edit /etc/chrony/chrony.conf, comment out all servers and pools, add:

refclock SHM 0 poll 0 refid GPS precision 1e-1 offset 0.055
refclock PPS /dev/pps0 lock GPS poll 0 refid PPS precision 1e-9

sudo systemctl restart chrony

Monitor using chronyc sources, or chronyc sourcestats