Class CUDAStream

Page Contents

Class Documentation

class c10::cuda::CUDAStream

Public Types

enum Unchecked


enumerator UNCHECKED

Public Functions

CUDAStream(Stream stream)

Construct a CUDAStream from a Stream.

This construction is checked, and will raise an error if the Stream is not, in fact, a CUDA stream.

CUDAStream(Unchecked, Stream stream)

Construct a CUDAStream from a Stream with no error checking.

This constructor uses the “named” constructor idiom, and can be invoked as: CUDAStream(CUDAStream::UNCHECKED, stream)

bool operator==(const CUDAStream &other) const noexcept
bool operator!=(const CUDAStream &other) const noexcept
operator cudaStream_t() const

Implicit conversion to cudaStream_t.

operator Stream() const

Implicit conversion to Stream (a.k.a., forget that the stream is a CUDA stream).

DeviceIndex device_index() const

Get the CUDA device index that this stream is associated with.

Device device() const

Get the full Device that this stream is associated with.

The Device is guaranteed to be a CUDA device.

StreamId id() const

Return the stream ID corresponding to this particular stream.

bool query() const
void synchronize() const
int priority() const
cudaStream_t stream() const

Explicit conversion to cudaStream_t.

Stream unwrap() const

Explicit conversion to Stream.

uint64_t pack() const noexcept

Reversibly pack a CUDAStream into a uint64_t representation.

This may be helpful when storing a CUDAStream in a C struct, where you cannot conveniently place the CUDAStream object itself (which is morally equivalent, but unfortunately is not POD due to the fact that it has constructors.)

The CUDAStream can be unpacked using unpack(). The format of the uint64_t is unspecified and may be changed.

Public Static Functions

CUDAStream unpack(uint64_t bits)
std::tuple<int, int> priority_range()


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources