Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 6th Fundable Projects 2 No.8】 bugprone-signed-char-misuse-final #64607

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion paddle/fluid/framework/device_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<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 @@ -307,7 +307,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