Created
July 16, 2024 09:54
-
-
Save MasterSkepticista/59f505bf96088414f27d3a0b18da77d4 to your computer and use it in GitHub Desktop.
Reload `nvidia-smi` without a reboot.
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
#!/bin/bash | |
# Reloads `nvidia-smi` if you have had NVML/Library updates/mismatches, | |
# and you use a remote server which you cannot reboot for a whole host | |
# of scary reasons. Ensure nothing is running on the GPU, else this fails. | |
# Must be run with sudo. Be careful there are no display targets on the | |
# It is likely safe. | |
set -Eeuo pipefail | |
if [[ $UID != 0 ]]; then | |
echo "Please run this script with sudo." | |
echo "sudo $0 $*" | |
exit 1 | |
fi | |
systemctl isolate multi-user.target | |
# Stop nvidia modules. | |
modprobe -r nvidia_uvm nvidia_modeset | |
modprobe -r nvidia | |
systemctl start graphical.target | |
nvidia-smi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment