Created
March 19, 2022 21:10
-
-
Save michelesr/6f67cf8474250337a948b28eeb7cb45a to your computer and use it in GitHub Desktop.
Turn NVIDIA discrete card off on Linux
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 | |
set -ex | |
CONTROLLER_BUS_ID=0000:00:01.0 | |
DEVICE_BUS_ID=0000:01:00.0 | |
if sudo lsof /dev/nvidia0 ; then | |
echo 'Some processes are still using the card, aborting.' | |
exit 1 | |
fi | |
sudo modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia | |
sudo tee /sys/bus/pci/devices/${DEVICE_BUS_ID}/remove <<<1 | |
sudo tee /sys/bus/pci/devices/${CONTROLLER_BUS_ID}/power/control <<<auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment