Depth, pose and most models run far faster on a GPU. Your algorithm asks for one in its interface, and every workflow step that runs it gets a GPU with at least the memory it asked for. Nothing else in your code changes.
Ask for a GPU
Add resources to the decorator, with the number of GPUs and the GPU memory in GB the algorithm needs:
@algorithm.enrich(
name="hand-boxes",
resources={"gpu": {"count": 1, "memoryGb": 8}},
# ... features, params
)The same resources can ask for cpu, memory, disk and a timeout. Every step gets at least 1 CPU and 2 GiB of memory, and a GPU step at least 8 GB of GPU memory, so a smaller request is raised to that; a step that asks for nothing gets 4 CPUs and 8 GiB. One step must fit one machine and one GPU: at most 24 GB of GPU memory.
An algorithm that asks for a GPU runs on the CUDA variant of the SDK base image, which already has torch and torchvision with the CUDA libraries; the driver comes from the machine. Don't add torch to Requirements.
How a built-in shows it
Built-in GPU algorithms say so in the catalog, and Resources on their page gives the exact need. Stereo depth, for example, needs "1 GPU, at least 9 GiB". Your algorithm's page and the Interface panel of the editor show what yours declares.
Waiting and refusals
A GPU step waits in the queue until a GPU with enough free memory is available, so a busy deployment can delay it. When the request can never be met, the step is refused by name rather than run on the CPU:
| Code | What it means | What to do |
|---|---|---|
ALGORITHM_SAMPLE_RUN_GPU_UNSUPPORTED | This deployment has no GPU, so a test run of a GPU algorithm cannot run. | Ask your admin to add a GPU, or use a version that runs without one. |
ALGORITHM_GPU_UNSATISFIABLE | The algorithm asks for more GPU memory than any GPU of this deployment has. | Ask for less GPU memory in resources, or ask your admin about a larger GPU. |
TEAM_GPU_EXCLUSIVE_UNAVAILABLE | On EmbodiFlow Cloud, code your team wrote runs only on a whole GPU that no other team shares, and none is available for what it asks. | Ask for a dedicated GPU, or use a version that runs without a GPU. |
ALGORITHM_SAMPLE_RUN_GPU_BUSY | A test run waited 10 minutes for GPU memory while other runs held the GPU. Nothing ran. | Try again in a few minutes. |
Test runs on a GPU
A test run of a GPU algorithm takes the same path as a workflow step. Before your code starts it may wait for GPU memory and for the CUDA image to download onto the machine, which can take several minutes the first time. Your code then has the usual 120 seconds.