Skip to content

An updated script to lower usage down to 10W #7

@pedrovillalobos

Description

@pedrovillalobos

I've been using SpaceInvaderOne's script for a long time and it works like a charm. But since the latest drive update, 595, I noticed I was drawing 9W in idle (it was usually 19W).

After some tweaking, it went back to 20W. But it was just a matter of setting the script so it would reset my gpu if it was drawing more than 15W.

If you know your idle is higher, just change it from 15 to another number.

I hope this helps more people save a few extra bucks every month (here it's about US$3/month in savings with it idling at 9w):

#!/bin/bash

command -v nvidia-smi >/dev/null || exit 1

# Enable persistence mode
nvidia-smi --persistence-mode=1 >/dev/null

read pstate power util <<< $(nvidia-smi \
--query-gpu=pstate,power.draw,utilization.gpu \
--format=csv,noheader,nounits | sed 's/,//g')

pid=$(nvidia-smi --query-compute-apps=pid --format=csv,noheader)

power=${power%.*}

echo "State: $pstate | Power: ${power}W | Util: ${util}%"

# Reset only if clearly stuck
if [ -z "$pid" ] && [ "$util" -eq 0 ] && [ "$pstate" = "P8" ] && [ "$power" -gt 15 ]; then
    echo "GPU idle but power stuck high → resetting GPU"
    nvidia-smi --gpu-reset
else
    echo "GPU state normal"
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions