Environment Variables for the GPU Client

Introduction To GPU Environment Variables
This article is a loose copy from FAH-Addict's article

In order to allow the GPU clients to be optimized for different configurations and user preferences, the developers have included some variables which can be set on a per user basis. There variables influence how the FahCore will behave, influencing its stability and performance accordingly. This article will explain the variables for Nvidia and AMD/ATI clients at this time, but as the project progresses and changes are made to the FahCores, the variables may change or disappear altogether. This article will be updated accordingly, but you may find some information is outdated if the client has recently been updated. If you have any questions about the variables, I would advise you to ask on the support forum

Configuring The Variables
First we need to open the System Properties window using any of the following methods:

Step 1: Click Orb/Start in the Taskbar Step 2: Select "Control Panel" Step 3: Select "System" (if you're viewing by category, switch to Classic view by clicking either the Large or Small icon) Step 4: Select "Advanced System Settings" on the Left Hand Side column
 * Method 1

Step 1: Right click on the "Computer" icon (either on the desktop or in the Start Menu) Step 2: Select "Properties" Step 3: Select "Advanced System Settings" on the Left Hand Side column
 * Method 2

Step 1: Press the WIN Key and the Break (the WIN key has the Windows logo on it. The break key has the text "Break" written on it) Step 2: Select "Advanced System Settings" on the Left Hand Side column
 * Method 3

Once the System Properties window opens (shown below)



Go to the Advanced tab (blue rectangle) and click Environment Variables (red rectangle)

A window will appear (shown below)



This window has two sections:

The upper part called User Variables (grey rectangle) only applies to the current user. The variables set here apply immediately to the current user and a simple restart of the Folding@Home client is enough to take them into account. If you use the client service mode and/or you have multiple users on the machine, this is not the right solution to set your variables. If you are the only user of your machine, it is the simplest method to configure your variables.

The lower part of the window, is called System variables (purple rectangle). The variables set here apply to all users of the system, but a reboot is necessary for the changes to take effect.

Note Regardless of where you set your variables, keep in mind that names are case sensitive: VARIABLE_ENV is not the same as variable_env

Be careful of what you type and double check to make sure it is correct.

To check that your variables are set, run a Command Prompt (Start> Programs> Accessories> Command Prompt) and use the command "echo %variable_name%" ... when the variable is properly configured, the value is displayed, otherwise %variable_name% is returned as a string value.



Now that you know how to configure the variables, please use the appropriate one depending on your GPU vendor.

Environment Variables Specific To AMD/ATI GPUs
Note: These variables require Core 11 v1.24 or later and Catalyst 9.3 or later to work.

FLUSH_INTERVAL
FLUSH_INTERVAL is what will affect graphics performance (the 2D lag phenomenon for example). This is the number of functions sent to the GPU in one go. The GPU will not do anything else, including refreshing the screen until processing of the batch of commands ends. A low value reduces the time F@H monopolises the GPU, and the response time of the interface increases. However, the lower the value becomes, the higher the CPU load related to the OS and the driver becomes, so there is a trade-off between the performance of F@H and the fluidity of the interface. If the batch is too large, it can cause a VPU Recover, the driver thinking that the GPU has hung (when it is just taking too long to respond).

CAL_NO_FLUSH & CAL_PRE_FLUSH
CAL_NO_FLUSH and CAL_PRE_FLUSH change the method of submitting batches of functions to the hardware. CAL_NO_FLUSH changes how the batches of functions are built. CAL_PRE_FLUSH allows caching the batch, in order to prepare the next batch in advance while the GPU handles the current batch.

BROOK_YIELD
BROOK_YIELD has several modes: 0/1/2. 0 will monopolise the CPU to have the lowest latency to requests from the GPU. 1 will release the CPU while waiting for response from the GPU to process all commandsof the same or lower priority than the GPU core. 2 will release the CPU for every process, regardless of its priority. Now, for very small values of FLUSH_INTERVAL and small proteins, it is likely that the GPU is almost finished when the CPU is released. The GPU must wait to regain access to the CPU, which may take up to a millisecond. A high-end GPU will complete most such batches in less than 100 microseconds, therefore the period of waiting for access to the CPU can have a big impact on performance. With a high value of FLUSH_INTERVAL, it is easy to build several milliseconds of work, making the wait period less of an issue.

Here is a sample configuration:

FLUSH_INTERVAL = 128-256 for a 48x0, 64-96 for a 38x0 (the optimum setting so that the GPU remains at 100% regardless of the WU, without causing too much lag should be within these ranges). BROOK_YIELD = 2 (to stop utilising 100% of the CPU and therefore allow an additional CPU client to be started) CAL_PRE_FLUSH = 1 CAL_NO_FLUSH = 1 (but should be reverted to 0 if it causes too many VPU Recovers).

FAH_GPU_IDLE
FAH_GPU_IDLE is a variable that was introduced with the 1.26 core to help reduce the overheating of some cards with some WUs at the request of some members of the community. Its value corresponds to the rate of waiting time we wish to introduce into the core. For example, a value of 10 corresponds to 10% of waiting time. The decline in performance is not necessarily proportional to the waiting time: in fact, depending on the calculations, it may not be possible to maintain exactly the value requested. This value is a target, but in practice, the actual waiting time will vary around this value. If your card has problems with overheating, you can use this to find the value that suits you best to keep reasonable performance, while limiting overheating of your card.

NV_FAH_CPU_AFFINITY
NV_FAH_CPU_AFFINITY is used to set the affinity of the core. It is not normally set up, unless you have trouble with program conflicts (performance degraded by sharing a CPU core with another program). Acceptable values are 0 to 15 (numerical values) ... this is actually a binary mask such that each bit represents a CPU: CPU3, CPU2, CPU1, CPU0. A value of 1 allows access to the CPU in question, and a value of 0 prohibits access. A numeric value 0 is the default: it allows access to all cores. If you use this variable in a custom configuration, it is recommended to enable the client option "do not lock cores to specific CPU" in the configuration.

Here are some examples for different values, as well as significant values:

1 -> 0001: CPU0 only 2 -> 0010: CPU1 only 3 -> 0011: CPU1 and CPU0 ... recommended for a dual core. 7 -> 0111: CPU2, CPU0 and CPU1 ... value adapted to a tri core. 9 -> 1001: CPU3 and CPU0 11 -> 1011: CPU3, CPU0 and CPU1 15 -> 1111: CPU3, CPU2, ... CPU0 and CPU1 value adapted to a quad core.

Most values are exotic combinations as you can see (1, 3, 9, 11, ...) but can be useful if you have a particular need. The most common values are 0 (default), 3 (dual core), 7 (tri core) and 15 (quad core).