PyTorch
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | List of all members
c10::cuda::CUDAStream Class Reference

#include <CUDAStream.h>

Public Types

enum  Unchecked { UNCHECKED }
 

Public Member Functions

 CUDAStream (Stream stream)
 Construct a CUDAStream from a Stream. More...
 
 CUDAStream (Unchecked, Stream stream)
 Construct a CUDAStream from a Stream with no error checking. More...
 
bool operator== (const CUDAStream &other) const noexcept
 
bool operator!= (const CUDAStream &other) const noexcept
 
 operator cudaStream_t () const
 Implicit conversion to cudaStream_t. More...
 
 operator Stream () const
 Implicit conversion to Stream (a.k.a., forget that the stream is a CUDA stream). More...
 
DeviceType device_type () const
 Used to avoid baking in device type explicitly to Python-side API. More...
 
DeviceIndex device_index () const
 Get the CUDA device index that this stream is associated with. More...
 
Device device () const
 Get the full Device that this stream is associated with. More...
 
StreamId id () const
 Return the stream ID corresponding to this particular stream. More...
 
bool query () const
 
void synchronize () const
 
int priority () const
 
cudaStream_t stream () const
 Explicit conversion to cudaStream_t. More...
 
Stream unwrap () const
 Explicit conversion to Stream. More...
 
struct c10::StreamData3 pack3 () const
 Reversibly pack a CUDAStream into a struct representation. More...
 

Static Public Member Functions

static CUDAStream unpack3 (StreamId stream_id, DeviceIndex device_index, DeviceType device_type)
 
static std::tuple< int, int > priority_range ()
 

Member Enumeration Documentation

◆ Unchecked

Enumerator
UNCHECKED 

Constructor & Destructor Documentation

◆ CUDAStream() [1/2]

c10::cuda::CUDAStream::CUDAStream ( Stream  stream)
inlineexplicit

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() [2/2]

c10::cuda::CUDAStream::CUDAStream ( Unchecked  ,
Stream  stream 
)
inlineexplicit

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)

Member Function Documentation

◆ device()

Device c10::cuda::CUDAStream::device ( ) const
inline

Get the full Device that this stream is associated with.

The Device is guaranteed to be a CUDA device.

◆ device_index()

DeviceIndex c10::cuda::CUDAStream::device_index ( ) const
inline

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

◆ device_type()

DeviceType c10::cuda::CUDAStream::device_type ( ) const
inline

Used to avoid baking in device type explicitly to Python-side API.

◆ id()

StreamId c10::cuda::CUDAStream::id ( ) const
inline

Return the stream ID corresponding to this particular stream.

◆ operator cudaStream_t()

c10::cuda::CUDAStream::operator cudaStream_t ( ) const
inline

Implicit conversion to cudaStream_t.

◆ operator Stream()

c10::cuda::CUDAStream::operator Stream ( ) const
inline

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

◆ operator!=()

bool c10::cuda::CUDAStream::operator!= ( const CUDAStream other) const
inlinenoexcept

◆ operator==()

bool c10::cuda::CUDAStream::operator== ( const CUDAStream other) const
inlinenoexcept

◆ pack3()

struct c10::StreamData3 c10::cuda::CUDAStream::pack3 ( ) const
inline

Reversibly pack a CUDAStream into a struct representation.

Previously the stream's data was packed into a single int64_t, as it was assumed the fields would not require more than 64 bits of storage in total. See https://github.com/pytorch/pytorch/issues/75854 for more information regarding newer platforms that may violate this assumption.

The CUDAStream can be unpacked using unpack().

◆ priority()

int c10::cuda::CUDAStream::priority ( ) const
inline

◆ priority_range()

static std::tuple< int, int > c10::cuda::CUDAStream::priority_range ( )
inlinestatic

◆ query()

bool c10::cuda::CUDAStream::query ( ) const
inline

◆ stream()

cudaStream_t c10::cuda::CUDAStream::stream ( ) const

Explicit conversion to cudaStream_t.

◆ synchronize()

void c10::cuda::CUDAStream::synchronize ( ) const
inline

◆ unpack3()

static CUDAStream c10::cuda::CUDAStream::unpack3 ( StreamId  stream_id,
DeviceIndex  device_index,
DeviceType  device_type 
)
inlinestatic

◆ unwrap()

Stream c10::cuda::CUDAStream::unwrap ( ) const
inline

Explicit conversion to Stream.


The documentation for this class was generated from the following file: