Spark training gotchas

From mtecoYY/ai-baike · View interactive version

Spark training gotchas is an AI agent skill from the GitHub repository mtecoYY/ai-baike. Preflight and diagnose the ten known failure modes for ML training on NVIDIA DGX Spark. Use when a training run on DGX Spark fails to start, OOMs below the 128GB limit, slows down mid-run, or before any multi-hour training job on GB10.

How to use this skill

Skill file

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

segfault that doesn't point at the real cause.

strategy.

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

function, or a segfault on the first .cuda() call.

ships CUDA 13. pip never checks CUDA ABI, so it surfaces

only at import or first kernel launch.

CUDA build tag.

use a matched container.

G2: flash-attn — Skip the pip Build, Watch Unsloth's Auto-Detect

Unsloth may also silently train flash-attn over an

explicitly requested SDPA.

containers ship a working SM121 flash-attn, and Unsloth

auto-prefers it, dropping attn_implementation="sdpa".

already present and working.

NGC — the only reliable override is the monkeypatch in

references/gotcha-checks.md G2.

G3: UMA OOM Below 128GB

nvidia-smi still reports free memory under the 128GB cap

— or, on some setups, [N/A] outright instead of a number.

during safetensors load; QLoRA can OOM earlier than bf16

since dequantization adds transient allocs.

and /proc/meminfo, not nvidia-smi.

sync; echo 3 > /proc/sys/vm/drop_caches — needs root, a

between-run reset, not a mid-training step.

G4: Thermal Throttling

run, or the box spontaneously reboots under sustained load.

240W rated figure; long runs push into that ceiling and

throttle or, sometimes, reboot.

nvidia-smi --query-gpu=temperature.gpu,power.draw.

climbs, treat throttling as the cause; improve cooling or

cap run length.

G5: Bandwidth Ceiling

especially, plateau well below expected throughput.

measured bandwidth runs 180–192 GB/s.

time vs. the measured range, not spec.

built on the 273 GB/s figure.

G6: Global UMA Resource Contention

mid-run silently, no OOM in its own logs.

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.

G6 — other GPU-resident

processes and whether

capped.

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

NVFP4 on Spark makes it slower, not faster.

sm_121a; NVFP4 runs ~32% slower without it.

reports (12, 1); does the build target sm_121a?

G8: Stale Official Playbooks

fails, with no local misconfiguration explaining it.

the stack moves faster than the docs.

repo's recent issues.

before trusting a recipe for an expensive run.

G9: Container-First, Not Bare Pip

breaks after an unrelated pip install, or two "identical"

environments behave differently.

drift independently; nothing pins them to GB10's SM121

target.

G9 — container or bare pip?

for tag guidance) or Unsloth's container. If bare pip is

unavoidable, follow the NVIDIA install order, including

--no-deps on Unsloth.

G10: Dual-Spark Is DDP/FSDP Only

hangs, runs far slower than single-Spark, or errors out.

sync (DDP, FSDP) but too thin for TP's fine-grained traffic.

configured parallelism strategy.

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 failure
import 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  # G9

assets/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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.