BOINC GPU suspend on Linux

Introduction

BOINC is a platform to allow participants to provide home computational resources to a wide variety of scientific research projects. It’s frequently useful to utilize a BOINC account manager to easily handle project/work related settings across multiple devices. For example, I utilize BOINCStats and you can see my credit history here.

BOINC Credits

Efficiently using GPU

BOINC can utilize both your CPU and GPU to perform research. BOINC by default runs at a lower priority such that other applications will typically not be affected by BOINC during normal use. In addition, BOINC can be set to only utilize these resources when the system is idle. However, in my experience on Linux the detection of idle system state does not correctly allow the GPU to be utilized. As a result, one can execute the following bash script, either manually or on startup, to ensure the GPU is used when idle.

#!/bin/bash

gdbus monitor --session --dest org.gnome.SessionManager --object-path /org/gnome/SessionManager/Presence | 
while read -r sig; do
    case $sig in
        *StatusChanged*3,\)) boinccmd --set_gpu_mode always;;
        *StatusChanged*) boinccmd --set_gpu_mode auto;;
    esac;
done

All this simple script does is the following:

  1. Monitor the dbus interface for the Presence object, which signifies when the system is idle/in use
  2. Change the BOINC GPU mode to always/auto (use your preferences) when system Presence status changes