Rate this Page
★ ★ ★ ★ ★

Event#

class torch.mps.event.Event(enable_timing=False)[source]#

Wrapper around an MPS event.

MPS events are synchronization markers that can be used to monitor the device’s progress, to accurately measure timing, and to synchronize MPS streams.

Parameters:

enable_timing (bool, optional) – indicates if the event should measure time (default: False)

elapsed_time(end_event)[source]#

Returns the time elapsed in milliseconds after the event was recorded and before the end_event was recorded.

Return type:

float

query()[source]#

Returns True if all work currently captured by event has completed.

Return type:

bool

record(stream=None)[source]#

Records the event in a given stream.

Parameters:

stream (torch.mps.Stream, torch.Stream, optional) – Uses torch.mps.current_stream() if no stream is specified.

synchronize()[source]#

Waits until the completion of all work currently captured in this event. This prevents the CPU thread from proceeding until the event completes.

wait(stream=None)[source]#

Makes all future work submitted to the given stream wait for this event.

Parameters:

stream (torch.mps.Stream, torch.Stream, optional) – Uses torch.mps.current_stream() if no stream is specified.