synchronize

paddle.device. synchronize ( device=None ) [source]

Wait for the compute on the given device to finish. :param device: The device which want to wait for. If device is None, the device is the current device. Default: None.

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.synchronize, line 3)

Unexpected indentation.

It can be gpu, gpu:x, xpu, xpu:x, custom_device, custom_device:x, where custom_device is the name of CustomDevicec, where x is the index of the GPUs, XPUs. And it can be paddle.CUDAPlace(n) or paddle.XPUPlace(n) or paddle.CustomPlace(n).

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.synchronize, line 5)

Block quote ends without a blank line; unexpected unindent.

Examples

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.synchronize, line 9)

Error in “code-block” directive: maximum 1 argument(s) allowed, 6 supplied.

.. code-block:: python
    # required: custom_device
    import paddle

    paddle.set_device('custom_cpu')
    paddle.device.synchronize()
    paddle.device.synchronize("custom_cpu:0")
    place = paddle.CustomPlace('custom_cpu', 0)
    paddle.device.synchronize(place)