Error folding on GPU [OpenSUSE]

FAH provides a V7 client installer for Debian / Mint / Ubuntu / RedHat / CentOS / Fedora. Installation on other distros may or may not be easy but if you can offer help to others, they would appreciate it.

Moderators: Site Moderators, PandeGroup

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Sun Apr 24, 2016 9:32 pm

If OpenSUSE favors systemd services, you might convert to that and share your work. :)
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 4:05 pm

calxalot wrote:Does OpenSUSE have the start-stop-daemon command?

Does not look like it. It is a utility mostly seen on Debian/Ubuntu. However looks like Fedora does have it.
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 4:20 pm

calxalot wrote:If OpenSUSE favors systemd services, you might convert to that and share your work. :)

That is true, but it can also run init scripts such as /etc/init.d/FAHClient. I believe Fedora also uses systemd now, but I am not so sure about RedHat or CentOS which I believe still uses init. Though the latest SUSE Linux Enterprise 12 has moved to systemd too, so perhaps the latest RedHat/CentOS also have. Edit: It seems RedHat 7 does use systemd.

FAHClient is built with support for RedHat, CentOS and Fedora. Which platform is it built against? Those 3 are not equal to each other. A package built and compiled on Fedora might not necessary work with RedHat and CentOS and vice versa.

Running the same command as the init script manually as the user fahclient works perfectly:
Code: Select all
/usr/bin/FAHClient /etc/fahclient/config.xml  --run-as fahclient --pid-file=/var/run/fahclient.pid --daemon
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 5:44 pm

Looks like someone already has written a systemd service for FAHClient.
https://gist.github.com/lopezpdvn/81397197ffead57c2e98
However all this does is proxy to the init script /etc/init.d/FAHClient. A better solution would be a pure systemd service.
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 6:12 pm

I created the following systemd service
Code: Select all
[Unit]
Description=Folding@Home V7 Client
Documentation=https://folding.stanford.edu/home/the-software/
After=network.target

[Service]
PIDFile=/var/lib/fahclient/fahclient.pid
User=fahclient
Group=users
ExecStart=/etc/init.d/FAHClient start
ExecStop=/etc/init.d/FAHClient stop
ExecReload=/etc/init.d/FAHClient reload
KillMode=process

[Install]
WantedBy=multi-user.target


I changed PidFile location from /var/run to /var/lib/fahclient, because the fahclient user does not have write access to /var/run.
This works great.

Code: Select all
mintaka:/ # systemctl status fahclient.service
fahclient.service - Folding@Home V7 Client
   Loaded: loaded (/etc/systemd/system/fahclient.service; enabled)
   Active: active (running) since ma. 2016-04-25 20:10:38 CEST; 8min ago
     Docs: https://folding.stanford.edu/home/the-software/
 Main PID: 2740 (FAHClient)
   CGroup: /system.slice/fahclient.service
           ├─2740 /usr/bin/FAHClient /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fahclient.pid --daemon
           └─2742 /usr/bin/FAHClient --child --lifeline 2740 /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fa...

mintaka:/ # ps -C FAHClient -o user,group,comm
USER     GROUP    COMMAND
fahclie+ users    FAHClient
fahclie+ users    FAHClient
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Mon Apr 25, 2016 8:06 pm

I think you can ditch the init.d script and simplify.
Something like this might be equivalent:

Code: Select all
[Unit]
Description=Folding@Home V7 Client
Documentation=https://folding.stanford.edu/home/the-software/
After=network.target

[Service]
User=fahclient
Group=users
ExecStart=/usr/bin/FAHClient /etc/fahclient/config.xml
Restart=always
KillMode=process

[Install]
WantedBy=multi-user.target


If there's a chance of a SIGHUP being sent to the client, you can add --service to ExecStart.
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 8:48 pm

I thought the same, but at least run the exact same command that init script does.
Code: Select all
ExecStart=/usr/bin/FAHClient /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fahclient.pid --daemon


I was also thinking about ExecStop that would send finished data before killing the process, but FAHClient --send does not work if there is another instance running.

Is it possible to make a contribution to the FAHClient (GitHub) with such a systemd service file? Perhaps hoping some developer sees this and can incorporate the script in the next version of FAHClient.
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Mon Apr 25, 2016 8:53 pm

I'd say no.
It is preferred that systemd services do not fork (daemonize) and do not use a pid file.
--run-as is not needed because you have User.
The reason the client forks is so that it can keep the working client running. Which is not needed if you let systemd do restarts.
Don't need ExecStop, because the client will not fork, and have KillMode=process.
Last edited by calxalot on Mon Apr 25, 2016 8:59 pm, edited 2 times in total.
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 8:56 pm

Running the following command spawns two instances of FAHClient
Code: Select all
/usr/bin/FAHClient /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fahclient.pid --daemon

Code: Select all
sverrem@mintaka:~> ps -aux | grep FAH
fahclie+  2740  0.0  0.0 21097356 6916 ?       Ssl  20:10   0:02 /usr/bin/FAHClient /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fahclient.pid --daemon
fahclie+  2742  0.1  0.2 21687552 22576 ?      Sl   20:10   0:10 /usr/bin/FAHClient --child --lifeline 2740 /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/lib/fahclient/fahclient.pid --daemon


Running FAHClient without -daemon creates only one instance. I do not know why the second instance is created or what its purpose it.

Also I tried running without pid and the FAHClient didn't terminate. However that was with the init script. Perhaps it will terminate with systemd.
Last edited by DJViking on Mon Apr 25, 2016 9:04 pm, edited 3 times in total.
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Mon Apr 25, 2016 9:01 pm

Only one instance, managed by systemd, is what you want.
Please try what I suggested and let us know how it goes.
If it can't access the GPU, please also try setting the group to video.
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 9:04 pm

If I tried your modified version of the systemd service I am unable to start FAClient.
Code: Select all
mintaka:/etc/systemd/system # systemctl start fahclient.service
mintaka:/etc/systemd/system # systemctl status fahclient.service
fahclient.service - Folding@Home V7 Client
   Loaded: loaded (/etc/systemd/system/fahclient.service; enabled)
   Active: failed (Result: start-limit) since ma. 2016-04-25 23:03:43 CEST; 2s ago
     Docs: https://folding.stanford.edu/home/the-software/
  Process: 12464 ExecStart=/usr/bin/FAHClient /etc/fahclient/config.xml (code=exited, status=1/FAILURE)
 Main PID: 12464 (code=exited, status=1/FAILURE)

april 25 23:03:43 mintaka systemd[1]: fahclient.service start request repeated too quickly, refusing to start.
april 25 23:03:43 mintaka systemd[1]: Failed to start Folding@Home V7 Client.


I removed Restart=always
Code: Select all
mintaka:/etc/systemd/system # systemctl start fahclient.service
mintaka:/etc/systemd/system # systemctl status fahclient.service
fahclient.service - Folding@Home V7 Client
   Loaded: loaded (/etc/systemd/system/fahclient.service; enabled)
   Active: failed (Result: exit-code) since ma. 2016-04-25 23:07:05 CEST; 2s ago
     Docs: https://folding.stanford.edu/home/the-software/
  Process: 12710 ExecStart=/usr/bin/FAHClient /etc/fahclient/config.xml (code=exited, status=1/FAILURE)
 Main PID: 12710 (code=exited, status=1/FAILURE)

april 25 23:07:05 mintaka FAHClient[12710]: 21:07:05:ERROR:Exception: Failed to open 'log.txt': Failed to open 'log.txt': Permission denied: Permission denied
Last edited by DJViking on Mon Apr 25, 2016 9:08 pm, edited 1 time in total.
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Mon Apr 25, 2016 9:08 pm

Hmm, any log messages visible? Either in the client log.txt or the system log?
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 9:10 pm

The latest after I removed restart=always. I suspect that it is trying to store the log.txt where it does not have access. It does not use /var/lib/fahclient/log.txt
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

Re: Error folding on GPU [OpenSUSE]

Postby calxalot » Mon Apr 25, 2016 9:13 pm

Likely just a permissions problem with the fahclient home folder, or log.txt.
It might be that the working directory is not correct.
Try adding

WorkingDirectory=/var/lib/fahclient

to the service.
calxalot
 
Posts: 439
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco

Re: Error folding on GPU [OpenSUSE]

Postby DJViking » Mon Apr 25, 2016 9:15 pm

calxalot wrote:Likely just a permissions problem with the fahclient home folder, or log.txt.
It might be that the working directory is not correct.
Try adding

WorkingDirectory=/var/lib/fahclient

to the service.


That worked, and folding on the GPU works.
Code: Select all
mintaka:/etc/systemd/system # systemctl start fahclient.service
mintaka:/etc/systemd/system # systemctl status fahclient.service
fahclient.service - Folding@Home V7 Client
   Loaded: loaded (/etc/systemd/system/fahclient.service; enabled)
   Active: active (running) since ma. 2016-04-25 23:15:06 CEST; 1s ago
     Docs: https://folding.stanford.edu/home/the-software/
 Main PID: 13279 (FAHClient)
   CGroup: /system.slice/fahclient.service
           └─13279 /usr/bin/FAHClient /etc/fahclient/config.xml

april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 1 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Successfully acquired database lock
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Enabled folding slot 00: PAUSED gpu:0:GK106 [GeForce GTX 650 Ti] (by user)
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Enabled folding slot 01: PAUSED cpu:1 (by user)
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 8 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 5 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 6 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 10 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 9 on PID 13279
april 25 23:15:06 mintaka FAHClient[13279]: 21:15:06:Started thread 7 on PID 13279
DJViking
 
Posts: 41
Joined: Tue Apr 19, 2016 1:39 pm

PreviousNext

Return to Q&A about unsupported distros of Linux

Who is online

Users browsing this forum: No registered users and 1 guest

cron