Skip to content
Projects

scope_profiler.gpu_timing

Optional CUDA-event timing backends for asynchronous GPU work.

Classes

NameDescription
CuPyCUDATimingBackendCUDA-event timing through CuPy's current CUDA stream.
GPUTimingBackendMinimal backend contract used by GPU-timed regions.
TorchCUDATimingBackendCUDA-event timing through PyTorch's current CUDA stream.

Functions

NameDescription
resolve_gpu_timing_backendResolve a CUDA timing backend name or validate a backend-like object.

CuPyCUDATimingBackendclass#

class CuPyCUDATimingBackend()

CUDA-event timing through CuPy’s current CUDA stream.

nameattributeclass attributeinstance attribute#

name = 'cupy'

elapsed_time_nsmethod#

def elapsed_time_ns(start_event, end_event) -> int

record_eventmethod#

def record_event()

synchronizemethod#

def synchronize() -> None

Wait for all work on the current CUDA device.

GPUTimingBackendclass#

class GPUTimingBackend(Protocol)

Bases: Protocol

Minimal backend contract used by GPU-timed regions.

nameattributeinstance attribute#

name: str

elapsed_time_nsmethod#

def elapsed_time_ns(start_event, end_event) -> int

Return elapsed device time between two events in nanoseconds.

record_eventmethod#

def record_event()

Record and return an event on the backend’s current CUDA stream.

TorchCUDATimingBackendclass#

class TorchCUDATimingBackend()

CUDA-event timing through PyTorch’s current CUDA stream.

nameattributeclass attributeinstance attribute#

name = 'torch'

elapsed_time_nsmethod#

def elapsed_time_ns(start_event, end_event) -> int

record_eventmethod#

def record_event()

synchronizemethod#

def synchronize() -> None

Wait for all work on the current CUDA device.

resolve_gpu_timing_backendfunction#

def resolve_gpu_timing_backend(backend='auto') -> GPUTimingBackend

Resolve a CUDA timing backend name or validate a backend-like object.