---
title: "Control How Your GPU Shares Work with Green Contexts"
description: "Green contexts, available in the CUDA Driver API since 12.4 and the Runtime API since 13.1, let applications explicitly partition GPU execution resources such as SMs and workqueues. They are lightweight to create and destroy, do not implicitly synchronize unrelated work, and allow provisioning workqueues to reduce false dependencies. Streams are created from a green context rather than relying on implicit device state, making targeting explicit. Benchmarks on a Blackwell GPU show a critical kernel completing in 0.007 ms with green context partitioning, compared to 0.140 ms with high-priority streams and 3.727 ms with equal priority. The tradeoff is fewer SMs for the bulk workload, but green contexts are opt-in and can be adopted incrementally alongside existing CUDA code."
---

# Control How Your GPU Shares Work with Green Contexts

[NVIDIA](https://yomu.fyi/company/nvidia-developer-blog) · Elizabeth Goodman · Oct 6, 2026

**Type:** Explainer

## Summary

Green contexts, available in the CUDA Driver API since 12.4 and the Runtime API since 13.1, let applications explicitly partition GPU execution resources such as SMs and workqueues. They are lightweight to create and destroy, do not implicitly synchronize unrelated work, and allow provisioning workqueues to reduce false dependencies. Streams are created from a green context rather than relying on implicit device state, making targeting explicit. Benchmarks on a Blackwell GPU show a critical kernel completing in 0.007 ms with green context partitioning, compared to 0.140 ms with high-priority streams and 3.727 ms with equal priority. The tradeoff is fewer SMs for the bulk workload, but green contexts are opt-in and can be adopted incrementally alongside existing CUDA code.

## Approach / What changed

Applications create a green context by querying device resources, partitioning SMs and workqueues using cudaDevSmResourceSplit and cudaDevResourceGenerateDesc, then creating streams with cudaExecutionCtxStreamCreate and submitting work as usual. The green context isolates the targeted work to the assigned resources.

## Takeaways

- Green contexts allow explicit SM partitioning, enabling latency-sensitive kernels to run on dedicated SMs without waiting for bulk kernel blocks to drain, achieving sub-millisecond latency (0.007 ms vs 0.140 ms with stream priority alone on Blackwell GPU).
- Green contexts also provision workqueue resources to reduce false dependencies between independent stream-ordered workloads, avoiding unintended serialization even when sufficient execution resources are available.
- Green contexts are opt-in and additive; existing CUDA applications can continue to target the full device unchanged and adopt green contexts incrementally where finer control over execution is needed.

## FAQ

### How do green contexts differ from stream priorities for isolating critical work?

Stream priorities cannot preempt blocks already executing on SMs, so a high-priority kernel must wait for bulk kernel blocks to drain. Green contexts partition SMs, dedicating specific SMs to the critical kernel so it starts immediately without waiting.

### What CUDA versions support green contexts in the Runtime API?

Green contexts have been available in the Driver API since CUDA 12.4. Starting with CUDA 13.1, they are also accessible through the Runtime API via cudaGreenCtxCreate and cudaExecutionCtxStreamCreate.

### Can green contexts be used alongside existing CUDA code without changes?

Yes, green contexts are opt-in and additive. Existing applications can continue to target the full device unchanged and adopt green contexts incrementally where finer control over execution is needed.

**Tags:** [CUDA](https://yomu.fyi/topic/cuda), [GPU](https://yomu.fyi/topic/gpu), [Performance](https://yomu.fyi/topic/performance)

- Source: [NVIDIA](https://developer.nvidia.com/blog/control-how-your-gpu-shares-work-with-green-contexts)
- Source URL: https://developer.nvidia.com/blog/control-how-your-gpu-shares-work-with-green-contexts
- Ingested by Yomu: 2026-10-06T18:00:12.384Z

[Read original post](https://developer.nvidia.com/blog/control-how-your-gpu-shares-work-with-green-contexts)
