-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix build warning: [Wsign-compare] on linux #46644
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@luotao1 针对 请问有更好的方式吗? 注:原本是直接使用 |
const_cast 也是慎用。CI-GpuPS Error 不进行 |
@@ -78,7 +78,7 @@ paddle::framework::GpuPsCommGraphFea GraphTable::make_gpu_ps_graph_fea( | |||
paddle::framework::GpuPsFeaInfo x; | |||
std::vector<uint64_t> feature_ids; | |||
for (size_t j = 0; j < bags[i].size(); j++) { | |||
// TODO use FEATURE_TABLE instead | |||
// TODO(danleifeng): Stuff. use FEATURE_TABLE instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stuff. 可以去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
收到
@@ -996,31 +996,31 @@ int32_t MemorySparseTable::PushSparse(const uint64_t* keys, | |||
update_value_col, | |||
values, | |||
&task_keys]() -> int { | |||
auto& keys = task_keys[shard_id]; | |||
auto& local_shard = _local_shards[shard_id]; | |||
auto &keys = task_keys[shard_id]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些 & 和 * 的修改是格式化工具自动修改的么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的
@@ -254,7 +255,8 @@ char *GraphTable::random_sample_neighbor_from_ssd( | |||
ch, | |||
sizeof(int) * 2 + sizeof(uint64_t), | |||
str) == 0) { | |||
uint64_t *data = ((uint64_t *)str.c_str()); | |||
uint64_t *data = | |||
reinterpret_cast<uint64_t *>(const_cast<char *>(str.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wsign-compare,会对这段报warning么?是不是precommit的时候报的warning?因为distributed目录下很多没有做代码格式化,如果碰到,可以加 // NOLINT
先豁免本行。这个PR主要修Wsign-compare
,其他内容可以不修。
对的还有 Wunused-variable 的Warning。 |
bool zero_init) { | ||
for (int i = 0; i < _embedding_dim; ++i) { | ||
for (int i = 0; i < static_cast<int>(_embedding_dim); ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < static_cast<int>(_embedding_dim); ++i) { | |
for (size_t i = 0; i < _embedding_dim; ++i) { |
Same for others.
@@ -177,7 +177,7 @@ paddle::framework::GpuPsCommGraph GraphTable::make_gpu_ps_graph( | |||
})); | |||
} | |||
} | |||
for (int i = 0; i < (int)tasks.size(); i++) tasks[i].get(); | |||
for (int i = 0; i < static_cast<int>(tasks.size()); i++) tasks[i].get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < static_cast<int>(tasks.size()); i++) tasks[i].get(); | |
for (size_t i = 0; i < tasks.size(); i++) tasks[i].get(); |
@@ -120,7 +120,7 @@ paddle::framework::GpuPsCommGraphFea GraphTable::make_gpu_ps_graph_fea( | |||
res.init_on_cpu(tot_len, (unsigned int)node_ids.size(), slot_num); | |||
unsigned int offset = 0, ind = 0; | |||
for (int i = 0; i < task_pool_size_; i++) { | |||
for (int j = 0; j < (int)node_id_array[i].size(); j++) { | |||
for (int j = 0; j < static_cast<int>(node_id_array[i].size()); j++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int j = 0; j < static_cast<int>(node_id_array[i].size()); j++) { | |
for (size_t j = 0; j < node_id_array[i].size(); j++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
请根据 代码风格检查指南 修复下CodeStyle流水线 |
PR types
Others
PR changes
Others
Describe
fix build warning: [Wsign-compare] on linux