未验证 提交 abbd4abb 编写于 作者: J Jiabin Yang 提交者: GitHub

fix current expected place error in multicard (#43664)

上级 b6bc6f7a
...@@ -574,7 +574,7 @@ def _current_expected_place(): ...@@ -574,7 +574,7 @@ def _current_expected_place():
except Exception as e: except Exception as e:
device_count = 0 device_count = 0
if device_count > 0: if device_count > 0:
_global_expected_place_ = core.CUDAPlace(0) _global_expected_place_ = core.CUDAPlace(_cuda_ids()[0])
else: else:
warnings.warn( warnings.warn(
"You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default." "You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default."
...@@ -586,7 +586,7 @@ def _current_expected_place(): ...@@ -586,7 +586,7 @@ def _current_expected_place():
except Exception as e: except Exception as e:
device_count = 0 device_count = 0
if device_count > 0: if device_count > 0:
_global_expected_place_ = core.XPUPlace(0) _global_expected_place_ = core.XPUPlace(_xpu_ids()[0])
else: else:
warnings.warn( warnings.warn(
"You are using XPU version Paddle, but your XPU device is not set properly. CPU device will be used by default." "You are using XPU version Paddle, but your XPU device is not set properly. CPU device will be used by default."
...@@ -598,7 +598,7 @@ def _current_expected_place(): ...@@ -598,7 +598,7 @@ def _current_expected_place():
except Exception as e: except Exception as e:
device_count = 0 device_count = 0
if device_count > 0: if device_count > 0:
_global_expected_place_ = core.MLUPlace(0) _global_expected_place_ = core.MLUPlace(_mlu_ids()[0])
else: else:
warnings.warn( warnings.warn(
"You are using MLU version Paddle, but your MLU device is not set properly. CPU device will be used by default." "You are using MLU version Paddle, but your MLU device is not set properly. CPU device will be used by default."
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册