未验证 提交 3aa5d64e 编写于 作者: R ronnywang 提交者: GitHub

[CustomDevice] fix auto_paralell (#53842)

* [CustomDevice] fix auto_paralell

* update

* update

* update
上级 d0514a93
......@@ -693,13 +693,19 @@ void RegisterCustomDeviceCommonKernel(const std::string& dev_type) {
device_type,
paddle::operators::CEmbeddingOpCustomDeviceKernel<
paddle::platform::CustomDeviceContext,
float>);
float>,
paddle::operators::CEmbeddingOpCustomDeviceKernel<
paddle::platform::CustomDeviceContext,
paddle::platform::float16>);
REGISTER_OP_CUSTOM_DEVICE_KERNEL(
c_embedding_grad,
device_type,
paddle::operators::CEmbeddingGradOpCustomDeviceKernel<
paddle::platform::CustomDeviceContext,
float>);
float>,
paddle::operators::CEmbeddingGradOpCustomDeviceKernel<
paddle::platform::CustomDeviceContext,
paddle::platform::float16>);
REGISTER_OP_CUSTOM_DEVICE_KERNEL(
c_softmax_with_cross_entropy,
......
......@@ -883,7 +883,7 @@ def get_default_cluster(json_config=None):
gpu_name = os.getenv("PADDLE_XCCL_BACKEND", None)
gpu_model = gpu_name
memory = int(
paddle.fluid.core._get_device_total_memory(gpu_name)
paddle.fluid.core.libpaddle._get_device_total_memory(gpu_name)
) // (1000**3)
else:
gpu_info = paddle.device.cuda.get_device_properties()
......
......@@ -562,6 +562,21 @@ def _current_expected_place():
"You are using XPU version Paddle, but your XPU device is not set properly. CPU device will be used by default."
)
_global_expected_place_ = core.CPUPlace()
elif len(core.get_all_custom_device_type()) > 0:
dev_type = core.get_all_custom_device_type()[0]
try:
device_count = core.get_custom_device_count(dev_type)
except Exception as e:
device_count = 0
if device_count > 0:
_global_expected_place_ = core.CustomPlace(
dev_type, _custom_device_ids(dev_type)[0]
)
else:
warnings.warn(
"You are using CUSTOM_DEVICE version Paddle, but your custom device is not set properly. CPU device will be used by default."
)
_global_expected_place_ = core.CPUPlace()
else:
_global_expected_place_ = core.CPUPlace()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册