Spark Training Gotchas
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Review and audit
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The spark-training-gotchas skill provides a structured approach to troubleshooting ML training jobs on NVIDIA DGX Spark (GB10) hardware. It categorizes ten recurring failure modes—ranging from CUDA ABI mismatches and thermal throttling to memory contention and bandwidth ceilings—that frequently cause training runs to fail, hang, or underperform. By mapping specific symptoms to actionable fixes, this skill helps developers avoid common pitfalls during long-running training sessions.
What it does
- Identifies ten specific failure modes (G1-G10) affecting DGX Spark training.
- Provides diagnostic commands to verify system state and identify potential bottlenecks.
- Offers specific remediation steps for environment, memory, and parallelism issues.
- Distinguishes between hardware-level constraints and software configuration errors.
- Includes a fast-triage reference for quick pre-run health checks.
- Clarifies the impact of containerized versus bare-pip environments on GB10 hardware.
When to use it
- Before starting any multi-hour or multi-epoch training job on GB10 hardware.
- When a training run fails to start with cryptic import errors or segmentation faults.
- When a job experiences unexpected OOM errors despite available memory headroom.
- When throughput degrades mid-run or the system exhibits thermal instability.
- When configuring multi-Spark parallelism strategies.
- When deciding between FP8 and NVFP4 precision for inference workloads.
Advantages
- Reduces downtime by surfacing known issues before they cause multi-hour job failures.
- Standardizes diagnostic procedures across different training environments.
- Provides clear, actionable fixes for complex hardware-specific behaviors.
- Helps developers avoid common pitfalls like incorrect parallelism strategies or ABI mismatches.
- Offers a reliable reference for distinguishing between software bugs and hardware limitations.
Usage examples
- “My training job on DGX Spark is crashing with an undefined symbol error. How do I check for CUDA ABI issues?”
- The agent will guide you to use the G1 diagnostic command to verify your CUDA version and check for library conflicts, suggesting a containerized environment or a specific PyTorch wheel as the fix.
- “I am getting an OOM error on my Spark node even though nvidia-smi shows plenty of free memory. What is happening?”
- The agent will explain the G3 unified memory issue, advising you to check host memory via free -g and suggesting a page cache reset to resolve the double-counting of memory pages.
- “Why is my two-Spark tensor-parallel training job hanging?”
- The agent will identify the G10 gotcha, explaining that tensor parallelism is not supported across two Sparks and recommending a switch to DDP or FSDP for multi-node training.
- “How can I quickly check if my Spark environment is healthy before a long run?”
- The agent will provide the fast-triage commands to verify CUDA capability, container status, and library versions, ensuring the environment meets the requirements for stable training.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wshobson/spark-training-gotchas/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip spark-training-gotchas.zip -d .agents/skills
Documentation by Seth Hobson
Spark Training Gotchas
DGX Spark's GB10 chip (Grace Blackwell, SM121, 128GB unified memory, aarch64) has ten recurring failure modes across launch, memory, thermals, bandwidth, and precision. Each is named G1–G10 so it can be checked by number — the numbering is load-bearing for tooling that runs these checks. Read this before a long run, not after hour six.
When to Use This Skill
A training run fails to start, with an import error or a segfault that doesn't point at the real cause.
A run OOMs while
nvidia-smistill shows headroom.Throughput degrades partway through a run that started fine.
Before any multi-hour or multi-epoch job on GB10.
Wiring two Sparks together, before picking a parallelism strategy.
Choosing between FP8 and NVFP4 for a Spark-hosted run.
Common Issues Quick Reference
| # | Symptom | Fix |
|---|---|---|
| G1 | undefined symbol / segfault | cu130 wheel or container |
| G2 | flash-attn wrong backend used | skip pip build; monkeypatch on NGC |
| G3 | OOM despite headroom | drop page cache |
| G4 | throughput drop / reboot | expect ~100W sustained cap |
| G5 | memory-bound step slow | budget 180–192 GB/s |
| G6 | cache evicted mid-run | one GPU server at a time |
| G7 | NVFP4 slower than FP8 | stay FP8 unless sm_121a |
| G8 | playbook fails outright | check upstream issues |
| G9 | env breaks after install | use a container |
| G10 | 2-Spark TP hangs | DDP/FSDP only, never TP |
The Ten Gotchas
G1: CUDA 12/13 ABI Mismatch
SYMPTOM:
ImportError: undefined symbolnaming a CUDA function, or a segfault on the first.cuda()call.CAUSE: most PyPI wheels link
libcudart.so.12; Spark ships CUDA 13. pip never checks CUDA ABI, so it surfaces only at import or first kernel launch.CHECK:
references/gotcha-checks.mdG1 — the wheel's CUDA build tag.FIX: reinstall from
download.pytorch.org/whl/cu130or use a matched container.
G2: flash-attn — Skip the pip Build, Watch Unsloth's Auto-Detect
SYMPTOM:
pip install flash-attnstill fails/hangs. Unsloth may also silently train flash-attn over an explicitly requested SDPA.CAUSE: no aarch64/sm_121 wheel for bare pip — but NGC containers ship a working SM121 flash-attn, and Unsloth auto-prefers it, dropping
attn_implementation="sdpa".CHECK:
references/gotcha-checks.mdG2 — is flash-attn already present and working.FIX: bare pip — skip flash-attn, use SDPA (unchanged). On NGC — the only reliable override is the monkeypatch in
references/gotcha-checks.mdG2.
G3: UMA OOM Below 128GB
SYMPTOM: OOM during model load/training while
nvidia-smistill reports free memory under the 128GB cap — or, on some setups,[N/A]outright instead of a number.CAUSE: mmap and the CUDA allocator double-count pages during safetensors load; QLoRA can OOM earlier than bf16 since dequantization adds transient allocs.
CHECK:
references/gotcha-checks.mdG3 — readfree -gand/proc/meminfo, notnvidia-smi.FIX: drop the page cache with
sync; echo 3 > /proc/sys/vm/drop_caches— needs root, a between-run reset, not a mid-training step.
G4: Thermal Throttling
SYMPTOM: throughput drops partway through a multi-hour run, or the box spontaneously reboots under sustained load.
CAUSE: sustained power draw caps around 100W versus the 240W rated figure; long runs push into that ceiling and throttle or, sometimes, reboot.
CHECK:
references/gotcha-checks.mdG4 — samplenvidia-smi --query-gpu=temperature.gpu,power.draw.FIX: if power plateaus under 240W while temperature climbs, treat throttling as the cause; improve cooling or cap run length.
G5: Bandwidth Ceiling
SYMPTOM: memory-bound workloads, decode-heavy RL loops especially, plateau well below expected throughput.
CAUSE: 273 GB/s is a spec ceiling, not sustained; measured bandwidth runs 180–192 GB/s.
CHECK:
references/gotcha-checks.mdG5 — observed step time vs. the measured range, not spec.FIX: budget throughput from 180–192 GB/s; revise a plan built on the 273 GB/s figure.
G6: Global UMA Resource Contention
SYMPTOM: a process's KV cache/weights get evicted mid-run silently, no OOM in its own logs.
CAUSE: unified memory is one global pool; an uncapped or near-capacity process competes with anything else and can evict it. A small, bounded workload doesn't — a <4GB LoRA coexists fine alongside vLLM capped at
gpu-memory-utilization<=0.5.CHECK:
references/gotcha-checks.mdG6 — other GPU-resident processes and whether capped.FIX: the one-heavy-job rule applies to uncapped or near-capacity workloads — cap or stop unrelated servers first. A small, capped workload need not stop.
G7: NVFP4 Slower Than FP8 on SM121
SYMPTOM: switching an inference workload from FP8 to NVFP4 on Spark makes it slower, not faster.
CAUSE: SM121 lacks
cvt.e2m1x2unless kernels targetsm_121a; NVFP4 runs ~32% slower without it.CHECK:
references/gotcha-checks.mdG7 — capability reports(12, 1); does the build targetsm_121a?FIX: stay on FP8 unless the build targets
sm_121a.
G8: Stale Official Playbooks
SYMPTOM: following an official DGX Spark playbook still fails, with no local misconfiguration explaining it.
CAUSE: official playbooks have shipped broken before; the stack moves faster than the docs.
CHECK:
references/gotcha-checks.mdG8 — the playbook repo's recent issues.FIX: check
github.com/NVIDIA/dgx-spark-playbooksissues before trusting a recipe for an expensive run.
G9: Container-First, Not Bare Pip
SYMPTOM: a bare-pip environment that worked yesterday breaks after an unrelated
pip install, or two "identical" environments behave differently.CAUSE: bare pip lets Triton, xformers, and transformers drift independently; nothing pins them to GB10's SM121 target.
CHECK:
references/gotcha-checks.mdG9 — container or bare pip?FIX: prefer an NGC container (see
spark-environment-setupfor tag guidance) or Unsloth's container. If bare pip is unavoidable, follow the NVIDIA install order, including--no-depson Unsloth.
G10: Dual-Spark Is DDP/FSDP Only
SYMPTOM: a tensor-parallel launch across two Sparks hangs, runs far slower than single-Spark, or errors out.
CAUSE: ConnectX-7 is fast enough for gradient/parameter sync (DDP, FSDP) but too thin for TP's fine-grained traffic.
CHECK:
references/gotcha-checks.mdG10 — the configured parallelism strategy.FIX: on a two-Spark setup, choose DDP or FSDP, never tensor parallelism — TP is single-node only here.
Fast Triage
The cheapest checks to run before anything else:
python3 -c "import torch; print(torch.version.cuda)" # expect 13.x (G1); NGC builds have no +cu130 tag — that's not a failureimport torch; print(torch.cuda.get_device_capability()) # expect (12, 1) (G7){ [ -f /.dockerenv -o -f /run/.containerenv ] || grep -qE 'docker|containerd' /proc/1/cgroup; } 2>/dev/null && echo container || echo unknown # G9assets/preflight.sh runs G1, G3, G4, G7, G9 and produces one
output line per gotcha in a fixed format: G-number first, then
PASS/FAIL/WARN where automatable, SKIP when unavailable, or
INFO: for a raw reading (G3, G4). Full commands:
references/gotcha-checks.md. See also
spark-environment-setup for the environment assumed working.
Files
- ATTRIBUTION.mdAdded by AutoGineer992 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md7.8 KiB
- assets/preflight.shScript2.4 KiB
- references/gotcha-checks.md9.4 KiB
references/gotcha-checks.md
Last verified: 2026-07-14 — refresh when CUDA, PyTorch, or the DGX Spark stack ships a new major version.
Runnable check commands for each gotcha in SKILL.md, keyed by
G-number. Run the check before assuming the gotcha is the cause;
each command is safe to run read-only unless noted.
G1: CUDA 12/13 ABI Mismatch
python3 -c "import torch; print(torch.version.cuda)"
python -c "import ctypes; ctypes.CDLL('libcudart.so.13')"
ldconfig -p | grep libcudarttorch.version.cuda is the authoritative signal: it should
report 13.x. Don't rely on pip show torch | grep cu130 — NGC
container builds (e.g. nvcr.io/nvidia/pytorch:25.11-py3) build
torch internally against CUDA 13 with no +cu130 wheel tag, so
the absence of a cu130 tag in pip show output is NOT a
failure by itself on those containers. The ctypes load
confirms libcudart.so.13 is actually present on the system; if
it raises OSError, the driver/runtime install is the problem,
not the wheel. ldconfig -p lists every CUDA runtime version
currently registered — a libcudart.so.12 entry alongside
libcudart.so.13 is a common leftover from an earlier install
and a likely ABI-mismatch source.
G2: flash-attn — Presence Check and the Unsloth Override
python -c "import flash_attn; print(flash_attn.__version__)" 2>&1 | tail -5
python -c "import torch; print(torch.backends.cuda.flash_sdp_enabled())"Don't assume this import fails — it depends on the environment.
On a bare-pip install it's expected to fail (no aarch64/
sm_121 wheel exists), confirming no training code path silently
depends on flash-attn. On an NGC PyTorch container
(confirmed on nvcr.io/nvidia/pytorch:25.09-py3), flash-attn
2.7.4.post1 ships pre-bundled and a live flash_attn_func
kernel call on GB10 (capability (12, 1)) executes successfully
with correct output shape — the "no sm_121 kernels" framing only
applies to building it yourself, not to what these containers
already carry.
The actual trap on a container with flash-attn present:
Unsloth's import-time patch banner reports FA2 = True and
auto-prefers flash-attn over SDPA — including when the caller
explicitly requested attn_implementation="sdpa". Unsloth's
loader (unsloth/models/llama.py, 2026.7.2) calls its internal
resolve_attention_implementation(...) without forwarding the
caller's attn_implementation as that function's
requested_attn_implementation parameter, then pops the kwarg
outright with a # No need since we auto call it comment —
silently discarding whatever was requested. Confirmed via a live
load: attn_implementation="sdpa" passed explicitly still
resolved to model.config._attn_implementation == "flash_attention_2".
The only working override on this Unsloth version, for any
model routed through Unsloth's llama-architecture loader
(unsloth/models/llama.py — this covers more than one base
model family; see finetuning-method-selection's model catalog
for which) when flash-attn is importable, is a monkeypatch
before calling from_pretrained:
import unsloth.models._utils as _unsloth_utils
_unsloth_utils.HAS_FLASH_ATTENTION = FalseThis forces resolve_attention_implementation's auto-resolution
down its elif supports_sdpa: branch instead of the flash-attn
branch — confirmed working (config._attn_implementation == "sdpa" after the monkeypatch). On plain TRL/PEFT (bypassing
Unsloth entirely — see lora-qlora-recipes'
references/unsloth-trl-mapping.md escape hatch),
attn_implementation="sdpa" passed to
AutoModelForCausalLM.from_pretrained is honored correctly;
this gap is Unsloth-specific, not a general TRL/transformers
issue.
G3: UMA OOM Below 128GB
free -g
cat /proc/meminfo | grep -i hugeRead real memory pressure from free -g, not nvidia-smi —
unified memory means CUDA allocations and host RAM share one
pool, and nvidia-smi only reports the CUDA side. On some
driver/setup combinations, nvidia-smi --query-gpu=memory.used, memory.total --format=csv doesn't just undercount — it returns
[N/A], [N/A] for the whole-GPU memory query outright. A script
that greps for a numeric value there gets nothing, not a
misleading number; don't build a headroom check on that query on
this hardware. If free -g shows most of the 128GB consumed
while a load is failing, reclaim it:
sync
echo 3 > /proc/sys/vm/drop_cachesThis needs root and flushes the page cache system-wide — every process on the box loses cached file reads, not just the training job. Run it between runs when memory looks pinned by stale mmap'd pages, not as a routine step during training.
G4: Thermal Throttling
nvidia-smi --query-gpu=temperature.gpu,power.draw --format=csv -l 5Sampling loop (-l 5 = every 5 seconds); let it run for at
least 10–15 minutes on a representative workload before judging.
Rated power is 240W; if draw plateaus around 100W while
temperature keeps climbing or has already plateaued high, the
box is throttling. A rising temperature with power still near
peak is not yet a throttle event — keep watching. Interrupt with
Ctrl-C when done; this does not need root.
G5: Bandwidth Ceiling
Intrusive, unlike the other checks in this file — do not run against an active workload. It allocates ~4GB on a UMA system where GPU and host memory share one pool, and repeatedly clones that tensor. Run only on an idle host; a box with another job already using most of its 128GB headroom can OOM that job.
python -c "
import torch, time
x = torch.randn(1_000_000_000, device='cuda', dtype=torch.float32)
torch.cuda.synchronize()
t0 = time.time()
for _ in range(20):
y = x.clone()
torch.cuda.synchronize()
dt = time.time() - t0
gbps = (x.numel() * 4 * 2 * 20) / dt / 1e9
print(f'{gbps:.1f} GB/s')
del x, y
torch.cuda.empty_cache()
"Expect roughly 180–192 GB/s, not the 273 GB/s spec figure. If a throughput plan assumed the spec number, revise it against this measured range before committing to a schedule.
G6: Global UMA Resource Contention
nvidia-smi
ps aux | grep -E "vllm|ollama|python.*train" | grep -v grepList every GPU-resident process before starting a long run.
nvidia-smi shows per-process memory; the ps filter catches
inference servers (vLLM, Ollama) that may not show up clearly in
nvidia-smi output on unified memory. The one-heavy-job rule
applies to uncapped or near-capacity workloads — stop
unrelated servers before a run that needs the full 128GB pool,
or that runs alongside another process without an explicit
memory cap. It does not apply to small, memory-capped
coexistence: a <4GB LoRA fine-tune has been observed running
cleanly alongside a vLLM server started with
--gpu-memory-utilization 0.5 (or lower) on the same box — check
the other process's own memory cap, not just its presence,
before deciding whether it needs to be stopped.
G7: NVFP4 Slower Than FP8 on SM121
python -c "import torch; print(torch.cuda.get_device_capability())"Expect (12, 1) on GB10 — this confirms SM121. SM121 lacks a
native cvt.e2m1x2 conversion path, so NVFP4 kernels not
compiled for the sm_121a target fall back to a slower path,
roughly 32% behind FP8. Check the kernel build's target arch
(often TORCH_CUDA_ARCH_LIST or a similar build flag) before
assuming NVFP4 is the faster choice on this hardware.
G8: Stale Official Playbooks
gh issue list --repo NVIDIA/dgx-spark-playbooks --state open --limit 20Requires the gh CLI authenticated, or substitute a browser
visit to the same URL. Scan open issues for the specific
playbook and command being followed before trusting it verbatim
for a long or expensive run.
G9: Container-First, Not Bare Pip
if [ -f /.dockerenv ] || [ -f /run/.containerenv ]; then
echo "in container (marker file)"
elif grep -qE '(docker|containerd|kubepods)' /proc/1/cgroup 2>/dev/null; then
echo "in container (cgroup marker)"
else
echo "unknown — no container marker matched, this does not prove a bare host"
fi
pip list 2>/dev/null | grep -E "^(torch|triton|xformers|transformers) "The first block checks Docker's /.dockerenv and Podman's
/run/.containerenv marker files, then falls back to a
cgroup-string check — a single grep docker /proc/1/cgroup alone
is not reliable: cgroup v2 layouts and some runtimes/namespaces
hide the runtime name, so a failed match is "unknown," never proof
of a bare host. The second command lists the versions actually
installed — compare against the pinned set in an NGC or Unsloth
image if running bare pip, to catch drift early rather than at
import time.
G10: Dual-Spark Is DDP/FSDP Only
python -c "
import os
print('WORLD_SIZE:', os.environ.get('WORLD_SIZE'))
print('parallelism strategy check: confirm config uses DDP or FSDP, not TP/tensor_parallel')
"
rg -l --iglob '*.yaml' --iglob '*.yml' -e 'tensor_parallel|tp_size|tensor-parallel' . \
|| grep -rlE "tensor_parallel|tp_size|tensor-parallel" --include='*.yaml' --include='*.yml' .Search recursively, not just the current directory — a
non-recursive *.yaml *.yml glob misses nested configs, and a
redirected/suppressed error there reads as "no TP configuration"
when it may just be "wrong directory." If the workload's config
path is already known, pass it explicitly instead of searching.
Any match on a two-Spark job is a configuration error — switch to
DDP or FSDP before launching; TP is not viable across the
ConnectX-7 link on this hardware.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python, Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/dgx-spark-ops/skills/spark-training-gotchas · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download spark-training-gotchas.zip