评价此页

Event#

class torch.mps.event.Event(enable_timing=False)[源代码]#

MPS 事件的包装器。

MPS 事件是同步标记,可用于监控设备进度、精确测量时间和同步 MPS 流。

参数

enable_timing (bool, optional) – 指示事件是否应测量时间(默认值:False

elapsed_time(end_event)[源代码]#

返回事件记录和 end_event 记录之间经过的时间(以毫秒为单位)。

返回类型

浮点数

query()[源代码]#

如果事件当前捕获的所有工作都已完成,则返回 True。

返回类型

布尔值

record()[源代码]#

在默认流中记录事件。

synchronize()[源代码]#

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

wait()[源代码]#

使提交到默认流的所有后续工作都等待此事件。