Files
furyhawk 11f83042ae Add toggle_nvidia.sh script for managing NVIDIA persistence mode and performance state
This script allows users to easily enable or disable NVIDIA persistence mode and adjust the performance state of the GPU. It includes options to set the clock speeds and reload the NVIDIA Unified Memory kernel module. Usage instructions are provided for clarity.
2025-06-03 13:18:36 +08:00

18 lines
601 B
Bash
Executable File

#!/bin/bash
if [ "$1" == "on" ]; then
echo "Turning persistence mode ON and setting performance state..."
sudo nvidia-smi -pm 1
sudo nvidia-smi -lgc 1000,2100 # you can adjust clock speed here
sudo modprobe -r nvidia_uvm && sudo modprobe nvidia_uvm
echo "Persistence mode is ON."
elif [ "$1" == "off" ]; then
echo "Turning persistence mode OFF and resetting performance state..."
sudo nvidia-smi -pm 0
sudo nvidia-smi -rgc
sudo modprobe -r nvidia_uvm && sudo modprobe nvidia_uvm
echo "Persistence mode is OFF."
else
echo "Usage: $0 {on|off}"
exit 1
fi