Skip to content

task run: sizes GPU families and runs --gpus all, but has no way to select a GPU AMI (no --ami flag, no TaskSpec field) → driverless host, NVML fails at runtime #601

Closed

Description

@scttfrdmn

Version: spawn 0.106.0

Summary

spawn task run --spec will size a GPU instance and run docker run --gpus all, but has no way to select a GPU-capable AMI — no --ami flag, and no AMI/OS field in the TaskSpec. It resolves the default (non-GPU) AL2023 AMI, so the container's --gpus all lands on a host with no NVIDIA driver and GPU init (NVML) fails at runtime, inside the container, after a clean-looking launch.

This is the task run analog of #356 / #384, but those were both on the launch path — and launch has an --ami escape hatch (passing --ami <DLAMI> explicitly works; that is the current workaround). The task run / TaskSpec path has no escape hatch at all.

Reproduction

task run's own help states it passes GPUs through:

If spec.container is set, the command runs inside that image ... GPUs passed with --gpus all.

and sizes via truffle:

Sizes the cheapest instance type that fits the resource request (via truffle)

A spec requesting a GPU family:

{
  "task_id": "gpu-ami-repro",
  "command": ["bash","-c","nvidia-smi"],
  "container": "nvcr.io/hpc/gromacs@sha256:d1ed1e13...",
  "resources": {"cpu": 8, "memory_gib": 32, "families": ["g5"]},
  "lifecycle": {"ttl": "10m", "on_complete": "terminate", "cost_limit": 0.3}
}
$ spawn task run --spec gpu_repro.json --region us-west-2 --dry-run
Task:         gpu-ami-repro
Instance:     g5.2xlarge  (8 vCPU, 32 GiB, $1.2120/hr on-demand)
              chosen as cheapest of 7 matching type(s)
Root disk:    AMI default (resources.disk_gib not set; ...)

So truffle correctly sizes a g5.2xlarge (a GPU box), and the AMI is "AMI default" — the non-GPU AL2023 (same driverless AMI #356 describes). docker run --gpus all on that host cannot initialize the GPU.

The full task run flag set confirms there is no override:

--dry-run  --poll-interval  --region  --spec  --wait

No --ami. And the TaskSpec resources block (cpu, memory_gib, architecture, families, and instance_type per #413) has no AMI/OS field.

Ask

Any one of these closes the gap, in rough order of preference:

  1. Auto-resolve a GPU-capable AMI (DLAMI / AL2023-NVIDIA) on the task run path when the sized instance is a GPU family — mirroring whatever fixed the launch path in GPU AMI auto-select broken: DetectGPUInstance misses g6e/g7/g7e; GPU AL2023 SSM param does not exist #356/launch: auto-AMI fails for GPU instance types (ParameterNotFound) despite docs claiming GPU-variant detection #384.
  2. Add an AMI field to the TaskSpec (e.g. resources.ami or resources.image_os: gpu) so a spec can pin the DLAMI the way launch --ami does — this also gives task run parity with launch generally, not just for GPU.
  3. At minimum, fail fast with a clear message when a spec sizes a GPU family with a container and no GPU AMI is available ("GPU task-runs need a GPU AMI; TaskSpec has no AMI field — use spawn launch --ami for now"), instead of booting the wrong AMI and failing at runtime inside the container.

Workaround (in use)

Run the GPU workload via spawn launch <name> --ami <DLAMI> --command 'docker run --gpus all ...' instead of task run. Works, but it is the raw-instance path — it loses the TaskSpec staging/completion/sizing model that task run exists to provide, so GPU recipes can't use the same shape as every CPU recipe until task run can reach a GPU AMI.

Activity

  1. scttfrdmn commented on Sep 17, 2026

    @scttfrdmn
    ContributorAuthor

    Real-GPU validation of the fix (spawn v0.111.0, g5.xlarge/us-west-2) confirmed the AMI selection is now correct — the instance boots on the AL2023 NVIDIA DLAMI and --dry-run shows it explicitly. But the end-to-end GPU-in-container path still fails: docker run --gpus all doesn't inject the driver, so nvidia-smi isn't in the container (exit 127). Root cause: the host is missing the NVIDIA Container Toolkit. Tracked as #606 (the runtime follow-on). #605 stands as the AMI-selection + visibility fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions