Skip to content
Skillpedia
Deploy & cloud (DevOps)41k · #4853

spark-memory-thermal-ops

Helps your agent manage memory and temperature for long ML tasks. Useful for planning resources or when tasks fail due to memory or overheating.

What it does

This tool helps manage memory and temperature on powerful computers (DGX Spark) during long machine learning tasks. It ensures you have enough memory and that the computer doesn't overheat.

When to use it

  • ✓Before starting a long task, to know how much memory you will need.
  • ✓If your task fails due to lack of memory.
  • ✓To monitor temperature and power consumption during long tasks.

Example of what to ask your AI

“How can I know how much memory my machine learning task will use before it starts?”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/wshobson/agents/blob/main/plugins/dgx-spark-ops/skills/spark-memory-thermal-ops/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/dgx-spark-ops/skills/spark-memory-thermal-ops/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

It checks the total system memory available, not just the graphics card memory. It also monitors temperature and power to prevent the computer from slowing down or stopping.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add wshobson/agents --skill spark-memory-thermal-ops

Or download just the file:

curl -L https://raw.githubusercontent.com/wshobson/agents/main/plugins/dgx-spark-ops/skills/spark-memory-thermal-ops/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Spark Memory & Thermal Ops

DGX Spark's GB10 chip has one 128GB unified memory (UMA) pool shared by CPU and GPU, and a sustained power ceiling well below its rated figure. Both break discrete-GPU assumptions: headroom isn't what nvidia-smi reports, and a run that starts fast will slow down mid-job with nothing misconfigured. This skill covers planning memory headroom, working an actual OOM, and watching thermals across a long job. For launch-time failure modes (ABI mismatches, flash-attn, playbook breakage), see spark-training-gotchas — this skill assumes the job starts.

Common Issues Quick Reference

Situation Do this
Planning headroom before launch Budget against free -g, not nvidia-smi — see UMA Memory Model
Job OOMs on unified memory Work the OOM Ladder in order: flush, then batch/pack, then method downgrade
Throughput drops mid-run Check the power/temp log before assuming a config bug — see Thermal Monitoring
Trainer + inference server both wanted Run one at a time — see Concurrent Workloads

When to Use This Skill

  • Sizing a training run against the 128GB pool before launch — will this model, method, and batch/pack combination fit.
  • A run OOMs mid-load or mid-step and the remediation order matters — what to try first, second, third.
  • Watching temperature and power during a multi-hour job, deciding whether a slowdown is thermal throttling or something else.
  • Planning to run a trainer alongside an inference server (vLLM, Ollama) on the same box.

UMA Memory Model

Spark has no separate GPU VRAM — the GPU and CPU share one 128GB pool. Two consequences:

  • nvidia-smi and cudaMemGetInfo underreport pressure — or report nothing at all. Both report CUDA-allocator-visible memory, not the pool's actual state — a box can show headroom in nvidia-smi and still OOM, because page-cache and mmap'd pages the allocator doesn't see consume the same pool. On some driver/setups, the memory query returns [N/A], [N/A] outright instead of a number — a script grepping for a numeric value there gets nothing, not a misleading undercount (see spark-training-gotchas gotcha G3).

  • Model load is a transient peak, not the steady state. Loading safetensors weights mmaps the file, then copies into CUDA tensors — for a window during load, both the mmap'd pages and the CUDA copy count against the pool at once. A model that fits while training can still OOM during load if headroom was sized for the post-load footprint instead of this doubled transient.

Plan and diagnose with free -g, not nvidia-smi:

free -g | awk 'NR==2 {print "free:", $4, "GB"}'

Rule of thumb: take that free figure, subtract a few GB for OS/driver overhead, and budget against the result — not the 128GB spec number. The worksheet in references/uma-accounting.md accepts parameter count, dtype, and method as input, and returns a memory estimate to compare against known anchors.

Planning Sequence

Before launch, work through these in order:

  1. Read free -g; subtract OS/driver overhead for the budget.
  2. Estimate weights + optimizer + gradients + activations from references/uma-accounting.md.
  3. Compare against the closest anchor (70B QLoRA, 27B LoRA, 9B full FT), not the estimate alone.
  4. If the estimate is close to the budget, start with shorter packing or a smaller batch — cheaper than hitting the OOM Ladder mid-run.

Example: Sizing a 70B QLoRA Run

A sanity check of the worksheet formula against the ≈40GB anchor:

params = 70e9
weights_gb = params * 0.5 / 1e9      # NF4, step 1
adapter_gb = 0.5                     # step 5, negligible
total_gb = weights_gb + adapter_gb   # + activations
print(f"{total_gb:.0f}GB before activations")

Weights alone land near the ≈40GB anchor — a plan estimating far above that for the same model class is a signal to recheck dtype and method.

The OOM Ladder

When a job OOMs on unified memory, work this ladder in order. Each step is more disruptive than the last — don't skip ahead: reducing batch size is never step 1.

  1. Flush the buffer cache. Page cache from a previous run or a large dataset read often accounts for GB of the "missing" headroom. This costs nothing but a rerun and doesn't touch the job's configuration:

    sync; echo 3 > /proc/sys/vm/drop_caches
    

    Needs root; a between-run reset, not a

…

FAQ

Why doesn't `nvidia-smi` show the correct memory?

`nvidia-smi` only shows memory that the program can directly use. On DGX Spark, the CPU and GPU share the same memory, and other parts of the system also use this memory, which `nvidia-smi` doesn't show.

My task failed with 'OOM'. What should I do?

First, try to clear the memory cache. If that doesn't work, reduce the batch size or sequence length. If it still fails, consider using a simpler training method.

Why does my computer slow down during long tasks?

This could be due to overheating or because the computer is hitting its power limit. This tool helps monitor this so you know if it's a temperature issue or something else.

Details

Original description by the author

Manage unified memory and thermals during long-running ML jobs on NVIDIA DGX Spark. Use when planning memory headroom for a training run on GB10, when a job OOMs on unified memory, or when monitoring temperature and power during multi-hour training.

repo: wshobson/agents

Popularity

GitHub stars
41k
Ranking position
#4853
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills