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.
This commit is contained in:
2025-06-03 13:18:36 +08:00
parent 3c75694260
commit 11f83042ae
4 changed files with 25011 additions and 0 deletions
+1
View File
@@ -9,3 +9,4 @@ frontend/.env
# Ignore Python cache files
__pycache__/
unsloth_compiled_cache/
notebooks/lora_model/
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+18
View File
@@ -0,0 +1,18 @@
#!/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