mindspore.runtime.launch_blocking

View Source On Gitee
mindspore.runtime.launch_blocking()[source]

Whether to enable synchronous execution. Default: False . When the value is set to False , the operator is executed asynchronously on the device. When an error occurs in the execution of the operator, the specific error script code location cannot be located. When this API is called , the value will be changed to true, the operator is executed synchronously on the device. It will reduce the execution performance of the program. At this time, when an error occurs in the execution of the operator, the location of the error script code can be located according to the call stack of the error.

Note

  • No parameters are required.

  • By default, operations are executed asynchronously.

  • Calling this function enables synchronous execution.

Examples

>>> import mindspore as ms
>>> ms.set_device("Ascend", 1)
>>> ms.runtime.launch_blocking()