Skip to content

Instantly share code, notes, and snippets.

@lopezpdvn
Last active January 14, 2023 07:21
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lopezpdvn/81397197ffead57c2e98 to your computer and use it in GitHub Desktop.
Save lopezpdvn/81397197ffead57c2e98 to your computer and use it in GitHub Desktop.
Install Folding@home FAHClient on Linux as a systemd service unit

Install Folding@home FAHClient on Linux as a systemd service unit

Republished on my website, keeping this version here for historical reasons.

Install FAHClient as documented in the official guide. Stop the traditional init script service that was created and automatically started.

$ sudo /etc/init.d/FAHClient stop

Move the init script to another location. Path /usr/local/bin can be changed, but be sure to use the correct path in the service unit file of the next step.

$ sudo mv /etc/init.d/FAHClient /usr/local/bin

Copy the contents of the gist Systemd service unit for Folding@Home Client into (a new) file /etc/systemd/system/fahclient.service. File contents included here:

[Unit]
Description=Folding@Home V7 Client
Documentation=https://folding.stanford.edu/home/the-software/

[Service]
Type=simple
PIDFile=/var/run/fahclient.pid
ExecStart=/usr/local/bin/FAHClient -v start
ExecReload=/usr/local/bin/FAHClient -v restart
ExecStop=/usr/local/bin/FAHClient -v stop
KillMode=process

[Install]
WantedBy=multi-user.target

Then update its ownership and permissions as below

$ sudo chown root:root /etc/systemd/system/fahclient.service
$ sudo chmod u=rw,go=r /etc/systemd/system/fahclient.service

The systemd service unit for FAHClient is installed. Reload systemd manager configuration

$ sudo systemctl daemon-reload

Query the status of service unit.

$ sudo systemctl status --full fahclient.service

Start and stop as a regular systemd service

$ sudo systemctl stop fahclient.service
$ sudo systemctl start fahclient.service

Folding@home is a distributed computing project for disease research that simulates protein folding, computational drug design, and other types of molecular dynamics. See also the Volunteer Computing page.

@vasti
Copy link

vasti commented Aug 4, 2020

I have adopted the unit file as suggested while upgrading to the latest fahclient. Following were required to make it work on Debian 10 with NVIDIA drivers & kernel installed from backports:

MemoryDenyWriteExecute=yes somehow prevents f@h from running on GeForce 20 GPU. f@h would just stop immediately after trying to start on GPU. There were little to nothing in the logs what the actual issue was. GPU and CUDA/OpenCL devices were detected normally by the fahclient.

libOpenCL.so was not getting loaded with a unit file like this until i created a config file under /etc/ld.so.conf.d as described here. The fahclient user is in video group and clinfo reports everything as expected if executed as said user even before the ld.so.conf.d config file was added.

@lopezpdvn
Copy link
Author

Thanks for sharing, folks!

@benjamindoron
Copy link

Adding this here because it helped me:
The Folding@Home client seems unable to handle cases where multiple OpenCL providers are returned. Often, the additional providers can be uninstalled, but instead, adding Environment="OCL_ICD_VENDORS=nvidia.icd" under the service section also works and may be preferable. This way, only the desired provider is returned to Folding@Home (this can be tested on the commandline: OCL_ICD_VENDORS=nvidia.icd clinfo).

Replace nvidia.icd with your desired provider. See /etc/OpenCL/vendors/ for the available list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment