From 3ed09f2f88ddd65cbca704539f69b4e385ae2d40035ace5a02bc3600b15fda40 Mon Sep 17 00:00:00 2001 From: Late Night Defender Date: Mon, 25 Nov 2024 02:06:27 +0700 Subject: [PATCH] Add BOINC stuff --- boinc/app_config_template.xml | 13 +++++++++ boinc/boinc-client-amd-opencl.service | 42 +++++++++++++++++++++++++++ boinc/cc_config_template.xml | 11 +++++++ boinc/screenlock.sh | 10 +++++++ 4 files changed, 76 insertions(+) create mode 100755 boinc/app_config_template.xml create mode 100755 boinc/boinc-client-amd-opencl.service create mode 100644 boinc/cc_config_template.xml create mode 100755 boinc/screenlock.sh diff --git a/boinc/app_config_template.xml b/boinc/app_config_template.xml new file mode 100755 index 0000000..5464aa6 --- /dev/null +++ b/boinc/app_config_template.xml @@ -0,0 +1,13 @@ + + + myapp + + 1.0 + 0.5 + + + + + + 1 + diff --git a/boinc/boinc-client-amd-opencl.service b/boinc/boinc-client-amd-opencl.service new file mode 100755 index 0000000..9d707b3 --- /dev/null +++ b/boinc/boinc-client-amd-opencl.service @@ -0,0 +1,42 @@ +[Unit] +Description=Berkeley Open Infrastructure Network Computing Client +Documentation=man:boinc(1) +After=network-online.target + +[Service] +Environment=GPU_SINGLE_ALLOC_PERCENT=100 +Environment=GPU_MAX_HEAP_SIZE=100 +Environment=GPU_FORCE_64BIT_PTR=1 +Environment=GPU_USE_SYNC_OBJECTS=1 +Environment=GPU_MAX_ALLOC_PERCENT=100 +Type=simple +ProtectHome=true +PrivateTmp=true +#ProtectSystem=strict +#ProtectControlGroups=true +ReadWritePaths=-/var/lib/boinc -/etc/boinc-client +Nice=10 +User=boinc +WorkingDirectory=/var/lib/boinc +ExecStart=/usr/bin/boinc +ExecStop=/usr/bin/boinccmd --quit +ExecReload=/usr/bin/boinccmd --read_cc_config +ExecStopPost=/bin/rm -f lockfile +IOSchedulingClass=idle +# The following options prevent setuid root as they imply NoNewPrivileges=true +# Since Atlas requires setuid root, they break Atlas +# In order to improve security, if you're not using Atlas, +# Add these options to the [Service] section of an override file using +# sudo systemctl edit boinc-client.service +#NoNewPrivileges=true +#ProtectKernelModules=true +#ProtectKernelTunables=true +#RestrictRealtime=true +#RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX +#RestrictNamespaces=true +#PrivateUsers=true +#CapabilityBoundingSet= +#MemoryDenyWriteExecute=true + +[Install] +WantedBy=multi-user.target diff --git a/boinc/cc_config_template.xml b/boinc/cc_config_template.xml new file mode 100644 index 0000000..9b994a3 --- /dev/null +++ b/boinc/cc_config_template.xml @@ -0,0 +1,11 @@ + + + 1 + 1 + 1 + + + 1 + + + diff --git a/boinc/screenlock.sh b/boinc/screenlock.sh new file mode 100755 index 0000000..1caba0b --- /dev/null +++ b/boinc/screenlock.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# If screen is locked (GNOME Screensaver true), enable GPU computing. Otherwise disable GPU computing. +dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | + while read x; do + case "$x" in + *"boolean true"*) boinccmd --set_gpu_mode always && echo "GPU Computing Enabled";; + *"boolean false"*) boinccmd --set_gpu_mode never && echo "GPU Computing Disabled";; + esac + done