﻿# Metaflow GPU resources: a request needs a compute backend and a compatible runtime

Interpret Metaflow GPU resource declarations across local and remote runs without confusing accelerator count, model memory, backend placement and software availability.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-metaflow-gpu-resources-backend-runtime-contract/
Language: en

## A local run ignores the hoped-for reservation

An engineer adds a GPU requirement to a model step and launches the flow on a workstation. Another process still uses the accelerator, and the model exhausts available memory. The declaration did not create a new device or reserve local memory. Execution mode is part of the meaning of the requirement.

Start by recording where the task actually ran. A local process, a remote container and a pending remote task are distinct states. Debugging them all as model-memory failures hides the placement question.

## Bind requirements to a compute layer

The [resources reference](https://docs.metaflow.org/api/step-decorators/resources) documents the requirement decorator and its relationship to compute-layer decorators. The [GPU guide](https://docs.metaflow.org/scaling/remote-tasks/gpu-compute) explicitly distinguishes local runs from remote accelerator access.

Treat a local run as using the workstation resources available to its code. For remote execution, verify that the configured backend has eligible accelerator capacity. A requested count is a scheduling input rather than a report of what the application successfully initialized.

## Device count is not a memory specification

The [Kubernetes decorator reference](https://docs.metaflow.org/api/step-decorators/kubernetes) lists GPU count, vendor and placement-related options separately. A model's weight format, context length and working buffers still determine whether the assigned device is usable for the workload.

Do not read host-memory requirements as accelerator-memory capacity. [Reserved and allocated memory](/journal/cuda-oom-reserved-vs-allocated/) describe another layer inside the application runtime. A task can receive an accelerator and still fail during model loading or later inference.

## Validate software after placement

Check framework availability and actual device identity inside the running task. The selected container and installed packages must support the accelerator backend. A queued requirement cannot establish that a particular model kernel is available or that the correct runtime library is loaded.

For a small diagnostic, initialize the intended framework, load a controlled model artifact and perform a bounded inference. Preserve the runtime identity with the result so later failures can be compared against the same environment.

## Explain failures at their actual layer

Separate waiting for suitable capacity, container startup, dependency import, model loading and request execution. Each stage supplies different evidence and suggests a different next check.

Relate the final task to [CPU and GPU responsibilities](/journal/cpu-gpu-hybrid-architecture/) when preprocessing also consumes host resources. The resource request describes an execution envelope; a complete explanation still needs the software, data movement and memory behavior observed inside that envelope.
