synchronize

paddle.device. synchronize ( device: PlaceLike | None = None ) 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.10/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 CustomDevice, 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.10/site-packages/paddle/device/__init__.py:docstring of paddle.device.synchronize, line 1)

Block quote ends without a blank line; unexpected unindent.

Examples

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

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

.. code-block:: python
    >>> # doctest: +REQUIRES(env: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)