Streamlining CUB with a Single-Call API
AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.
Why it matters
CUDA 13.1's single-call CUB API removes the two-call boilerplate every CUDA developer currently writes, with zero measured performance overhead.
CUB is a library of ready-made GPU algorithms like sorting and counting, part of NVIDIA's CUDA toolkit for programming graphics processors. Traditionally, programmers had to call each function twice: once to ask how much scratch memory it needs, then again to run it after allocating that memory. CUDA 13.1 adds a one-call version that handles the memory automatically, staying just as fast. This mostly affects CUDA programmers, who no longer need wrapper code that many teams, including PyTorch, maintained.
NVIDIA's CUDA 13.1 adds a single-call interface to CUB, the GPU algorithm library underpinning sorting, scanning and histogram operations in performance-critical C++ code. The change eliminates the repetitive two-call pattern that production teams, including PyTorch, currently paper over with macros and wrappers. NVIDIA reports zero overhead versus the old method. Teams using CUDA can simplify their codebases now; the old two-phase API remains supported, so there is no forced migration.
CUB's new single-call API in CUDA 13.1 embeds temporary storage allocation inside each device primitive, defaulting to stream-ordered cudaMallocAsync so execution remains fully asynchronous. An environment (env) argument accepts memory resources, cuda::stream_ref streams, and future execution options like determinism guarantees via cuda::std::execution. Benchmarked normalized runtimes for ExclusiveSum show zero overhead versus the two-phase API. Limitation: devices lacking cudaMallocAsync support require an explicitly passed memory resource.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.