Advertisement
Guest User

RTX 6000 PRO overclock script

a guest
May 25th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.57 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # Usage: nvoc [core_offset] [mem_offset]
  4. # Example: nvoc 200 1000
  5. # If no args are given, defaults both to 0.
  6.  
  7. CORE="${1:-0}"
  8. MEM="${2:-0}"
  9. GPU=0
  10. DISPLAY_ID=:0
  11.  
  12. # Sanity checks: Only integers, within reasonable OC limits
  13. if ! [[ "$CORE" =~ ^-?[0-9]+$ ]]; then
  14.     echo "Error: core_offset must be an integer."
  15.     exit 1
  16. fi
  17. if ! [[ "$MEM" =~ ^-?[0-9]+$ ]]; then
  18.     echo "Error: mem_offset must be an integer."
  19.     exit 1
  20. fi
  21.  
  22. if (( CORE > 350 || CORE < -350 )); then
  23.     echo "Error: core_offset ($CORE) must be between -350 and 350 MHz."
  24.     exit 1
  25. fi
  26. if (( MEM > 6000 || MEM < -2000 )); then
  27.     echo "Error: mem_offset ($MEM) must be between -2000 and 6000 MHz."
  28.     exit 1
  29. fi
  30.  
  31. # Check if the X server is running on DISPLAY :0
  32. if [ ! -S /tmp/.X11-unix/X0 ]; then
  33.     echo "No X server detected on DISPLAY :0."
  34.     echo "Attempting to start X server on :0 as root..."
  35.     sudo X :0 &> /dev/null &
  36.     # Wait up to 5 seconds for X server to come up
  37.     for i in {1..10}; do
  38.         if [ -S /tmp/.X11-unix/X0 ]; then
  39.             echo "X server started successfully."
  40.             break
  41.         fi
  42.         sleep 0.5
  43.     done
  44.     if [ ! -S /tmp/.X11-unix/X0 ]; then
  45.         echo "Failed to start X server on :0."
  46.         exit 2
  47.     fi
  48. fi
  49.  
  50. export DISPLAY=$DISPLAY_ID
  51.  
  52. for i in {0..4}; do
  53.     nvidia-settings -a "[gpu:${GPU}]/GPUGraphicsClockOffset[$i]=${CORE}" -a "[gpu:${GPU}]/GPUMemoryTransferRateOffset[$i]=${MEM}"
  54. done
  55.  
  56. echo "Core clock offset set to ${CORE} MHz and memory offset set to ${MEM} MHz for all performance levels on GPU ${GPU}."
Tags: BASH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement