ASD

Spark Environment Setup

Configura un entorno de entrenamiento/inferencia de ML en NVIDIA DGX Spark (GB10, aarch64, CUDA 13): instalación de PyTorch/Unsloth/TRL/vLLM, errores ABI de libcudart y NGC vs pip.

Estrellas
38.8k

en todo el repo

Actividad
56

0–100, la ruta de este skill

Actualizado
el mes pasado

último commit aquí

Commits
1

últimos 90 días

Contexto
2k tok

66 tok en reposo

Paquete
3 archivos

19 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add wshobson/agents --skill spark-environment-setup --agent claude-code

Se instala solo en este repositorio.

Qué hace

  • Guía la instalación de PyTorch/Unsloth/TRL/vLLM en DGX Spark (GB10, aarch64, CUDA 13)
  • Recomienda usar contenedores NGC/Unsloth antes que pip directo
  • Da la secuencia exacta de pip install con versiones fijadas cuando el contenedor no aplica
  • Diagnostica errores de ABI entre CUDA 12/13 (libcudart, símbolos indefinidos)
  • Incluye comandos de verificación para confirmar que el entorno ve la GPU correctamente

Úsalo cuando

  • Configurar una Spark box nueva para entrenamiento o inferencia
  • Aparece un error de importación con libcudart, un símbolo faltante o un wheel que no carga
  • Falla, se cuelga o cae a CPU una instalación de PyTorch, Unsloth, TRL, vLLM o xformers
  • Decidir entre usar un contenedor NGC o pip directo, o restaurar el entorno tras reinstalar el SO

No lo uses cuando

    Qué lo activa

    Di cualquiera de estas frases y el agente debería cargar este skill.

    • Configura el entorno de PyTorch en mi DGX Spark
    • Me da un error de libcudart al importar torch en aarch64
    • ¿Uso el contenedor NGC o pip para instalar Unsloth en Spark?

    SKILL.md

    En inglés

    Spark Environment Setup

    DGX Spark ships a GB10 Grace Blackwell chip: aarch64 CPU, SM121 GPU, 128GB unified memory, CUDA 13. This is a narrower and younger platform than a standard x86 CUDA 12 box, so package selection and ABI matching matter more than usual — the wheel ecosystem for aarch64 + CUDA 13 is still filling in.

    When to Use This Skill

    • Setting up a fresh Spark box for training or inference.
    • Hitting an import error mentioning libcudart, a missing symbol, or a wheel that "installed fine but won't load."
    • A framework install (PyTorch, Unsloth, TRL, vLLM, xformers) fails, hangs, or silently falls back to CPU.
    • Deciding whether to use an NGC container or bare pip.
    • Restoring a working setup after an OS reinstall or a base-image update, needing to re-verify from scratch.

    Each of these accepts the same general fix: match the container/wheel combination to CUDA 13 and SM121, don't fight the ABI.

    Container-First Rule

    Quick decision, before the detail below:

    • Standard training/inference work → NGC PyTorch container.
    • Unsloth-centric fine-tuning → Unsloth container (it ships the pinned Triton/xformers/transformers combination already validated for that path).
    • Neither fits (custom system package, local IDE interpreter) → bare pip, following the exact sequence further down.

    Default to a container. Use nvcr.io/nvidia/pytorch:25.09-py3 as the base for general work — the newest tag confirmed working on this hardware; pull a newer blessed tag if locally available rather than hard-blocking on 25.11-py3. NGC's tag is dated, so running it directly is fine:

    docker run --runtime=nvidia --gpus all -it --rm \
      nvcr.io/nvidia/pytorch:25.09-py3
    

    unsloth/unsloth:dgxspark-latest is a moving tag by contrast — resolve and pin its digest before running it for anything reproducible; the bare tag is a discovery step only, not the default invocation. Full pull-inspect-pin sequence and flag rationale/volume mounts for finetuning/ run dirs: references/container-workflow.md. Treat bare pip as the exception.

    The reason for the container-first stance is pinning, not convenience. Triton, xformers, and transformers versions interact narrowly with GB10's SM121 target and CUDA 13; a container locks all of them together against a combination already validated on this hardware. Bare pip leaves that resolution to you, one broken import at a time.

    When bare pip is warranted, follow the NVIDIA playbook's install sequence verbatim and in order:

    pip install "transformers==5.13.1" "peft==0.19.1" "hf_transfer==0.1.9" "datasets==4.3.0" "trl==1.8.0"
    pip install --no-deps "unsloth==2026.7.2" "unsloth_zoo==2026.7.2" "bitsandbytes==0.49.2"
    pip install -U "torchao==0.17.0"
    

    The second command's --no-deps flag is not optional — letting pip re-resolve Unsloth's dependency tree on aarch64 is a common way to pull in an incompatible torch or triton build. The third line is not optional either: the NGC base image's bundled torchao is too old for current peft's LoRA-attach path (ImportError: ... torchao ... only versions above 0.16.0 are supported) — a hard blocker, not a warning. Every == pin above is load-bearing, taken from the dated known-good version matrix in references/stack-matrix.md (its Last verified date governs staleness) — an unpinned install resolves current PyPI versions well outside what this Unsloth release supports.

    Pull a fresh tag when a new blessed release is announced. Rebuild locally from one of the two bases only when a project needs an extra system package layered in — not to "upgrade" a component the image already pins. Details on both paths: references/container-workflow.md.

    One more preflight: official DGX Spark playbooks have shipped broken before. Check recent issues on github.com/NVIDIA/dgx-spark-playbooks (and the other resources in references/stack-matrix.md) before trusting a recipe verbatim for a long run.

    The ABI Rule

    The single most common failure on Spark is a CUDA 12/13 ABI mismatch: a wheel built against libcudart.so.12 loaded on a system that only has libcudart.so.13. The install usually succeeds; the failure surfaces later as a missing-symbol error or a segfault that doesn't obviously point at CUDA.

    Fix: pull wheels from download.pytorch.org/whl/cu130 (the cu130-tagged aarch64 builds), or use one of the containers above, which already carry a matched build. Before chasing a stack trace that mentions a CUDA symbol, check which CUDA tag the installed wheel was built against:

    python3 -c "import torch; print(torch.version.cuda)"
    

    If that output doesn't start with 13, the ABI mismatch is the first thing to fix. NGC container builds (e.g. nvcr.io/nvidia/pytorch:25.09-py3) build torch internally against CUDA 13 with no +cu130 wheel tag — pip show torch won't say cu130 there, and that absence alone is not a failure.

    Typical symptoms:

    • ImportError: undefined symbol referencing a CUDA runtime function.
    • A segfault on the first .cuda() call, no useful traceback.
    • A wheel that installs cleanly, then fails at import time — pip's resolver doesn't check CUDA ABI, only version constraints.
    • Two "identical" environments behaving differently — usually one has a cu130 wheel, the other a cu121/cu124 leftover.

    The fix is the same regardless of symptom: match the wheel's CUDA tag to the system, or use a container that already does.

    Component Quick Table

    Condensed status for the components most likely to come up. Full table with wheel URLs, build flags, the sm_121 vs sm_121a distinction, and the dated known-good version matrix: references/stack-matrix.md.

    Component Status
    PyTorch ✅ official cu130 aarch64 wheels
    bitsandbytes ✅ works out of the box
    Triton ✅ needs the TRITON_PTXAS_PATH parameter set
    flash-attn ❌ skip pip build; NGC bundles a working one — see spark-training-gotchas G2
    xformers source build only (TORCH_CUDA_ARCH_LIST=12.1)
    vLLM nightly wheels only
    TransformerEngine / NVFP4 train container-only

    Everything else — Unsloth, Axolotl, TRL, PEFT — installs cleanly through the container-first path above. LLaMA-Factory and NeMo are fragile on Spark; check upstream issues first.

    Verification Commands

    Confirm the environment can actually see the GPU before running anything expensive:

    import torch
    print(torch.cuda.is_available(), torch.version.cuda)
    

    This call returns two values; the exact output format is one line, <bool> <cuda-version>:

    True 13.0
    

    If it prints False instead, don't jump straight to a wheel reinstall — ABI mismatch is one cause among several:

    Hypothesis Quick check
    Runtime/flags nvidia-smi fails in-container too
    Device visibility echo $CUDA_VISIBLE_DEVICES
    Permissions ls -l /dev/nvidia*
    CUDA init state wedged process; retry fresh shell/container
    ABI mismatch (usual culprit) torch.version.cuda not 13.x

    Check nvidia-smi first — if it doesn't show the GPU, it's one of the first three, not ABI. Reinstall a wheel only once ABI is confirmed. Per-hypothesis detail: references/stack-matrix.md. Run right after the container starts, before installing project-specific packages.

    One more check: if Triton kernel compilation fails once training starts, set TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas and retry — see references/stack-matrix.md for the full workaround list.

    Next Steps

    A verified environment is only the starting point. See also: spark-training-gotchas for failure preflights before a training run, and spark-memory-thermal-ops for unified-memory OOMs and thermal throttling during long ones.

    Reproducido de wshobson/agents bajo licencia MIT. Leer esta página en markdown.

    Archivos

    3 archivos en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

    Antes de instalar

    Requiere acceso a una máquina DGX Spark (GB10, aarch64, CUDA 13) y, para la vía contenedor, Docker con runtime nvidia.

    Necesita en el PATH:dockerpippython3

    Detalles

    Creador
    wshobson
    Licencia
    MIT
    Recursos incluidos
    referencias
    Repositorio
    wshobson/agents
    Código fuente
    Ver SKILL.md

    Etiquetas

    Más de wshobson/agents

    Este repo incluye 180 skills. Si instalas uno, normalmente ya tienes los demás.

    Úsalo al seleccionar y colocar iconos, imágenes, SVGs, diagramas o infografías de apoyo aprobados en un PPTX editable.

    Costo de contexto al activarse
    344 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 26 días
    documentos

    Úsalo cuando pidan optimizar un prompt, mejorar su rendimiento, diseñar una plantilla, aplicar chain-of-thought, few-shot prompting o técnicas avanzadas de prompt engineering para producción.

    Costo de contexto al activarse
    1.3k tok
    Tamaño del paquete
    10 archivos
    Última actualización
    el mes pasado
    herramientas desarrollo

    Úsalo al redactar o reparar una especificación JSON con coordenadas explícitas para un PPTX editable.

    Costo de contexto al activarse
    489 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 26 días
    documentos

    Úsalo para validar o reparar un PPTX editable en cuanto a geometría, accesibilidad, editabilidad nativa, linaje de fuente e integridad del paquete OOXML.

    Costo de contexto al activarse
    409 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 26 días
    documentos

    Úsalo para analizar un PPTX de referencia en modo solo lectura: estructura, tema, tipografía, ritmo de layout, diagnósticos, catálogos de plantillas derivados o inspección segura del paquete OOXML.

    Costo de contexto al activarse
    689 tok
    Tamaño del paquete
    8 archivos
    Última actualización
    hace 26 días
    documentos

    Úsalo al preparar la narrativa, las fuentes y el contexto de diseño para un nuevo deck PPTX editable.

    Costo de contexto al activarse
    415 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 26 días
    documentos

    Skills relacionados

    Configura Turborepo para builds de monorepo eficientes con caché local y remota. Útil al configurar Turborepo, optimizar pipelines de build o implementar caching distribuido.

    Costo de contexto al activarse
    2k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 5 meses
    devops infraestructura

    Implementa observabilidad integral para service meshes, incluyendo tracing distribuido, métricas y visualización. Útil para monitoreo de mesh, depuración de latencia y SLOs.

    Costo de contexto al activarse
    708 tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 2 meses
    devops infraestructura

    Define e implementa Indicadores (SLI) y Objetivos (SLO) de nivel de servicio con error budgets y alertas, para establecer metas de fiabilidad y prácticas SRE.

    Costo de contexto al activarse
    1.8k tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 2 meses
    devops infraestructura