Skip to content

Instantly share code, notes, and snippets.

@broncotc
Created July 4, 2021 18:00
Show Gist options
  • Save broncotc/4f0cd292248cc04117c2bbb32e06613c to your computer and use it in GitHub Desktop.
Save broncotc/4f0cd292248cc04117c2bbb32e06613c to your computer and use it in GitHub Desktop.
supermicro gpu server fancurve script
import os
import time
import subprocess
# speed 0-100, speed is for zone0, zone1 will have speed -2
zone_info = [
{
"hex": "0x00",
"f_low_speed": 11,
"f_high_speed": 88,
"f_low_temp": 60,
"f_high_temp": 83,
"items": [4, 4761]
},
{
"hex": "0x01",
"f_low_speed": 8,
"f_high_speed": 86,
"f_low_temp": 60,
"f_high_temp": 84,
"items": [71]
}
]
os.system("ipmitool raw 0x30 0x45 0x01 0x01")
while True:
reading_str = subprocess.check_output(
["ipmi-sensors", "-s", "4,71,4761", "--comma-separated-output", "--no-header-output"]).decode()
reading_lines = reading_str.splitlines()
reading_split = list(map(lambda x: x.split(","), reading_lines))
for zone in zone_info:
temp = max(map(lambda x: float(x[3]), filter(lambda x: x[0] in map(str, zone["items"]), reading_split)))
if temp < zone["f_low_temp"]:
f_speed = zone["f_low_speed"]
elif temp > zone["f_high_temp"]:
f_speed = zone["f_high_speed"]
else:
f_speed_f = zone["f_low_speed"] + (
(temp - zone["f_low_temp"]) / (zone["f_high_temp"] - zone["f_low_temp"]) * (
zone["f_high_speed"] - zone["f_low_speed"]))
f_speed = int(f_speed_f)
print(hex(f_speed))
print(temp)
command = 'ipmitool raw 0x30 0x70 0x66 0x01 ' + zone["hex"] + " " + hex(f_speed)
os.system(command)
time.sleep(0.75)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment