/usr/share/X11/xorg.conf.d/10-nvidia.conf
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "Coolbits" "28"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
Change NVIDIA graphic card power limit:
nvidia-smi -i 0 -q
sudo nvidia-smi -i 0 -pl 75
Warning: persistence mode is disabled on device 00000000:26:00.0. See the Known Issues section of the nvidia-smi(1) man page for more information. Run with [--help | -h] switch to get more information on how to enable persistence mode.
sudo nvidia-smi -i 0 -pm ENABLED
Enabled persistence mode for GPU 00000000:26:00.0.
All done.
nvidia-smi -i 0 -q
nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits // current consumption in watts
watch -n 1 nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits // -n 1 => every sec
watch -n 1 nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits >> //media/user/directory/power_log.txt && truncate -s 100M /media/user/directory/power_log.txt
sudo nano gpu_power_monitor.sh
#!/bin/bash
LOG_FILE="/media/user/directory/gpu_power_log.txt"
MAX_SIZE_MB=10
while true; do
POWER=$(nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits)
TEMPERATURE=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits)
CURRENT_TIME=$(date "+%Y-%m-%d %H:%M:%S")
echo "P: $POWER W, T: $TEMPERATURE C $CURRENT_TIME" >> "$LOG_FILE"
echo "P: $POWER W, T: $TEMPERATURE C $CURRENT_TIME"
FILE_SIZE=$(du -m "$LOG_FILE" | cut -f1)
if [ "$FILE_SIZE" -gt "$MAX_SIZE_MB" ]; then
sed -i '1d' "$LOG_FILE"
fi
sleep 1
done
LOG_FILE="/media/user/directory/gpu_power_log.txt"
MAX_SIZE_MB=10
while true; do
POWER=$(nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits)
TEMPERATURE=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits)
CURRENT_TIME=$(date "+%Y-%m-%d %H:%M:%S")
echo "P: $POWER W, T: $TEMPERATURE C $CURRENT_TIME" >> "$LOG_FILE"
echo "P: $POWER W, T: $TEMPERATURE C $CURRENT_TIME"
FILE_SIZE=$(du -m "$LOG_FILE" | cut -f1)
if [ "$FILE_SIZE" -gt "$MAX_SIZE_MB" ]; then
sed -i '1d' "$LOG_FILE"
fi
sleep 1
done
chmod +x gpu_power_monitor.sh
./gpu_power_monitor.sh
https://docs.nvidia.com/deploy/driver-persistence/index.html
https://download.nvidia.com/XFree86/Linux-x86_64/430.14/README/xconfigoptions.html#Coolbits
https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Displaying_GPU_temperature_in_the_shell
https://www.gpugrid.net/forum_thread.php?id=5113
https://github.com/nan0s7/nfancurve
https://gitlab.com/leinardi/gwe
https://git-scm.com/docs/git
No comments:
Post a Comment