Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Cuda

Functions and constants functions

Free functions and constants of Cuda.

On this page
Use
import ThinkMeta.ConcurrentTasks.Cuda.Await;
Namespace
ThinkMeta::ConcurrentTasks::Cuda
Platforms
Windows

Functions

Cuda::Await

Waits until the work queued so far on a CUDA stream has finished.

Syntax

template <typename Stream, typename Launch>
auto Await(Stream stream, Launch&& launch) noexcept;

Template parameters

Streamtypename
CUstream or cudaStream_t.
Launchtypename
A callable (Stream, HostFunction, void*) that returns the CUDA status: cuLaunchHostFunc or cudaLaunchHostFunc.

Parameters

streamStream
The stream; its kernels and copies have been queued before the call.
launchLaunch&&
Queues a host function on the stream.

Return value

Type: auto

The status of launch; a value other than success (0) means that nothing was queued and the function did not wait.

Remarks

Suspends the calling task until the stream reaches the queued host function; the scheduler thread runs other tasks meanwhile. The asynchronous counterpart of cuStreamSynchronize, which would block the thread. The status tells only whether the wait was queued. Errors of the work itself are fetched from CUDA after the wait. CUDA keeps its current context and device per thread, and a task may continue on another scheduler thread after the wait: give all scheduler threads the same context (SchedulerInfo::threadCallback), or set it again after the wait. Task or converted thread only. There is no timed variant.

See also

Synchronization::Await

Generated from ThinkMeta.ConcurrentTasks.API @ c7663c4 (2026-11-19).