未验证 提交 23955fcf 编写于 作者: S ShenLiang 提交者: GitHub

[BugFix]Fix bug in paddle.device.cdua.synchronize() (#56451)

* fix bug in synchronize

* fix bug in synchronize
上级 c3ebe13b
......@@ -107,9 +107,6 @@ def synchronize(device=None):
paddle.device.cuda.synchronize(paddle.CUDAPlace(0))
'''
device_id = -1
if device is not None:
if isinstance(device, int):
device_id = device
......@@ -117,7 +114,14 @@ def synchronize(device=None):
device_id = device.get_device_id()
else:
raise ValueError("device type must be int or paddle.CUDAPlace")
else:
place = paddle.framework._current_expected_place()
if paddle.is_compiled_with_cuda() and isinstance(
place, paddle.CUDAPlace
):
device_id = place.get_device_id()
else:
device_id = -1
return core._device_synchronize(device_id)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册