Pure-NVML, completely headless GPU overclocking and power tuning for Linux without any X11/Xorg or nvidia-settings display server hacks.
Tested on RTX 5060 Ti 16GB hitting ~108–118 tok/s in MoE inference using Strata by @coldniko.
- Model Context: 30,000 tokens (thinking budget capped at 22,500)
- Reasoning / Thinking: 66 → 91.5 tok/s
- **Tool Calling / Generation:**107.9 tok/s sustained (1996 tokens in 19s)
- **Expert Cache Hit Rate:**85.1% (only 1.4% routed over PCIe)
- Memory OC:****+5300 MHz via
nvmlDeviceSetMemClkVfOffset - Core (GPC) OC:****+450 MHz via
nvmlDeviceSetGpcClkVfOffset - Power Limit: 182W (Persistence mode ON)
Run the following bash script with sudo to set up the isolated Python venv, deploy all config files, and enable the systemd service:
#!/usr/bin/env bash
set -euo pipefail
echo "==> 1. Setting up Python venv with nvidia-ml-py..."
mkdir -p /opt/nvidia-nvml
python3 -m venv /opt/nvidia-nvml
/opt/nvidia-nvml/bin/pip install --upgrade pip
/opt/nvidia-nvml/bin/pip install nvidia-ml-py
echo "==> 2. Creating /etc/default/nvidia-llama-power..."
cat << 'EOF' > /etc/default/nvidia-llama-power
POWER_LIMIT=182
MEMORY_OFFSET=5300
GRAPHICS_OFFSET=450
EOF
echo "==> 3. Creating /usr/local/sbin/nvidia-llama-oc.py..."
cat << 'EOF' > /usr/local/sbin/nvidia-llama-oc.py
import os
from pynvml import *
memory = int(os.environ["MEMORY_OFFSET"])
graphics = int(os.environ["GRAPHICS_OFFSET"])
nvmlInit()
try:
h = nvmlDeviceGetHandleByIndex(0)
nvmlDeviceSetMemClkVfOffset(h, memory)
nvmlDeviceSetGpcClkVfOffset(h, graphics)
mem_actual = nvmlDeviceGetMemClkVfOffset(h)
gpc_actual = nvmlDeviceGetGpcClkVfOffset(h)
if mem_actual != memory:
raise RuntimeError(
f"memory offset mismatch: requested={memory}, actual={mem_actual}"
)
if gpc_actual != graphics:
raise RuntimeError(
f"GPC offset mismatch: requested={graphics}, actual={gpc_actual}"
)
print(f"memory offset: {mem_actual} MHz")
print(f"GPC offset: {gpc_actual} MHz")
finally:
nvmlShutdown()
EOF
chmod +x /usr/local/sbin/nvidia-llama-oc.py
echo "==> 4. Creating /usr/local/sbin/nvidia-llama-power.sh..."
cat << 'EOF' > /usr/local/sbin/nvidia-llama-power.sh
#!/bin/bash
set -e
source /etc/default/nvidia-llama-power
export POWER_LIMIT MEMORY_OFFSET GRAPHICS_OFFSET
/usr/bin/nvidia-smi -pm 1
/usr/bin/nvidia-smi -pl "$POWER_LIMIT"
/usr/bin/nvidia-smi -rgc
exec /opt/nvidia-nvml/bin/python /usr/local/sbin/nvidia-llama-oc.py
EOF
chmod +x /usr/local/sbin/nvidia-llama-power.sh
echo "==> 5. Creating /etc/systemd/system/nvidia-llama-power.service..."
cat << 'EOF' > /etc/systemd/system/nvidia-llama-power.service
[Unit]
Description=Set NVIDIA GPU profile for llama.cpp / Strata
After=multi-user.target
ConditionPathExists=/usr/bin/nvidia-smi
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/nvidia-llama-power.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
echo "==> 6. Enabling and starting systemd service..."
systemctl daemon-reload
systemctl enable --now nvidia-llama-power.service
echo "==> All done! Check status with: systemctl status nvidia-llama-power.service"
Check service status:
systemctl status nvidia-llama-power.service
Expected output:
● nvidia-llama-power.service - Set NVIDIA GPU profile for llama.cpp / Strata
Loaded: loaded (/etc/systemd/system/nvidia-llama-power.service; enabled; preset: enabled)
Active: active (exited)
...
nvidia-llama-power.sh: Enabled persistence mode via daemon for GPU 00000000:23:00.0.
nvidia-llama-power.sh: Power limit for GPU 00000000:23:00.0 was set to 182.00 W from 180.00 W.
nvidia-llama-power.sh: memory offset: 5300 MHz
nvidia-llama-power.sh: GPC offset: 450 MHz
To change power limit or clock offsets, simply edit /etc/default/nvidia-llama-power:
sudo nano /etc/default/nvidia-llama-power
And re-apply immediately:
sudo systemctl restart nvidia-llama-power.service