mindspore.hal.synchronize

View Source On Gitee
mindspore.hal.synchronize()[source]

Synchronize all streams on current device, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.synchronize() instead.

Examples

>>> import mindspore
>>> a = mindspore.tensor(mindspore.ops.ones([1024, 2048]), mindspore.float32)
>>> b = mindspore.tensor(mindspore.ops.ones([2048, 4096]), mindspore.float32)
>>> s1 = mindspore.hal.Stream()
>>> with mindspore.hal.StreamCtx(s1):
...     c = mindspore.ops.matmul(a, b)
>>> mindspore.hal.synchronize()
>>> assert s1.query()