From ac582771eea4f417d8624487735ad712080d6f70 Mon Sep 17 00:00:00 2001 From: ApricityXX <1470600398@qq.com> Date: Sun, 26 May 2024 21:17:09 +0800 Subject: [PATCH 1/2] 5.25 --- paddle/fluid/framework/device_worker.cc | 2 +- paddle/fluid/framework/hogwild_worker.cc | 2 +- paddle/fluid/operators/collective/c_comm_init_op.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/framework/device_worker.cc b/paddle/fluid/framework/device_worker.cc index da794486ae866..6a1861d5e54c5 100644 --- a/paddle/fluid/framework/device_worker.cc +++ b/paddle/fluid/framework/device_worker.cc @@ -245,7 +245,7 @@ bool CheckValidOutput(phi::DenseTensor* tensor, size_t batch_size) { void DeviceWorker::DumpParam(const Scope& scope, const int batch_id) { std::ostringstream os; - int device_id = static_cast(place_.GetDeviceId()); + int device_id = static_cast(static_cast(place_.GetDeviceId())); for (auto& param : *dump_param_) { os.str(""); Variable* var = scope.FindVar(param); diff --git a/paddle/fluid/framework/hogwild_worker.cc b/paddle/fluid/framework/hogwild_worker.cc index 85823031fa40f..498177b185c17 100644 --- a/paddle/fluid/framework/hogwild_worker.cc +++ b/paddle/fluid/framework/hogwild_worker.cc @@ -307,7 +307,7 @@ int HogwildWorker::IsParameter(const std::string &name, bool full_match) { } } void HogwildWorker::BuildShardingDepends(const ProgramDesc &program) { - nccl_rank_id_ = place_.GetDeviceId(); + nccl_rank_id_ = static_cast(static_cast(place_.GetDeviceId())); #if defined(PADDLE_WITH_CUDA) && defined(PADDLE_WITH_GPU_GRAPH) auto gpu_ps = PSGPUWrapper::GetInstance(); nccl_rank_id_ = gpu_ps->GetNCCLRankId(nccl_rank_id_); diff --git a/paddle/fluid/operators/collective/c_comm_init_op.cc b/paddle/fluid/operators/collective/c_comm_init_op.cc index b16d6fb6fe7df..c46ccb18905d8 100644 --- a/paddle/fluid/operators/collective/c_comm_init_op.cc +++ b/paddle/fluid/operators/collective/c_comm_init_op.cc @@ -118,7 +118,7 @@ class CCommInitOp : public framework::OperatorBase { int nranks = Attr("nranks"); int rid = Attr("ring_id"); - int device_id = place.device; + int device_id = static_cast(static_cast(place.device)); if (Attr("device_id") >= 0) { device_id = Attr("device_id"); } From 3efbba802e05ab8cf2e4b8e52c5e395cb89a2d3c Mon Sep 17 00:00:00 2001 From: ApricityXX <1470600398@qq.com> Date: Sun, 26 May 2024 23:45:31 +0800 Subject: [PATCH 2/2] 5.26 --- paddle/fluid/framework/device_worker.cc | 3 ++- paddle/fluid/framework/hogwild_worker.cc | 3 ++- paddle/fluid/operators/collective/c_comm_init_op.cc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/framework/device_worker.cc b/paddle/fluid/framework/device_worker.cc index 6a1861d5e54c5..b2d513033ead7 100644 --- a/paddle/fluid/framework/device_worker.cc +++ b/paddle/fluid/framework/device_worker.cc @@ -245,7 +245,8 @@ bool CheckValidOutput(phi::DenseTensor* tensor, size_t batch_size) { void DeviceWorker::DumpParam(const Scope& scope, const int batch_id) { std::ostringstream os; - int device_id = static_cast(static_cast(place_.GetDeviceId())); + int device_id = + static_cast(static_cast(place_.GetDeviceId())); for (auto& param : *dump_param_) { os.str(""); Variable* var = scope.FindVar(param); diff --git a/paddle/fluid/framework/hogwild_worker.cc b/paddle/fluid/framework/hogwild_worker.cc index 498177b185c17..52a11098bdbfa 100644 --- a/paddle/fluid/framework/hogwild_worker.cc +++ b/paddle/fluid/framework/hogwild_worker.cc @@ -307,7 +307,8 @@ int HogwildWorker::IsParameter(const std::string &name, bool full_match) { } } void HogwildWorker::BuildShardingDepends(const ProgramDesc &program) { - nccl_rank_id_ = static_cast(static_cast(place_.GetDeviceId())); + nccl_rank_id_ = + static_cast(static_cast(place_.GetDeviceId())); #if defined(PADDLE_WITH_CUDA) && defined(PADDLE_WITH_GPU_GRAPH) auto gpu_ps = PSGPUWrapper::GetInstance(); nccl_rank_id_ = gpu_ps->GetNCCLRankId(nccl_rank_id_); diff --git a/paddle/fluid/operators/collective/c_comm_init_op.cc b/paddle/fluid/operators/collective/c_comm_init_op.cc index c46ccb18905d8..768c60c27b093 100644 --- a/paddle/fluid/operators/collective/c_comm_init_op.cc +++ b/paddle/fluid/operators/collective/c_comm_init_op.cc @@ -118,7 +118,8 @@ class CCommInitOp : public framework::OperatorBase { int nranks = Attr("nranks"); int rid = Attr("ring_id"); - int device_id = static_cast(static_cast(place.device)); + int device_id = + static_cast(static_cast(place.device)); if (Attr("device_id") >= 0) { device_id = Attr("device_id"); }