Rate this Page

Event#

classtorch.xpu.streams.Event(enable_timing=False)[source]#

Wrapper around a XPU event.

XPU events are synchronization markers that can be used to monitor thedevice’s progress, and to synchronize XPU streams.

The underlying XPU events are lazily initialized when the event is firstrecorded. After creation, only streams on the same device may record theevent. However, streams on any device can wait on the event.

Parameters:

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

elapsed_time(end_event)[source]#

Return the time elapsed.

Time reported in milliseconds after the event was recorded andbefore the end_event was recorded.

query()[source]#

Check if all work currently captured by event has completed.

Returns:

A boolean indicating if all work currently captured by event hascompleted.

Return type:

bool

record(stream=None)[source]#

Record the event in a given stream.

Usestorch.xpu.current_stream() if no stream is specified. Thestream’s device must match the event’s device.

synchronize()[source]#

Wait for the event to complete.

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]#

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

Usetorch.xpu.current_stream() if no stream is specified.