Limiting DGX Spark GPU Clocks: Installing sparkLimiter and Registering the Service
To set a GPU clock limit on a DGX Spark and apply the same limit after rebooting, you can use . It is a Bash script that sets the clock range with and registers
To set a GPU clock limit on a DGX Spark and apply the same limit after rebooting, you can use . It is a Bash script that sets the clock range with and registers
Contents
To set a GPU clock limit on a DGX Spark and apply the same limit after rebooting, you can use sparkLimiter. It is a Bash script that sets the clock range with nvidia-smi -lgc and registers a systemd service to apply it again at boot.
The following describes how to run it directly on a single DGX Spark. It uses the default value, 0,2200, which you can change to something like 0,1800 if needed.
This article is based on the repository code. It does not report installation on an actual DGX Spark or measurements of changes in performance, temperature, or power consumption. 2200 MHz and 1800 MHz are example settings; they are not guaranteed performance recommendations or energy savings.
Run this in the DGX Spark terminal. You need the NVIDIA driver, systemd, and Bash, and the account used to register the service must have sudo privileges. The script uses the path /usr/bin/nvidia-smi.
command -v bash
systemctl --version
test -x /usr/bin/nvidia-smi && /usr/bin/nvidia-smi
sudo -vFirst, check that nvidia-smi detects the GPU correctly. If there is a driver error, resolve the driver issue before setting a clock limit.
If Git is not installed, install it using the Ubuntu/Debian instructions. This package installation command is an operating-system preparation step, not part of sparkLimiter.
sudo apt-get update
sudo apt-get install -y gitgit clone https://github.com/MiaAI-Lab/sparkLimiter.git
cd sparkLimiterBecause this script changes system settings with administrator privileges, review its contents before running it.
less spark-limiter.shNo separate build or Python package installation is required. Use the executable file from the repository as is.
To request a maximum clock range of 2200 MHz for the currently connected Spark, run the following command.
./spark-limiter.sh --clocks 0,2200 localhost--clocks MIN,MAX: Minimum and maximum clock range in MHz.0,2200: Requests a minimum of 0 and a maximum of 2200 MHz. This does not mean the GPU will be fixed at 2200 MHz at all times.localhost: Applies the setting to the current machine. SSH is not required for local application.If you omit --clocks, the default is 0,2200. It is included in the article to make the value being applied explicit.
This command immediately sets the GPU clock and registers the system service. You do not need to prefix the entire script with
sudo. The script callssudofor the operations that require it. If you explicitly specifylocalhostor a host, the command applies the setting immediately without asking you to confirm the machine selection, so check the target first.
The script performs the following tasks.
sudo /usr/bin/nvidia-smi -lgc 0,2200./etc/systemd/system/spark-gpu-clock-limit.service.Therefore, you do not need to write a service file separately or run systemctl enable. This tool controls GPU clocks; it does not set CPU clocks or GPU power limits. The clock range that is actually allowed depends on the machine and driver support.
Run the following commands on the target DGX Spark as well.
systemctl is-enabled spark-gpu-clock-limit.service
systemctl status --no-pager spark-gpu-clock-limit.service
systemctl cat spark-gpu-clock-limit.serviceCheck the following items.
is-enabled is enabled.Type=oneshot, it may be shown as active (exited) after it has been applied successfully.ExecStart in the service contents is /usr/bin/nvidia-smi -lgc 0,2200.Also check the record of execution during the current boot and the GPU clock information.
sudo journalctl -b -u spark-gpu-clock-limit.service --no-pager
/usr/bin/nvidia-smi -q -d CLOCKTo observe the actual graphics clock at one-second intervals while a workload is running, use the following command. Press Ctrl+C to exit.
/usr/bin/nvidia-smi \
--query-gpu=name,clocks.current.graphics \
--format=csv -l 1
Max Clocksis not a field that reports the limit you set as is. In NVIDIA documentation, this value refers to the GPU's maximum clock by design. The installation script also outputsclocks.max.grat the end, but the setting is not successful only if this number changes to 2200. Check the service configuration and execution record together. A low current clock reading while idle does not by itself prove that the limit has been applied.
To verify that the limit is applied automatically after boot, save your work, stop any running GPU tasks, and reboot. Rebooting will interrupt your current connection and tasks, so do this only when convenient.
sudo systemctl rebootAfter reconnecting, do not rerun the installation command; check the service status, configuration, and current boot log above. This lets you verify that the setting was applied at boot rather than manually.
To change the maximum to 1800MHz, run the same script again.
./spark-limiter.sh --clocks 0,1800 localhostThe service file will also be replaced with the new value, and the service will restart immediately. This value will also be used after subsequent reboots. To change it back to 2200MHz, run the following:
./spark-limiter.sh --clocks 0,2200 localhostRunning nvidia-smi -lgc alone changes the current clock setting but not the value saved in the service. Change the value you want to persist after reboot using the script.
sudo systemctl stop spark-gpu-clock-limit.serviceStopping a service that is active and running normally executes ExecStop's nvidia-smi -rgc, restoring the GPU clock setting to its default. Automatic startup at boot remains enabled, so the limit will be applied again at the next boot.
To apply the limit again, run the following:
sudo systemctl restart spark-gpu-clock-limit.servicesudo systemctl disable --now spark-gpu-clock-limit.service
sudo /usr/bin/nvidia-smi -rgcThe first command disables automatic startup and also stops the current service. The second command explicitly resets the clock. If you use disable alone and omit --now, the current service will not be stopped.
To enable the service again without removing it, run the following:
sudo systemctl enable --now spark-gpu-clock-limit.serviceRun this from the downloaded sparkLimiter directory.
./spark-limiter.sh --uninstall localhostThis stops the service, disables automatic startup, resets the GPU clock, and deletes the service file. It does not delete the downloaded repository directory.
Running nvidia-smi -rgc alone leaves the service in place. If the service is enabled, the limit will be reapplied at the next boot, so you must disable automatic startup or uninstall the service to remove the limit permanently.
If you are configuring just one device, the localhost method above is sufficient. If you manage multiple Spark systems, you can specify the targets over SSH. Replace ubuntu@spark1 below with the actual account and hostname.
./spark-limiter.sh --clocks 0,2200 ubuntu@spark1List multiple devices separated by spaces.
./spark-limiter.sh --clocks 0,2200 ubuntu@spark1 ubuntu@spark2Remote targets also need /usr/bin/nvidia-smi, systemd, and sudo privileges. On the first connection, verify that the SSH host key fingerprint belongs to the correct device. Run the status-check commands on each target device.
To use automatic discovery, you can check the list of candidate devices with the following command. Discovery requires SSH key authentication to the target devices.
./spark-limiter.sh --listCommands that specify hosts directly skip discovery and target selection. When you know which devices to target, specifying them explicitly makes it easier to confirm where the setting will be applied.
The repository's defaults or behavior may change when it is updated, so check the current code before running it.