Skip to content

Instantly share code, notes, and snippets.

@lazerl0rd
Created January 20, 2022 15:18
Show Gist options
  • Save lazerl0rd/bc32357b6a8223c52f7c705057d28665 to your computer and use it in GitHub Desktop.
Save lazerl0rd/bc32357b6a8223c52f7c705057d28665 to your computer and use it in GitHub Desktop.
A wrapper for intel-undervolt to allow disabling undervolting temporarily.
#! /usr/bin/env bash
if [[ $# -eq 0 ]]; then
echo "Usage: intel-undervolt MODE [OPTION]..."
echo " read read and display current values"
echo " apply apply values from config file"
echo " measure measure power consumption"
echo " -f, --format <format> output format (terminal, csv)"
echo " -s, --sleep <interval> sleep interval in seconds"
echo " daemon run in daemon mode"
echo " disable reset voltages to default"
else
if [[ $1 == disable ]]; then
if [[ $UID != 0 ]]; then
echo "Failed to open MSR device: Permission denied"
echo "Failed to setup the program"
else
mv /etc/intel-undervolt.conf /etc/intel-undervolt.conf.tmp
mv /etc/intel-undervolt.conf.bak /etc/intel-undervolt.conf
/usr/bin/intel-undervolt apply
mv /etc/intel-undervolt.conf /etc/intel-undervolt.conf.bak
mv /etc/intel-undervolt.conf.tmp /etc/intel-undervolt.conf
fi
else
/usr/bin/intel-undervolt "$@"
fi
fi
undervolt 0 "CPU Core" 0
undervolt 1 "Intel GPU" 0
undervolt 2 "CPU Cache" 0
# The following was previously called "System Agent".
undervolt 3 "iGPU Unslice" 0
# The following was previously called "Analog I/O".
undervolt 4 "System Agent" 0
tjmax 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment