Created
February 19, 2024 19:46
-
-
Save mkrupczak3/1eed112d8f37c4e6d16eeac1d52ff8a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Set power limits on all NVIDIA GPUs | |
# Make sure nvidia-smi exists | |
command -v nvidia-smi &> /dev/null || { echo >&2 "nvidia-smi not found ... exiting."; exit 1; } | |
POWER_LIMIT=280 | |
MAX_POWER_LIMIT=$(nvidia-smi -q -d POWER | grep 'Max Power Limit' | tr -s ' ' | cut -d ' ' -f 6) | |
if [[ ${POWER_LIMIT%.*}+0 -lt ${MAX_POWER_LIMIT%.*}+0 ]]; then | |
/usr/bin/nvidia-smi --persistence-mode=1 | |
/usr/bin/nvidia-smi --power-limit=${POWER_LIMIT} | |
else | |
echo 'FAIL! POWER_LIMIT set above MAX_POWER_LIMIT ... ' | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment