diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 687b244c6d5495fca858f596bb2b18f98d86a4b1..3d88a1377a056d933b2152d569008c6af2f45809 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."