Sign In

Power Level Control on NVIDIA Graphic Cards

2

Jul 14, 2025

(Updated: 5 months ago)

tool guide
Power Level Control on NVIDIA Graphic Cards

Preface

I had to reinstall my AI computation machine. Since I had no desire to search for old data again, I redid some things.

Prerequisite

I assume that you are working on a Linux system.

NVIDIA Graphic Cards

When using NVIDIA graphic cards one can control some settings like the power consumption. The subsequently presented code sets the power level for the graphic cards in use. It is a simple Bash script. Nothing special.

Code

#!/usr/bin/bash
#
# © 2025, zentrocdot, all rights reserved
# Free for private use
# Version 0.0.0.1
#
# Prerequisite:
#     nvidia-smi

# Declare the associative array.
# Key is the GPU. Value is the power level.
declare -A DEVICES=(["0"]=125
                    ["1"]=100
                    ["2"]=100
                    ["3"]=125)

# Change the persistance mode.
echo -e "========================"
echo -e "Set the persistance mode"
echo -e "========================"
for d in "${!DEVICES[@]}"
do
    nvidia-smi -i "${d}" -pm 1
done

# Change the power level.
echo -e "\n======================"
echo -e "Change the power level"
echo -e "======================\n"
for d in "${!DEVICES[@]}"
do
    nvidia-smi -i "${d}" -pl "${DEVICES[$d]}"
done

# Exit the script.
exit 0

Final Words

Have fun. Be inspired!

2