How do I run GPU folding using primusrun?

Moderators: Site Moderators, FAHC Science Team

How do I run GPU folding using primusrun?

Postby minecraft2048 » Wed May 30, 2018 11:49 am

I'm running FAH at my MSi laptop using Linux, and because I'm on laptop I have Nvidia Optimus setup that is managed by bumblebee+bbswitch. When FAH want to run its GPU folding system, it fails because my Nvidia GPU is not turned on yet. For other things, such as games from Steam, I can set the programs to run
Code: Select all
primusrun app
to set the programs to use Nvidia GPU instead of Intel GPU. How can I set my FAH client to append primusrun to its run command, so that I wouldn't need to manually start the dedicated GPU every time I want to do GPU folding?
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby bruce » Wed May 30, 2018 5:16 pm

If the drivers have been installed from, starting FAHClient.exe as a service (e.g.- with /etc/init.d/FAHClient start should configure both GPUs. FAH will see both GPUs, but will configure itself to use the nVidia and will ignore the Intel.

Post the head 100 lines of FAH's log per the instructions below.
Posts: 20009
Joined: Thu Nov 29, 2007 11:13 pm
Location: So. Cal.

Re: How do I run GPU folding using primusrun?

Postby minecraft2048 » Thu May 31, 2018 12:16 am

Code: Select all
22:59:07:WU00:FS01:Connecting to
22:59:08:WU00:FS01:Assigned to work server
22:59:08:WU00:FS01:Requesting new work unit for slot 01: READY gpu:0:GM107 [GeForce GTX 960M] from
22:59:08:WU00:FS01:Connecting to
22:59:09:WU00:FS01:Downloading 16.53MiB
22:59:15:WU00:FS01:Download 8.32%
22:59:21:WU00:FS01:Download 21.17%
22:59:27:WU00:FS01:Download 33.65%
22:59:33:WU00:FS01:Download 51.41%
22:59:39:WU00:FS01:Download 57.09%
22:59:45:WU00:FS01:Download 62.76%
22:59:51:WU00:FS01:Download 68.81%
22:59:57:WU00:FS01:Download 74.10%
23:00:03:WU00:FS01:Download 91.87%
23:00:05:WU00:FS01:Download complete
23:00:05:WU00:FS01:Received Unit: id:00 state:DOWNLOAD error:NO_ERROR project:11713 run:0 clone:361 gen:79 core:0x21 unit:0x000000678ca304e75adf71c7f6b72620
23:00:05:WU00:FS01:Running FahCore: /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 00 -suffix 01 -version 704 -lifeline 496 -checkpoint 3 -gpu 0 -gpu-vendor nvidia
23:00:05:WU00:FS01:Started FahCore on PID 11521
23:00:05:WU00:FS01:Core PID:11525
23:00:05:WU00:FS01:FahCore 0x21 started
23:00:06:WU00:FS01:0x21:*********************** Log Started 2018-05-30T23:00:05Z ***********************
23:00:06:WU00:FS01:0x21:Project: 11713 (Run 0, Clone 361, Gen 79)
23:00:06:WU00:FS01:0x21:Unit: 0x000000678ca304e75adf71c7f6b72620
23:00:06:WU00:FS01:0x21:CPU: 0x00000000000000000000000000000000
23:00:06:WU00:FS01:0x21:Machine: 1
23:00:06:WU00:FS01:0x21:Reading tar file core.xml
23:00:06:WU00:FS01:0x21:Reading tar file integrator.xml
23:00:06:WU00:FS01:0x21:Reading tar file state.xml
23:00:06:WU00:FS01:0x21:Reading tar file system.xml
23:00:06:WU00:FS01:0x21:Digital signatures verified
23:00:06:WU00:FS01:0x21:Folding@home GPU Core21 Folding@home Core
23:00:06:WU00:FS01:0x21:Version 0.0.18
23:00:07:Removing old file 'configs/config-20180528-114011.xml'
23:00:07:Saving configuration to /opt/fah/config.xml
23:00:07:  <!-- Folding Core -->
23:00:07:  <checkpoint v='3'/>
23:00:07:  <!-- Network -->
23:00:07:  <proxy v=':8080'/>
23:00:07:  <!-- Slot Control -->
23:00:07:  <power v='medium'/>
23:00:07:  <!-- User Information -->
23:00:07:  <passkey v='********************************'/>
23:00:07:  <team v='45032'/>
23:00:07:  <user v='CurufinweFeanaro'/>
23:00:07:  <!-- Folding Slots -->
23:00:07:  <slot id='0' type='CPU'>
23:00:07:    <paused v='true'/>
23:00:07:  </slot>
23:00:07:  <slot id='1' type='GPU'/>
23:00:07:WU00:FS01:0x21:ERROR:126: Bad platformId size.
23:00:07:WU00:FS01:0x21:Saving result file logfile_01.txt
23:00:07:WU00:FS01:0x21:Saving result file log.txt
23:00:07:WU00:FS01:0x21:Folding@home Core Shutdown: BAD_WORK_UNIT
23:00:08:WARNING:WU00:FS01:FahCore returned: BAD_WORK_UNIT (114 = 0x72)
23:00:08:WU00:FS01:Sending unit results: id:00 state:SEND error:FAULTY project:11713 run:0 clone:361 gen:79 core:0x21 unit:0x000000678ca304e75adf71c7f6b72620
23:00:08:WU00:FS01:Uploading 6.00KiB to
23:00:08:WU00:FS01:Connecting to
23:00:09:WU02:FS01:Connecting to
23:00:09:WU00:FS01:Upload complete
23:00:10:WU00:FS01:Server responded WORK_ACK (400)
23:00:10:WU00:FS01:Cleaning up
23:00:11:WU02:FS01:Assigned to work server
23:00:11:WU02:FS01:Requesting new work unit for slot 01: READY gpu:0:GM107 [GeForce GTX 960M] from
23:00:11:WU02:FS01:Connecting to
23:00:13:WU02:FS01:Downloading 16.53MiB
23:00:19:WU02:FS01:Download 5.67%
23:00:25:WU02:FS01:Download 10.97%
23:00:31:WU02:FS01:Download 17.02%
23:00:37:WU02:FS01:Download 23.45%
23:00:43:WU02:FS01:Download 29.50%
23:00:49:WU02:FS01:Download 39.71%
23:00:55:WU02:FS01:Download 52.95%
23:01:01:WU02:FS01:Download 66.56%
23:01:07:WU02:FS01:Download 99.09%
23:01:07:WU02:FS01:Download complete
23:01:07:WU02:FS01:Received Unit: id:02 state:DOWNLOAD error:NO_ERROR project:11713 run:27 clone:61 gen:72 core:0x21 unit:0x0000005f8ca304e75ae6351c7aabaa37
23:01:07:WU02:FS01:Running FahCore: /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 02 -suffix 01 -version 704 -lifeline 496 -checkpoint 3 -gpu 0 -gpu-vendor nvidia
23:01:07:WU02:FS01:Started FahCore on PID 11967
23:01:07:WU02:FS01:Core PID:11971
23:01:07:WU02:FS01:FahCore 0x21 started
23:01:07:WARNING:WU02:FS01:FahCore returned: BAD_WORK_UNIT (114 = 0x72)
23:01:08:WU02:FS01:Sending unit results: id:02 state:SEND error:FAULTY project:11713 run:27 clone:61 gen:72 core:0x21 unit:0x0000005f8ca304e75ae6351c7aabaa37
23:01:08:WU02:FS01:Uploading 6.00KiB to
23:01:08:WU02:FS01:Connecting to
23:01:09:WU00:FS01:Connecting to
23:01:09:WU02:FS01:Upload complete
23:01:10:WU02:FS01:Server responded WORK_ACK (400)
23:01:10:WU02:FS01:Cleaning up
23:01:11:WU00:FS01:Assigned to work server
23:01:11:WU00:FS01:Requesting new work unit for slot 01: READY gpu:0:GM107 [GeForce GTX 960M] from
23:01:11:WU00:FS01:Connecting to
23:01:13:WU00:FS01:Downloading 16.51MiB
23:01:19:WU00:FS01:Download 6.06%
23:01:25:WU00:FS01:Download 11.36%
23:01:31:WU00:FS01:Download 18.55%
23:01:37:WU00:FS01:Download 26.12%
23:01:43:WU00:FS01:Download 32.55%
23:01:49:WU00:FS01:Download 38.61%
23:01:55:WU00:FS01:Download 45.04%
23:02:01:WU00:FS01:Download 51.10%
23:02:07:WU00:FS01:Download 57.53%
23:02:13:WU00:FS01:Download 61.70%
23:02:20:WU00:FS01:Download 63.97%
23:02:27:WU00:FS01:Download 64.73%
23:02:37:WU00:FS01:Download 66.24%
23:02:44:WU00:FS01:Download 66.62%
23:02:51:WU00:FS01:Download 67.75%
23:03:00:WU00:FS01:Download 68.89%
23:03:06:WU00:FS01:Download 70.40%
23:03:13:WU00:FS01:Download 71.54%
23:03:19:WU00:FS01:Download 71.92%
23:03:28:WU00:FS01:Download 73.05%
23:03:37:WU00:FS01:Download 74.57%
23:03:44:WU00:FS01:Download 75.33%
23:03:50:WU00:FS01:Download 75.70%
23:03:59:WU00:FS01:Download 76.46%
23:04:06:WU00:FS01:Download 77.22%
23:04:18:WU00:FS01:Download 78.73%
23:04:29:WU00:FS01:Download 79.11%
23:04:38:WU00:FS01:Download 79.49%
23:04:45:WU00:FS01:Download 79.87%
23:04:55:WU00:FS01:Download 80.62%
23:05:01:WU00:FS01:Download 81.76%
23:05:08:WU00:FS01:Download 82.52%
23:05:14:WU00:FS01:Download 83.65%
23:05:20:WU00:FS01:Download 84.79%
23:05:32:WU00:FS01:Download 85.17%
23:05:43:WU00:FS01:Download 86.30%
23:05:49:WU00:FS01:Download 87.06%
23:05:55:WU00:FS01:Download 87.82%
23:06:03:WU00:FS01:Download 88.57%
23:06:09:WU00:FS01:Download 89.71%
23:06:16:WU00:FS01:Download 92.36%
23:06:23:WU00:FS01:Download 93.87%
23:06:31:WU00:FS01:Download 94.63%
23:06:37:WU00:FS01:Download 97.66%
23:06:40:WU00:FS01:Download complete
23:06:40:WU00:FS01:Received Unit: id:00 state:DOWNLOAD error:NO_ERROR project:11713 run:12 clone:120 gen:156 core:0x21 unit:0x000000bc8ca304e75a5ce264fe2ca69b
23:06:41:WU00:FS01:Running FahCore: /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 00 -suffix 01 -version 704 -lifeline 496 -checkpoint 3 -gpu 0 -gpu-vendor nvidia
23:06:41:WU00:FS01:Started FahCore on PID 14077
23:06:41:WU00:FS01:Core PID:14081
23:06:41:WU00:FS01:FahCore 0x21 started
23:06:42:WU00:FS01:0x21:*********************** Log Started 2018-05-30T23:06:41Z ***********************
23:06:42:WU00:FS01:0x21:Project: 11713 (Run 12, Clone 120, Gen 156)
23:06:42:WU00:FS01:0x21:Unit: 0x000000bc8ca304e75a5ce264fe2ca69b
23:06:42:WU00:FS01:0x21:CPU: 0x00000000000000000000000000000000
23:06:42:WU00:FS01:0x21:Machine: 1
23:06:42:WU00:FS01:0x21:Reading tar file core.xml
23:06:42:WU00:FS01:0x21:Reading tar file integrator.xml
23:06:42:WU00:FS01:0x21:Reading tar file state.xml
23:06:42:WU00:FS01:0x21:Reading tar file system.xml
23:06:42:WU00:FS01:0x21:Digital signatures verified
23:06:42:WU00:FS01:0x21:Folding@home GPU Core21 Folding@home Core
23:06:42:WU00:FS01:0x21:Version 0.0.18
23:06:42:WU00:FS01:0x21:ERROR:126: Bad platformId size.
23:06:42:WU00:FS01:0x21:Saving result file logfile_01.txt
23:06:42:WU00:FS01:0x21:Saving result file log.txt
23:06:42:WU00:FS01:0x21:Folding@home Core Shutdown: BAD_WORK_UNIT
23:06:42:WARNING:WU00:FS01:FahCore returned: BAD_WORK_UNIT (114 = 0x72)
23:06:43:WU00:FS01:Sending unit results: id:00 state:SEND error:FAULTY project:11713 run:12 clone:120 gen:156 core:0x21 unit:0x000000bc8ca304e75a5ce264fe2ca69b
23:06:44:WU00:FS01:Uploading 6.00KiB to
23:06:44:WU00:FS01:Connecting to
23:06:44:WU02:FS01:Connecting to
23:06:45:WU00:FS01:Upload complete
23:06:45:WU00:FS01:Server responded WORK_ACK (400)
23:06:46:WU00:FS01:Cleaning up
23:06:47:WU02:FS01:Assigned to work server
23:06:47:WU02:FS01:Requesting new work unit for slot 01: READY gpu:0:GM107 [GeForce GTX 960M] from
23:06:47:WU02:FS01:Connecting to
23:06:49:WU02:FS01:Downloading 16.52MiB
23:07:02:WU02:FS01:Download 3.78%
23:07:08:WU02:FS01:Download 5.30%
23:07:30:WU02:FS01:Download 14.00%
23:07:36:WU02:FS01:Download 40.10%
23:07:42:WU02:FS01:Download 45.02%
23:07:50:WU02:FS01:Download 49.18%
23:07:58:WU02:FS01:Download 58.26%
23:08:05:WU02:FS01:Download 67.34%
23:08:11:WU02:FS01:Download 85.50%
23:08:17:WU02:FS01:Download 91.56%
23:08:23:WU02:FS01:Download 99.88%
23:08:28:WU02:FS01:Download complete
23:08:28:WU02:FS01:Received Unit: id:02 state:DOWNLOAD error:NO_ERROR project:11713 run:15 clone:434 gen:80 core:0x21 unit:0x000000668ca304e75adf796188907141
23:08:29:WU02:FS01:Running FahCore: /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 02 -suffix 01 -version 704 -lifeline 496 -checkpoint 3 -gpu 0 -gpu-vendor nvidia
23:08:29:WU02:FS01:Started FahCore on PID 14808
23:08:29:WU02:FS01:Core PID:14812
23:08:29:WU02:FS01:FahCore 0x21 started
23:08:31:WU02:FS01:0x21:*********************** Log Started 2018-05-30T23:08:30Z ***********************
23:08:31:WU02:FS01:0x21:Project: 11713 (Run 15, Clone 434, Gen 80)
23:08:31:WU02:FS01:0x21:Unit: 0x000000668ca304e75adf796188907141
23:08:31:WU02:FS01:0x21:CPU: 0x00000000000000000000000000000000
23:08:31:WU02:FS01:0x21:Machine: 1
23:08:31:WU02:FS01:0x21:Reading tar file core.xml
23:08:31:WU02:FS01:0x21:Reading tar file integrator.xml
23:08:31:WU02:FS01:0x21:Reading tar file state.xml
23:08:31:WU02:FS01:0x21:Reading tar file system.xml
23:08:31:WU02:FS01:0x21:Digital signatures verified
23:08:31:WU02:FS01:0x21:Folding@home GPU Core21 Folding@home Core
23:08:31:WU02:FS01:0x21:Version 0.0.18
23:08:46:WU02:FS01:0x21:Completed 0 out of 7500000 steps (0%)
23:08:46:WU02:FS01:0x21:Temperature control disabled. Requirements: single Nvidia GPU, tmax must be < 110 and twait >= 900
23:09:09:FS01:Shutting core down
23:09:09:WU02:FS01:0x21:Caught signal SIGINT(2) on PID 14812
23:09:09:WU02:FS01:0x21:Exiting, please wait. . .
23:09:09:WU02:FS01:0x21:Folding@home Core Shutdown: INTERRUPTED
23:09:09:WU02:FS01:FahCore returned: INTERRUPTED (102 = 0x66)
23:09:16:Removing old file 'configs/config-20180528-115122.xml'
23:09:16:Saving configuration to /opt/fah/config.xml
23:09:16:  <!-- Folding Core -->
23:09:16:  <checkpoint v='3'/>
23:09:16:  <!-- Network -->
23:09:16:  <proxy v=':8080'/>
23:09:16:  <!-- Slot Control -->
23:09:16:  <power v='medium'/>
23:09:16:  <!-- User Information -->
23:09:16:  <passkey v='********************************'/>
23:09:16:  <team v='45032'/>
23:09:16:  <user v='CurufinweFeanaro'/>
23:09:16:  <!-- Folding Slots -->
23:09:16:  <slot id='0' type='CPU'>
23:09:16:    <paused v='true'/>
23:09:16:  </slot>
23:09:16:  <slot id='1' type='GPU'>
23:09:16:    <paused v='true'/>
23:09:16:  </slot>

Look at time 23:06:42:WU00:FS01:0x21:ERROR:126: Bad platformId size. That is what happens when FAH tries to fold on Nvidia GPU but it is not on yet, then it complains about BAD_WORK_UNIT and downloads another work unit. Compare it to 23:08:31:WU02:FS01:0x21:Folding@home GPU Core21 Folding@home Core, when FAH successfully folds on GPU as I have manually turned on the GPU by using primusrun glxgears on other terminal. If I stopped glxgears, the Nvidia GPU will disable itself and when FAH tries to fold on Nvidia, it crashes again
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby bruce » Thu May 31, 2018 6:38 am

Where is the first page showing which version of CUDA and OpenCL are installed? We need the first ~100 lines of the log file?

Bad platformId size is also the error when the NVidia OpenCL drivers are not installed or when the wrong index value has been assigned.
Two parts of the log are really important:
A) The first ~100 lines of the log, showing essential information about your system, including any settings that are in your Config file
B) Portions of the log showing any error messages that may be present, especially the first one.
Posts: 20009
Joined: Thu Nov 29, 2007 11:13 pm
Location: So. Cal.

Re: How do I run GPU folding using primusrun?

Postby minecraft2048 » Thu May 31, 2018 9:01 am

Code: Select all
*********************** Log Started 2018-05-31T07:57:02Z ***********************
07:57:02:************************* Folding@home Client *************************
07:57:02:    Website:
07:57:02:  Copyright: (c) 2009-2014 Stanford University
07:57:02:     Author: Joseph Coffland <>
07:57:02:       Args: --config /opt/fah/config.xml --exec-directory=/opt/fah
07:57:02:             --data-directory=/opt/fah
07:57:02:     Config: /opt/fah/config.xml
07:57:02:******************************** Build ********************************
07:57:02:    Version: 7.4.4
07:57:02:       Date: Mar 4 2014
07:57:02:       Time: 12:02:38
07:57:02:    SVN Rev: 4130
07:57:02:     Branch: fah/trunk/client
07:57:02:   Compiler: GNU 4.4.7
07:57:02:    Options: -std=gnu++98 -O3 -funroll-loops -mfpmath=sse -ffast-math
07:57:02:             -fno-unsafe-math-optimizations -msse2
07:57:02:   Platform: linux2 3.2.0-1-amd64
07:57:02:       Bits: 64
07:57:02:       Mode: Release
07:57:02:******************************* System ********************************
07:57:02:        CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
07:57:02:     CPU ID: GenuineIntel Family 6 Model 94 Stepping 3
07:57:02:       CPUs: 8
07:57:02:     Memory: 15.58GiB
07:57:02:Free Memory: 720.28MiB
07:57:02:    Threads: POSIX_THREADS
07:57:02: OS Version: 4.16
07:57:02:Has Battery: true
07:57:02: On Battery: false
07:57:02: UTC Offset: 10
07:57:02:        PID: 7837
07:57:02:        CWD: /opt/fah
07:57:02:         OS: Linux 4.16.11-1-ARCH x86_64
07:57:02:    OS Arch: AMD64
07:57:02:       GPUs: 1
07:57:02:      GPU 0: NVIDIA:4 GM107 [GeForce GTX 960M]
07:57:02:       CUDA: Not detected
07:57:02:  <!-- Folding Core -->
07:57:02:  <checkpoint v='3'/>
07:57:02:  <!-- Network -->
07:57:02:  <proxy v=':8080'/>
07:57:02:  <!-- Slot Control -->
07:57:02:  <power v='medium'/>
07:57:02:  <!-- User Information -->
07:57:02:  <passkey v='********************************'/>
07:57:02:  <team v='45032'/>
07:57:02:  <user v='CurufinweFeanaro'/>
07:57:02:  <!-- Folding Slots -->
07:57:02:  <slot id='0' type='CPU'>
07:57:02:    <paused v='true'/>
07:57:02:  </slot>
07:57:02:  <slot id='1' type='GPU'>
07:57:02:    <paused v='true'/>
07:57:02:  </slot>
07:57:02:Trying to access database...
07:57:02:Successfully acquired database lock
07:57:02:Enabled folding slot 00: PAUSED cpu:6 (by user)
07:57:02:Enabled folding slot 01: PAUSED gpu:0:GM107 [GeForce GTX 960M] (by user)

CUDA is not detected because the driver haven't been loaded yet, so in some way, it is not installed yet. But, if I run another program that uses primusrun and restart the service:
Code: Select all
*********************** Log Started 2018-05-31T07:59:00Z ***********************
07:59:00:************************* Folding@home Client *************************
07:59:00:    Website:
07:59:00:  Copyright: (c) 2009-2014 Stanford University
07:59:00:     Author: Joseph Coffland <>
07:59:00:       Args: --config /opt/fah/config.xml --exec-directory=/opt/fah
07:59:00:             --data-directory=/opt/fah
07:59:00:     Config: /opt/fah/config.xml
07:59:00:******************************** Build ********************************
07:59:00:    Version: 7.4.4
07:59:00:       Date: Mar 4 2014
07:59:00:       Time: 12:02:38
07:59:00:    SVN Rev: 4130
07:59:00:     Branch: fah/trunk/client
07:59:00:   Compiler: GNU 4.4.7
07:59:00:    Options: -std=gnu++98 -O3 -funroll-loops -mfpmath=sse -ffast-math
07:59:00:             -fno-unsafe-math-optimizations -msse2
07:59:00:   Platform: linux2 3.2.0-1-amd64
07:59:00:       Bits: 64
07:59:00:       Mode: Release
07:59:00:******************************* System ********************************
07:59:00:        CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
07:59:00:     CPU ID: GenuineIntel Family 6 Model 94 Stepping 3
07:59:00:       CPUs: 8
07:59:00:     Memory: 15.58GiB
07:59:00:Free Memory: 626.69MiB
07:59:00:    Threads: POSIX_THREADS
07:59:00: OS Version: 4.16
07:59:00:Has Battery: true
07:59:00: On Battery: false
07:59:00: UTC Offset: 10
07:59:00:        PID: 8558
07:59:00:        CWD: /opt/fah
07:59:00:         OS: Linux 4.16.11-1-ARCH x86_64
07:59:00:    OS Arch: AMD64
07:59:00:       GPUs: 1
07:59:00:      GPU 0: NVIDIA:4 GM107 [GeForce GTX 960M]
07:59:00:       CUDA: 5.0
07:59:00:CUDA Driver: 9020
07:59:00:  <!-- Folding Core -->
07:59:00:  <checkpoint v='3'/>
07:59:00:  <!-- Network -->
07:59:00:  <proxy v=':8080'/>
07:59:00:  <!-- Slot Control -->
07:59:00:  <power v='medium'/>
07:59:00:  <!-- User Information -->
07:59:00:  <passkey v='********************************'/>
07:59:00:  <team v='45032'/>
07:59:00:  <user v='CurufinweFeanaro'/>
07:59:00:  <!-- Folding Slots -->
07:59:00:  <slot id='0' type='CPU'>
07:59:00:    <paused v='true'/>
07:59:00:  </slot>
07:59:00:  <slot id='1' type='GPU'>
07:59:00:    <paused v='true'/>
07:59:00:  </slot>
07:59:00:Trying to access database...
07:59:00:Successfully acquired database lock
07:59:00:Enabled folding slot 00: PAUSED cpu:6 (by user)
07:59:00:Enabled folding slot 01: PAUSED gpu:0:GM107 [GeForce GTX 960M] (by user)

It works like it is supposed to.
Until here I understand that my problem is that FAH tries to fold on GPU while it is not activated yet. The thing is that on Windows the Nvidia driver knows when to turns itself on, while on Linux we need to manually turn the dedicated Nvidia GPU first before using it
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby foldy » Thu May 31, 2018 10:50 am

Can you run it in a shell with "primusrun FAHClient"?
Posts: 2014
Joined: Sat Dec 01, 2012 4:43 pm

Re: How do I run GPU folding using primusrun?

Postby minecraft2048 » Thu May 31, 2018 11:11 am

Well, this is unexpected, I just found out that primusrun hates non-graphical programs, as in it refuses to turn on the dedicated Nvidia GPU. optirun is more tolerant:
Code: Select all
 feanor  silmaril  opt  fah  $  sudo optirun ./FAHClient
10:15:55:INFO(1):Read GPUs.txt
10:15:55:Removing old file 'logs/log-20170303-111304.txt'
10:15:55:************************* Folding@home Client *************************
10:15:55:    Website:
10:15:55:  Copyright: (c) 2009-2014 Stanford University
10:15:55:     Author: Joseph Coffland <>
10:15:55:       Args:
10:15:55:     Config: /opt/fah/config.xml
10:15:55:******************************** Build ********************************
10:15:55:    Version: 7.4.4
10:15:55:       Date: Mar 4 2014
10:15:55:       Time: 12:02:38
10:15:55:    SVN Rev: 4130
10:15:55:     Branch: fah/trunk/client
10:15:55:   Compiler: GNU 4.4.7
10:15:55:    Options: -std=gnu++98 -O3 -funroll-loops -mfpmath=sse -ffast-math
10:15:55:             -fno-unsafe-math-optimizations -msse2
10:15:55:   Platform: linux2 3.2.0-1-amd64
10:15:55:       Bits: 64
10:15:55:       Mode: Release
10:15:55:******************************* System ********************************
10:15:55:        CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
10:15:55:     CPU ID: GenuineIntel Family 6 Model 94 Stepping 3
10:15:55:       CPUs: 8
10:15:55:     Memory: 15.58GiB
10:15:55:Free Memory: 1.33GiB
10:15:55:    Threads: POSIX_THREADS
10:15:55: OS Version: 4.16
10:15:55:Has Battery: true
10:15:55: On Battery: false
10:15:55: UTC Offset: 10
10:15:55:        PID: 28260
10:15:55:        CWD: /opt/fah
10:15:55:         OS: Linux 4.16.11-1-ARCH x86_64
10:15:55:    OS Arch: AMD64
10:15:55:       GPUs: 1
10:15:55:      GPU 0: NVIDIA:4 GM107 [GeForce GTX 960M]
10:15:55:       CUDA: 5.0
10:15:55:CUDA Driver: 9020
10:15:55:  <!-- Folding Core -->
10:15:55:  <checkpoint v='3'/>
10:15:55:  <!-- Network -->
10:15:55:  <proxy v=':8080'/>
10:15:55:  <!-- Slot Control -->
10:15:55:  <power v='medium'/>
10:15:55:  <!-- User Information -->
10:15:55:  <passkey v='********************************'/>
10:15:55:  <team v='45032'/>
10:15:55:  <user v='CurufinweFeanaro'/>
10:15:55:  <!-- Folding Slots -->
10:15:55:  <slot id='0' type='CPU'>
10:15:55:    <paused v='true'/>
10:15:55:  </slot>
10:15:55:  <slot id='1' type='GPU'/>
10:15:55:Trying to access database...
10:15:55:Successfully acquired database lock
10:15:55:Enabled folding slot 00: PAUSED cpu:6 (by user)
10:15:55:Enabled folding slot 01: READY gpu:0:GM107 [GeForce GTX 960M]
10:15:56:WU00:FS01:Connecting to
10:15:57:WU00:FS01:Assigned to work server
10:15:57:WU00:FS01:Requesting new work unit for slot 01: READY gpu:0:GM107 [GeForce GTX 960M] from
10:15:57:WU00:FS01:Connecting to
10:15:58:WU00:FS01:Downloading 16.52MiB
10:16:04:WU00:FS01:Download 2.27%
10:16:10:WU00:FS01:Download 5.30%
10:16:16:WU00:FS01:Download 9.46%
10:16:22:WU00:FS01:Download 17.03%

But that means that if I want to keep FAHClient running at the background but without folding, so I can control it through telnet interface, if I use optirun ./FAHClient, that keeps the dedicated GPU running even if its not used, which drains my battery. I think it will be nicer if I can just use optirun on the GPU folding side, so I can fold with CPU when my laptop is being charged but not full, and when it is full, my laptop can fold with CPU+GPU
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby bruce » Thu May 31, 2018 4:49 pm

FAHClient invokes FAHCore_21 which uses the GPU shaders. In other words, FAH can only fold if your NVidia GPU is active. In other words, FAH is going to drain your battery.

Several methods have been tried to manage battery power, but none of them are really satisfactory except if you connect your battery powered device to the Mains when you want to fold. FAHControl has an option <pause-on-battery v='true'> which can be set to 'false' but that just makes it your responsibility not to run your battery down. (It works great if my laptop is plugged in in one room and I need to move it to another room and plug it in again.)

(The design of the Android client REQUIRES (A) the battery to be fully charged AND (B) to be charging.)

[Battery power is a totally independent issue from with whether you have the NVidia OpenCL drivers properly installed on your system.]
Posts: 20009
Joined: Thu Nov 29, 2007 11:13 pm
Location: So. Cal.

Re: How do I run GPU folding using primusrun?

Postby minecraft2048 » Fri Jun 01, 2018 2:37 am

bruce wrote:(The design of the Android client REQUIRES (A) the battery to be fully charged AND (B) to be charging.)

This is exactly what I'm trying to achieve for my laptop, here is my scenarios:

- If laptop is disconnected from charger, stop folding for both CPU+GPU
- If laptop is connected to charger but battery is below 90%, fold with CPU only and do not turn on the GPU
- If laptop is connected to charger and battery is above 90%, turn on the GPU and fold with both GPU and CPU

For some reason setting pause-on-battery doesn't do anything for my laptop as it somehow don't know that it is running on battery, so I write a small python script that does that algorithm above and it is successful for CPU folding. The solution that I'm thinking right now is to modify the FAHClient a bit so that instead of running FAHCore_21 directly, it runs optirun FAHCore_21 so that the GPU is active iff my script command FAHClient to fold with GPU.

While trying to solve this problem, when I try to run FAHClient with optirun, I found out that it is not suspend tolerant. If I suspend my laptop while it is running, when I wake it up, FAHClient starts before optirun can start up the GPU, and that results in that bad platformid size error, which throws away all progress with that work unit
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby Yavanius » Fri Jun 01, 2018 3:31 am

Maybe you could have FAH change to run on idle with your script and then on resume, set a timer and after that expires set FAH back to it's normal running?
User avatar
Posts: 121
Joined: Thu Nov 03, 2016 5:55 am
Location: 92408

Re: How do I run GPU folding using primusrun?

Postby bruce » Fri Jun 01, 2018 4:31 am

Your script could send a telnet message to FAHClient and have it PAUSE the GPU slot. GIve it time to settle, and then take the other steps you suggest. When your script decides it's time to resume, it will restart FAHClient but the GPU slot will not start until you decide it's ready to go and tells it to UNPAUSE. Doing this will restart the WU from the previous checkpoint, so there will be some loss of progress.

A windows suspend/resume checkpoints everything that's in main RAM, so a WU running on the CPU can resume. It does NOT checkpoint anything that's in GPU VRAM. (it expect that it can initiate a screen refresh from every active task.) Expecting FAH to be able to resume GPU work without some loss of progress is going to be problematic unless FAH writes a checkpoint to disk or power is maintained to the GPU.

The OS should know whether it's running on battery or not. (That's where FAHClient gets it's information.) You'll need to detect that yourself, too and simply bypass everything FAHClient is doing to manage battery power.
Posts: 20009
Joined: Thu Nov 29, 2007 11:13 pm
Location: So. Cal.

Re: How do I run GPU folding using primusrun?

Postby minecraft2048 » Fri Jun 01, 2018 5:53 am

The only question remaining is how do I set FAHClient to run FAHCore_21 with optirun? Any attempt of me to fool FAHClient into running a bash script that passes all of its arguments to either FAHCoreWrapper or FAHCore_21 but with optirun prepended to it results in UNKNOWN_ENUM errors. For example I want this:
Code: Select all
04:44:33:WU00:FS01:Running FahCore: /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 00 -suffix 01 -version 704 -lifeline 22683 -checkpoint 3 -gpu 0 -gpu-vendor nvidia

to change into this:
Code: Select all
04:44:33:WU00:FS01:Running FahCore: optirun /opt/fah/FAHCoreWrapper /opt/fah/cores/ -dir 00 -suffix 01 -version 704 -lifeline 22683 -checkpoint 3 -gpu 0 -gpu-vendor nvidia

If this is not possible then I think I need to toggle the GPU manually from my script, or I run FAHClient as normal user and do process supervision from there, so that I can either run normal FAHClient or optirun FAHClient
Posts: 6
Joined: Wed May 30, 2018 11:39 am

Re: How do I run GPU folding using primusrun?

Postby bruce » Fri Jun 01, 2018 6:25 am

Run two copies of FAHClient. Each one will point to it's own working files. FAHClient can be started "normallly" pointing to working files that define only a CPU slot. Independently, optirun FAHClient pointing only to a GPU slot. Toggle the slot with a telnet command. What you're trying to do is equivalent to trying to start a fake/corrupt version of FAHCore_22 and the EULA interprets that as being equivalent to trying to produce corrupt science -- even though that's not your intent.
Posts: 20009
Joined: Thu Nov 29, 2007 11:13 pm
Location: So. Cal.

Re: How do I run GPU folding using primusrun?

Postby toTOW » Sat Jun 02, 2018 6:39 pm

FAH usually don't play well with power saving features ... you should disable them, or manage your client manually ...

You could still use the pause on battery feature in the client, but I don't know if the power saving features will be fast enough to start the dedicated GPU before FAH resumes when AC power is restored ...
Folding@Home beta tester since 2002. Folding Forum moderator since July 2008.

FAH-Addict : latest news, tests and reviews about Folding@Home project.

User avatar
Site Moderator
Posts: 5648
Joined: Sun Dec 02, 2007 11:38 am
Location: Bordeaux, France

Return to V7.4.4 Public Release Windows/Linux/MacOS X (deprecated)

Who is online

Users browsing this forum: No registered users and 1 guest