What Is a CUDA Stream? Design Work Ordering and Asynchronous Execution
A CUDA stream is a queue that expresses the **order and dependencies** of GPU work such as copies and kernel launches. Work in one stream executes in submission order; work in different streams has no defined order unless an event or another synchronization mechanism connects it. Multiple streams can request overlap among CPU work, transfers, and computation, but cannot guarantee concurrent execution. Overlap depends on GPU resources, copy engines, CUDA version, and implicit synchronization. This article covers CUDA C++ and the CUDA 13.5 documentation read on 2026-11-22. See NVIDIA’s [CUDA asynchronous-execution guide](https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/asynchronous-execution.html).
What Is a CUDA Stream? Design Work Ordering and Asynchronous Execution
A CUDA stream is a queue that expresses the order and dependencies of GPU work such as copies and kernel launches. Work in one stream executes in submission order; work in different streams has no defined order unless an event or another synchronization mechanism connects it. Multiple streams can request overlap among CPU work, transfers, and computation, but cannot guarantee concurrent execution. Overlap depends on GPU resources, copy engines, CUDA version, and implicit synchronization. This article covers CUDA C++ and the CUDA 13.5 documentation read on 2026-11-22. See NVIDIA’s CUDA asynchronous-execution guide.
What order does a stream guarantee?
When work is queued in one stream, a later operation in that stream waits for earlier work there. For example, submitting input copy → kernel → output copy to the same stream expresses that sequence without a separate event. But the CPU call returning is not the same as GPU work finishing. A host thread can continue after queuing asynchronous work; it must check completion before reading results or reusing buffers.
Same stream: [input copy] → [kernel] → [output copy]
submission order expresses the dependency
Different streams: [work in stream A] [work in stream B]
without an event/wait, their order is unspecified
actual overlap depends on GPU resources and the workA stream is not an operating-system thread or one GPU core. The runtime schedules ready work across streams; resource conflicts and serialization requirements can prevent overlap. Stream priority is a scheduling hint, not an ordering guarantee or a command to preempt running work. NVIDIA CUDA Stream Management API
How do events express cross-stream dependencies?
Use an event as a handoff point when work in one stream must finish before another stream continues. cudaEventRecord() places a marker after earlier work in the producer stream. cudaStreamWaitEvent() queues a wait in the consumer stream, so later work there waits for the event. This is different from host-blocking cudaEventSynchronize(): the stream wait connects GPU work while the CPU can prepare more work.
The example below assumes page-locked host input/output buffers and device allocations. processKernel is application-defined. Memory allocation, error handling, and the kernel implementation are omitted. This shows API order only; it was not compiled or run on a device.
// hInput and hOutput are page-locked host buffers.
// dInput and dOutput are device buffers; processKernel is application-defined.
cudaStream_t transfer, compute;
cudaEvent_t inputReady, computeDone;
cudaStreamCreateWithFlags(&transfer, cudaStreamNonBlocking);
cudaStreamCreateWithFlags(&compute, cudaStreamNonBlocking);
cudaEventCreateWithFlags(&inputReady, cudaEventDisableTiming);
cudaEventCreateWithFlags(&computeDone, cudaEventDisableTiming);
cudaMemcpyAsync(dInput, hInput, bytes, cudaMemcpyHostToDevice, transfer);
cudaEventRecord(inputReady, transfer);
cudaStreamWaitEvent(compute, inputReady, 0);
processKernel<<<grid, block, 0, compute>>>(dInput, dOutput);
cudaEventRecord(computeDone, compute);
cudaStreamWaitEvent(transfer, computeDone, 0);
cudaMemcpyAsync(hOutput, dOutput, bytes, cudaMemcpyDeviceToHost, transfer);
cudaStreamSynchronize(transfer); // hOutput is ready for the CPU after this pointThe two events mark “input copy finished” and “kernel produced the output.” The final synchronization on transfer makes the host wait until the queued copies and event wait are complete, including D2H. In a repeated pipeline, add per-buffer-slot ordering so a slot is not overwritten until its prior transfer and computation are done. Instead of calling cudaDeviceSynchronize() after every transfer, wait only for the stream or event the CPU actually needs.
| Needed relationship | Suitable mechanism | Effect on the host |
|---|---|---|
| Copy, then kernel in one flow | Queue both in the same stream | Host can continue after asynchronous submission |
| One stream needs a result from another | Record an event in the producer; call cudaStreamWaitEvent() in the consumer | Queues a device-side dependency without blocking the host thread |
| CPU must read one stream’s result | cudaStreamSynchronize(stream) or wait on its event | Calling thread waits for the selected work |
| All earlier work on the current device must finish | cudaDeviceSynchronize() | Broad wait across preceding device work |
Why does an asynchronous call not guarantee overlap?
“Asynchronous” means an API can queue work independently of the host thread; it does not mean the GPU finishes tasks simultaneously. NVIDIA says actual concurrency depends on CUDA and the hardware. For host-to-device or device-to-host copies, an unpinned host buffer may make the API fall back to synchronous behavior and limit overlap. Use pinned (page-locked) buffers when designing asynchronous CPU/GPU transfers. Do not change an input buffer before H2D finishes or read output before D2H completes. CUDA cudaMemcpyAsync reference
Check the default-stream rules too. Many calls that omit a stream use the default stream. The legacy default stream can introduce implicit waits with blocking streams in the same context, serializing a timeline even when explicit streams appear elsewhere. --default-stream per-thread or CUDA_API_PER_THREAD_DEFAULT_STREAM changes the behavior of the default stream per host thread. Also, “blocking/non-blocking” for streams created with cudaStreamCreate() versus cudaStreamNonBlocking mainly describes synchronization with the legacy default stream. The name does not tell you whether a host call blocks. Default-stream and synchronization rules
| Stream form | Typical behavior | What to check |
|---|---|---|
| Omit the stream argument or pass 0 | Submit to the configured default stream | Which default-stream mode the project/build uses |
cudaStreamCreate() | Create a stream with default flags | It may synchronize implicitly with the legacy default stream |
cudaStreamCreateWithFlags(..., cudaStreamNonBlocking) | Avoid implicit synchronization with the legacy default stream | Dependencies between this stream and others still need explicit ordering |
| Per-thread default-stream mode | Each host thread has its own default-stream behavior | Whether all translation units and libraries use a consistent build mode |
How should you design and verify streams?
Start with one explicit stream that copies input, runs a kernel, and copies output in the correct order. Then identify independent data chunks. Make sure their buffers can be used independently, add only the cross-stream event dependencies that the data requires, and inspect the GPU timeline to see whether copies and kernels actually overlap. If they do not, do not just add more streams: check pinned memory, data dependencies, available copy/compute resources, and synchronization calls. Nsight Systems can show GPU operations, copies, CUDA API calls, and waits; use it with end-to-end timing rather than inferring overlap from the number of streams.
**Write down dependencies.** List each copy and kernel’s inputs and outputs; mark which result must exist before each next operation.
**Make one stream correct first.** Express the sequence in one stream and wait for completion before the CPU reads the result.
**Move only independent work to other streams.** Connect any dependencies across streams with producer events and `cudaStreamWaitEvent()`.
**Respect buffer lifetimes.** Do not overwrite host input before asynchronous H2D finishes or read host output before D2H finishes. Page-locked host memory is needed for actual asynchronous copies.
**Compare timelines and total time.** In Nsight Systems, inspect GPU work, transfers, and CUDA waits; compare end-to-end application time with identical input. [Nsight Systems CUDA Analysis Guide](https://docs.nvidia.com/nsight-systems/AnalysisGuide/)
Use the following checks to narrow down common symptoms:
| Symptom | First causes to check | Safe diagnostic |
|---|---|---|
| Several streams but no overlap | Legacy default-stream waits, pageable host buffers, dependent work, or resource limits | Inspect stream 0, synchronization APIs, and copy ranges in the timeline; change one condition at a time |
| CPU reads too early or overwrites the next input | Treating API return as completion | Read or reuse the buffer only after the relevant stream/event completes |
| Work order is wrong after an event wait | Event recorded in the wrong producer stream or wait targets the wrong event | Compare each event record and stream wait with the data-dependency diagram |
| Small batches are slower | Frequent synchronization and submission overhead | Measure API and end-to-end time separately across work sizes |
The goal is not to create many streams. Express the necessary order, leave independent work free to proceed safely, then confirm any benefit in the GPU timeline and full application time.
Sources
[NVIDIA CUDA — Asynchronous Execution](https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/asynchronous-execution.html)
[NVIDIA CUDA Runtime API 13.5 — Stream Management](https://docs.nvidia.com/cuda/cuda-runtime-api/cuda_runtime_api/group__CUDART__STREAM.html)
[NVIDIA CUDA Runtime API 13.5 — Event Management](https://docs.nvidia.com/cuda/cuda-runtime-api/cuda_runtime_api/group__CUDART__EVENT.html)
[NVIDIA CUDA Runtime API 13.5 — Memory Management](https://docs.nvidia.com/cuda/cuda-runtime-api/cuda_runtime_api/group__CUDART__MEMORY.html)
[NVIDIA Nsight Systems — Analysis Guide](https://docs.nvidia.com/nsight-systems/AnalysisGuide/)