Skip to content

Commit

Permalink
【Hackathon 6th Fundable Projects 2 No.8】 bugprone-signed-char-misuse-…
Browse files Browse the repository at this point in the history
…final (#64607)

* 5.25

* 5.26
  • Loading branch information
ApricityXX authored May 28, 2024
1 parent 017038f commit 287e124
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion paddle/fluid/framework/device_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,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<int>(place_.GetDeviceId());
int device_id =
static_cast<int>(static_cast<unsigned char>(place_.GetDeviceId()));
for (auto& param : *dump_param_) {
os.str("");
Variable* var = scope.FindVar(param);
Expand Down
3 changes: 2 additions & 1 deletion paddle/fluid/framework/hogwild_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ 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<int>(static_cast<unsigned char>(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_);
Expand Down
3 changes: 2 additions & 1 deletion paddle/fluid/operators/collective/c_comm_init_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class CCommInitOp : public framework::OperatorBase {
int nranks = Attr<int>("nranks");
int rid = Attr<int>("ring_id");

int device_id = place.device;
int device_id =
static_cast<int>(static_cast<unsigned char>(place.device));
if (Attr<int>("device_id") >= 0) {
device_id = Attr<int>("device_id");
}
Expand Down

0 comments on commit 287e124

Please sign in to comment.