class

OpEvent

OpEvent(impl: _C_engine.OpEvent)
source

A single recorded operation event captured by the profiler.

Each OpEvent corresponds to one C++ engine op invocation: name, wall-clock duration, output tensor shape, an FLOP estimate, and the net memory delta. Profilers expose lists of these events so that per-op cost can be aggregated, exported, and visualised.

Parameters

implobject
Underlying engine OpEvent handle returned from the C++ profiler.

Notes

Durations are reported in nanoseconds at the source; helper properties expose the same value in microseconds and milliseconds for convenience.

Examples

>>> import lucid
>>> with lucid.profiler.profile() as prof:
...     y = lucid.randn(64, 64) @ lucid.randn(64, 64)
>>> for ev in prof.events():
...     print(ev.name, ev.time_us)

Methods (9)

dunder

__init__

None
__init__(impl: _C_engine.OpEvent)
source

Initialise the instance. See the class docstring for parameter semantics.

prop

name

str
name: str
source

Operation name (e.g. 'matmul', 'add').

prop

time_ns

int
time_ns: int
source

Wall-clock duration of the operation in nanoseconds.

prop

time_us

float
time_us: float
source

Wall-clock duration in microseconds.

prop

time_ms

float
time_ms: float
source

Wall-clock duration in milliseconds.

prop

shape

list[int]
shape: list[int]
source

Output tensor shape.

prop

flops

int
flops: int
source

Estimated FLOPs for this operation.

prop

memory_delta_bytes

int
memory_delta_bytes: int
source

Net memory allocated by this operation in bytes.

dunder

__repr__

str
__repr__()
source

Return a developer-facing string representation of the instance.