KoskenDocs Open the app

Tune a GPU machine

Kosken scans each GPU machine once a day, proposes changes to the GPU and the operating system, and applies the ones you pick as a maintenance.

5 min readUpdated on Español

On this page
  1. The tuning scan
  2. The states of a setting
  3. What Kosken proposes
  4. The executor rights
  5. Apply, request approval, plan in a window
  6. Undo a change and dismiss an optimization
  7. Where tuning works

This guide shows what the tuning scan reads, what each optimization changes, how a change runs and how to undo it.

The tuning scan

Once a day, and when you select Scan now, Kosken reads each GPU machine with read-only checks: the CPU governor, NUMA, transparent huge pages, swappiness, the kernel command line and the IOMMU, the power limits and the persistence mode of each GPU, the PCIe link, and the Xid errors of the kernel log. The rules of Kosken run on these numbers; a model picks no value.

The Tuning tab of a machine lists every setting with its value now, the proposed value, a state and the reason. AI Ops › Tuning lists the open optimizations of every machine, and the AI Ops overview shows how many are open.

The states of a setting

StateMeaning
AvailableA change is proposed and the machine allows it.
Needs gpu or Needs os_tuneA change is proposed, but the executor right is off. The tab shows the command to turn it on.
Already tunedNothing to change.
Not availableThe machine does not allow the change, with the reason. Kosken never offers it.
FindingSomething to know that no recipe changes, such as a PCIe link under its maximum or Xid errors.
Planned, DismissedA maintenance runs it, or a person dismissed it.

What Kosken proposes

SettingWhenProposedRisk
CPU governorNot performanceperformanceLow
NUMA balancingOn, with more than one NUMA nodeoffLow
Transparent huge pagesalwaysmadviseLow
SwappinessOver 1010Low
Kernel boot parametersThe IOMMU is on and no virtual machine uses a GPUiommu=pt, at the next bootMedium
Huge pagesNo 1 GiB pages, and the VRAM of all GPUs is over 80 GB1 GiB pages, at the next bootMedium
Persistence modeOff on an NVIDIA GPUonLow
Power limitThermal slowdown in more than 10% of the last 24 hoursThe limit that keeps the GPU 8 °C under its slowdown point, from its own history of power against temperatureMedium
Power limitThe power cap holds the clocks while the limit is under the defaultThe default limitMedium

The parameters of the model server are tuned with Optimize, on any machine that runs a model.

The executor rights

The executor of Kosken changes GPU settings only with the right gpu, and CPU and kernel settings only with the right os_tune. A person on the machine turns each one on:

sudo kosken-agent enable gpu
sudo kosken-agent enable os_tune

With the right gpu, the scan also tests each GPU setting by writing the value it has now, so it changes nothing. A setting that the driver refuses shows as Not available with the text of the driver.

To take a right away, run sudo kosken-agent disable gpu or sudo kosken-agent disable os_tune. A value that Kosken changed stays as it is; undo it before you take the right away, since the rollback needs it.

Apply, request approval, plan in a window

Each change runs as a maintenance with steps from the template Tune a GPU machine. The button of a row says how it runs:

  • Apply: a low-risk change. It starts now; the approval rules of the workspace decide whether a person approves it first.
  • Request approval: a medium-risk change. A person approves it before it runs.
  • Plan in a window: a change that takes effect at boot. It runs in a window you pick, with the reboot and a check after it.

To make several changes at once, tick their rows and select Plan the ticked changes. The plan has one approval, the steps in order, and a reboot only when a step needs it.

Each change keeps its value at boot. An optimization is Applied when the next scan reads the proposed value. If the maintenance fails, the row shows the error and you can try again.

Undo a change and dismiss an optimization

Each recipe saves the value before it changes it. The rollback of the maintenance writes that value back and stops setting the value at boot.

Kosken keeps a value at boot in one of three places, and the rollback removes its line or file:

  • /etc/sysctl.d/60-kosken-ai.conf: swappiness and NUMA balancing.
  • kosken-tune.service, which sets the values of /var/lib/kosken/exec/tune.json at boot: the CPU governor, transparent huge pages and the GPU settings.
  • /etc/default/grub.d/99-kosken-ai.cfg on Debian and Ubuntu, or grubby on Red Hat family systems: kernel boot parameters. The file is read after the others of that folder, so the GRUB settings of a cloud image do not drop the parameters.

Select Dismiss on a row you do not want, with an optional reason. It stays dismissed until its value changes; Open again brings it back. The History of the machine keeps every applied, dismissed, planned and failed optimization.

Where tuning works

The settings belong to the kernel and the driver of the machine that boots. A machine that shares its kernel, or that does not own its boot, cannot change them, and Kosken shows those rows as Not available with the reason.

Where the agent runsOS settingsKernel boot parametersGPU settings
A physical serverYesYesYes
A virtual machineYes, except the CPU governor, which the hypervisor managesYesYes, for a GPU given to the virtual machine (passthrough)
A cloud image (Ubuntu or Debian with cloud-init)YesYes, in the file of Kosken in /etc/default/grub.dYes
A container: LXC, Docker, Podman, a Kubernetes podNo: a container shares the kernel of its host, which keeps these files read-onlyNo: the host boots the kernelNo: the host driver owns the GPU
A node of a managed Kubernetes serviceNo: set them in the node pool, since the pool replaces the node

For a container, install the agent on the host and tune the host: every container on it gets the values. The model servers in containers are still tuned with Optimize.

A GPU with a fixed power limit, or a driver that refuses a setting, also shows Not available, with the text of the driver.

Something here does not match the app? Tell us