Support for NVIDIA overclocking in Wayland / NVML
I'm running the latest 570.86.16 beta driver and even NVIDIA themselves have switched to NVML (instead of NV-CONTROL). gpuclockctl (which Gamemode uses for overclicking) currently doesn't support this so if you use either
- Wayland
- Rootless Xorg
- Xorg without
CoolBits
you're out of luck.
You can of course run your own scripts in Gamemode but NVML requires root privileges and I haven't figured out yet how to make it work with Gamemode (other than just running sudo gamemoderun of course). So as a crude and very dirty solution I'm currently doing this:
# /etc/gamemode.ini
[custom]
start=/usr/bin/bash -c 'echo PASSWORD | sudo -S python -c "from pynvml import *;nvmlInit();g=nvmlDeviceGetHandleByIndex(0);nvmlDeviceSetGpcClkVfOffset(g,100);nvmlDeviceSetMemClkVfOffset(g,1000)"'
end=/usr/bin/bash -c 'echo PASSWORD | sudo -S python -c "from pynvml import *;nvmlInit();g=nvmlDeviceGetHandleByIndex(0);nvmlDeviceSetGpcClkVfOffset(g,0);nvmlDeviceSetMemClkVfOffset(g,0)"'
This requires nvidia-ml-py (python3 -m pip install nvidia-ml-py or python-nvidia-ml-py on Arch).
Hi. First, thanks for letting me discover NVML. I found https://github.com/Dreaming-Codes/nvidia_oc that may be interesting for you as an alternative to pasting python code directly into gamemode.ini.