Intel CPU Undervolting


Recommended Posts

Beware!

Undervolting can cause system crashs and this could cause data loss! Use it on your own risk!

 

Undervolting

Undervolting reduces the power usage of your CPU. Depending on the CPU and used settings 5 to 10W on full load and 0 to 1W in idle.

 

ImportantAt first you should stop your array to avoid data loss (and to avoid parity check on reboot)!

 

Requirements (install them through NerdPack)

- Python 3

- pip

- setuptools

 

Execute the following script by CA User Scripts (do not schedule it, until you did not stress test your setting!):

#!/bin/bash
# #####################################
# Script:      Intel Undervolting v0.5
# Description: Undervolts your Intel CPU
# Author:      Marc Gutt
# 
# Changelog:
# 0.5
# - reset install method to v0.3
# 0.4
# - reset undervolt installation method
# - check install file integrity
# 0.3
# - changed undervolt installation method
# 0.2
# - bug fix
# - unraid notification added
# - more log output
# 0.1
# - first release
# 
# ######### Settings ##################
notification=1
# #####################################
# 
# ######### Script ####################
# make script race condition safe
if [[ -d "/tmp/${0///}" ]] || ! mkdir "/tmp/${0///}"; then exit 1; fi; trap 'rmdir "/tmp/${0///}"' EXIT;
# Check if python3 is installed (can be installed through NerdPack)

# check if Python 3 is installed
if [[ "$(python3 -V)" =~ "command not found" ]]; then
    /usr/local/emhttp/webGui/scripts/notify -i alert -s "CPU Undervolting failed!" -d "Python 3 is missing!"
fi

# check if pip is installed
if [[ "$(pip -V)" =~ "command not found" ]]; then
    /usr/local/emhttp/webGui/scripts/notify -i alert -s "CPU Undervolting failed!" -d "pip (Python package manager) is missing!"
    exit 1
fi

# check if setuptools is installed
if [[ ! "$(pip list)" =~ "setuptools" ]]; then
    /usr/local/emhttp/webGui/scripts/notify -i alert -s "CPU Undervolting failed!" -d "setuptools (Python package library) is missing!"
    exit 1
fi

# Check and install undervolt
if [[ ! "$(undervolt --version)" =~ "undervolt" ]]; then
    echo "Undervolt is missing and will be installed..."
    pip install undervolt
fi

# Get CPU Model
cpu_model=$(lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1')
echo $cpu_model

# Undervolt CPU
undervolt --gpu -50 --core -50 --cache -50 --uncore -50 --analogio -50
undervolt --read
undervolt_read=$(undervolt --read | tr '\n' ' ')
if [[ $notification == "1" ]]; then
    /usr/local/emhttp/webGui/scripts/notify -i normal -s "CPU undervolted" -d "$undervolt_read"
fi

-50mV should work with all CPUs, but I suggest to stop the array first, install stress and perform it as described in the next section, before using the undervolted CPU on your productive server. Other often used variants as an example:

undervolt --gpu -75 --core -100 --cache -100 --uncore -100 --analogio -100
undervolt --gpu -50 --core -130 --cache -100 --uncore -130 --analogio -100

Feel free to post your CPU model and used command.

 

Stress

After setting the undervolting (you hopefully stopped your array, if not, do it!), you can now install stress as follows:

wget https://packages.slackonly.com/pub/packages/14.2-x86_64/system/stress/stress-1.0.4-x86_64-1_slonly.txz -P /tmp
upgradepkg --install-new /tmp/stress-1.0.4-x86_64-1_slonly.txz

And execute it as follows if your CPU has 4 cores (change the value as needed):

stress --cpu 4

 

Link to comment

I had the same issue with the script to but I got it to run by editing it.

 

#!/bin/bash

# Check if python3 is installed (can be installed through NerdPack)
if [[ "$(python3 -V)" =~ "Python 3" ]]; 
then
    # Check if undervolt is already installed
    [[ ! "$(undervolt --version)" =~ "undervolt" ]];
        wget http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20200612_07d0c70-x86_64-1.txz -P /tmp
        upgradepkg --install-new /tmp/undervolt-20200612_07d0c70-x86_64-1.txz
    fi
    # Undervolt CPU
    undervolt --gpu -75 --core -100 --cache -100 --uncore -100 --analogio -100
    undervolt --read

But I run into another issue.

 

Resolving slackware.cs.utah.edu (slackware.cs.utah.edu)... 155.98.64.87
Connecting to slackware.cs.utah.edu (slackware.cs.utah.edu)|155.98.64.87|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14936 (15K) [text/plain]
Saving to: '/tmp/undervolt-20200612_07d0c70-x86_64-1.txz.1'

0K .......... .... 100% 13.2K=1.1s

2020-10-21 17:10:06 (13.2 KB/s) - '/tmp/undervolt-20200612_07d0c70-x86_64-1.txz.1' saved [14936/14936]


+==============================================================================
| Skipping package undervolt-20200612_07d0c70-x86_64-1 (already installed)
+==============================================================================

Traceback (most recent call last):
File "/usr/bin/undervolt", line 33, in
sys.exit(load_entry_point('undervolt==0.3.0', 'console_scripts', 'undervolt')())
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 411, in main
set_offset(plane, offset, msr)
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 222, in set_offset
write_msr(write_value, msr.addr_voltage_offsets)
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 81, in write_msr
os.write(f, pack('Q', val))
OSError: [Errno 5] Input/output error
temperature target: -0 (100C)
Traceback (most recent call last):
File "/usr/bin/undervolt", line 33, in
sys.exit(load_entry_point('undervolt==0.3.0', 'console_scripts', 'undervolt')())
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 455, in main
voltage = read_offset(plane, msr)
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 208, in read_offset
write_msr(value_to_write, msr.addr_voltage_offsets)
File "/usr/lib64/python3.8/site-packages/undervolt.py", line 81, in write_msr
os.write(f, pack('Q', val))
OSError: [Errno 5] Input/output error
Script Finished Oct 21, 2020 17:10.06

 

Link to comment
  • 1 month later...
  • 1 month later...
Script location: /tmp/user.scripts/tmpScripts/Undervolt/script
Note that closing this window will abort the execution of this script
/tmp/user.scripts/tmpScripts/Undervolt/script: line 44: undervolt: command not found
Undervolt is missing and will be installed...
Collecting undervolt
Downloading undervolt-0.3.0.tar.gz (10 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hdj944q9/undervolt/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hdj944q9/undervolt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hdd0073d
cwd: /tmp/pip-install-hdj944q9/undervolt/
Complete output (11 lines):
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python3.9/site-packages/setuptools/__init__.py", line 18, in
from setuptools.dist import Distribution
File "/usr/lib64/python3.9/site-packages/setuptools/dist.py", line 32, in
from setuptools import windows_support
File "/usr/lib64/python3.9/site-packages/setuptools/windows_support.py", line 2, in
import ctypes
File "/usr/lib64/python3.9/ctypes/__init__.py", line 8, in
from _ctypes import Union, Structure, Array
ImportError: libffi.so.7: cannot open shared object file: No such file or directory
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
/tmp/user.scripts/tmpScripts/Undervolt/script: line 54: undervolt: command not found
/tmp/user.scripts/tmpScripts/Undervolt/script: line 55: undervolt: command not found
/tmp/user.scripts/tmpScripts/Undervolt/script: line 56: undervolt: command not found

got this error.

Link to comment

@PCR

Try to install the slackware package of undervolt instead:

wget http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20201024_13fa33d-x86_64-1.txz -N -P /tmp
upgradepkg --install-new /tmp/undervolt-20201024_13fa33d-x86_64-1.txz

Does this work for you?

Link to comment
cript location: /tmp/user.scripts/tmpScripts/Undervolt/script
Note that closing this window will abort the execution of this script
Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
temperature target: -0 (100C)
core: -49.8 mV
gpu: -49.8 mV
cache: -49.8 mV
uncore: -49.8 mV
analogio: -49.8 mV
powerlimit: 130.0W (short: 0.00244140625s - enabled) / 115.0W (long: 16.0s - enabled)

yes. but why? have i made a mistake?

 

Best

Link to comment
  • 2 weeks later...
On 1/11/2021 at 7:11 PM, mgutt said:

@PCR

Try to install the slackware package of undervolt instead:



wget http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20201024_13fa33d-x86_64-1.txz -N -P /tmp
upgradepkg --install-new /tmp/undervolt-20201024_13fa33d-x86_64-1.txz

Does this work for you?

I had the same like PCR and installed the current slackware package (undervolt-20201024_13fa33d-x86_64-2.txz). This worked for me.

 

My CPU is the same as yours mgutt core-i3 8100, so I used your settings.

How long should the stress test run to make sure it's stable?

 

PS: Nice work and thanks for the guide!

Edited by postboy99
Link to comment

Hello,

 

I've got the same problem like PCR or postboy99 but then I try to install it through slackware I got this:

 

 wget http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20201024_13fa33d-x86_64-1.txz -N -P /tmp
--2021-01-29 08:41:18--  http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20201024_13fa33d-x86_64-1.txz
Resolving slackware.cs.utah.edu (slackware.cs.utah.edu)... 155.98.64.87
Connecting to slackware.cs.utah.edu (slackware.cs.utah.edu)|155.98.64.87|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-01-29 08:41:18 ERROR 404: Not Found.

 

Can you give me a hint whats wrong?

 

Thanks for your work.

 

Link to comment

I found the correct link

 

wget http://slackware.cs.utah.edu/pub/slackware/slackware64-current/slackware64/ap/undervolt-20201024_13fa33d-x86_64-2.txz -N -P /tmp
upgradepkg --install-new /tmp/undervolt-20201024_13fa33d-x86_64-2.txz

 

Thanks but I the script or the undervolt programm dont work:

 

Script location: /tmp/user.scripts/tmpScripts/undervolt/script
Note that closing this window will abort the execution of this script
Intel(R) Core(TM) i3-9100 CPU @ 3.60GHz
ERROR:root:Failed to apply core: set -49.8046875, read 0.0
temperature target: -0 (100C)
core: 0.0 mV
gpu: 0.0 mV
cache: 0.0 mV
uncore: 0.0 mV
analogio: 0.0 mV
powerlimit: 90.0W (short: 0.00244140625s - enabled) / 65.0W (long: 28.0s - enabled) [locked]

 

any ideas?

Edited by FailX
Link to comment
  • 2 weeks later...
  • 3 months later...
  • 4 months later...
  • 2 weeks later...
  • 3 weeks later...

Unfortunately it doesn't work for me. Get the following error message

 

root@unraid:~# undervolt --core -1 --cache -1
ERROR:root:Failed to apply core: set -0.9765625, read 0.0

 

root@unraid:~# undervolt --core -50 --cache -50

ERROR:root:Failed to apply core: set -49.8046875, read 0.0

 

i3-8100

FUJITSU D3642-B1, Version S26361-D3642-B1
FUJITSU // American Megatrends Inc., Version V5.0.0.13 R1.26.0 for D3642-B1x
BIOS dated: Monday, 08.03.2021

Edited by onotop
Translate to English
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.