From abbd4abb89d75c790bb258b55d6e38e59e2c39cf Mon Sep 17 00:00:00 2001 From: Jiabin Yang <360788950@qq.com> Date: Mon, 20 Jun 2022 19:33:34 +0800 Subject: [PATCH] fix current expected place error in multicard (#43664) --- python/paddle/fluid/framework.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 687b244c6d5..3d88a1377a0 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -574,7 +574,7 @@ def _current_expected_place(): except Exception as e: device_count = 0 if device_count > 0: - _global_expected_place_ = core.CUDAPlace(0) + _global_expected_place_ = core.CUDAPlace(_cuda_ids()[0]) else: warnings.warn( "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(): except Exception as e: device_count = 0 if device_count > 0: - _global_expected_place_ = core.XPUPlace(0) + _global_expected_place_ = core.XPUPlace(_xpu_ids()[0]) else: warnings.warn( "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(): except Exception as e: device_count = 0 if device_count > 0: - _global_expected_place_ = core.MLUPlace(0) + _global_expected_place_ = core.MLUPlace(_mlu_ids()[0]) else: warnings.warn( "You are using MLU version Paddle, but your MLU device is not set properly. CPU device will be used by default." -- GitLab