未验证 提交 209d534d 编写于 作者: W wangxiaoning 提交者: GitHub

[code style]fix cpplint codestyle (#50314)

* fix codestyle

* fix std
上级 fa284076
......@@ -126,9 +126,10 @@ int32_t GraphBrpcService::clear_nodes(Table *table,
const PsRequestMessage &request,
PsResponseMessage &response,
brpc::Controller *cntl) {
GraphTableType type_id = *(GraphTableType *)(request.params(0).c_str());
int idx_ = *(int *)(request.params(1).c_str());
((GraphTable *)table)->clear_nodes(type_id, idx_);
GraphTableType type_id =
*(reinterpret_cast<const GraphTableType *>(request.params(0).c_str()));
int idx_ = *(reinterpret_cast<const int *>(request.params(1).c_str()));
(reinterpret_cast<GraphTable *>(table))->clear_nodes(type_id, idx_);
return 0;
}
......@@ -380,11 +381,12 @@ int32_t GraphBrpcService::pull_graph_list(Table *table,
response, -1, "pull_graph_list request requires at least 5 arguments");
return 0;
}
GraphTableType type_id = *(GraphTableType *)(request.params(0).c_str());
int idx = *(int *)(request.params(1).c_str());
int start = *(int *)(request.params(2).c_str());
int size = *(int *)(request.params(3).c_str());
int step = *(int *)(request.params(4).c_str());
GraphTableType type_id =
*(reinterpret_cast<const GraphTableType *>(request.params(0).c_str()));
int idx = *(reinterpret_cast<const int *>(request.params(1).c_str()));
int start = *(reinterpret_cast<const int *>(request.params(2).c_str()));
int size = *(reinterpret_cast<const int *>(request.params(3).c_str()));
int step = *(reinterpret_cast<const int *>(request.params(4).c_str()));
std::unique_ptr<char[]> buffer;
int actual_size;
(reinterpret_cast<GraphTable *>(table))
......@@ -432,9 +434,11 @@ int32_t GraphBrpcService::graph_random_sample_nodes(
const PsRequestMessage &request,
PsResponseMessage &response,
brpc::Controller *cntl) {
GraphTableType type_id = *(GraphTableType *)(request.params(0).c_str());
int idx_ = *(int *)(request.params(1).c_str());
size_t size = *(uint64_t *)(request.params(2).c_str());
GraphTableType type_id =
*(reinterpret_cast<const GraphTableType *>(request.params(0).c_str()));
int idx_ = *(reinterpret_cast<const int *>(request.params(1).c_str()));
size_t size =
*(reinterpret_cast<const uint64_t *>(request.params(2).c_str()));
// size_t size = *(int64_t *)(request.params(0).c_str());
std::unique_ptr<char[]> buffer;
int actual_size;
......
......@@ -1917,7 +1917,7 @@ int32_t GraphTable::random_sample_nodes(GraphTableType table_type,
int total_size = 0;
auto &shards = table_type == GraphTableType::EDGE_TABLE ? edge_shards[idx]
: feature_shards[idx];
for (int i = 0; i < (int)shards.size(); i++) {
for (int i = 0; i < static_cast<int>(shards.size()); i++) {
total_size += shards[i]->get_size();
}
if (sample_size > total_size) sample_size = total_size;
......@@ -2429,7 +2429,7 @@ int GraphTable::get_all_feature_ids(
int GraphTable::get_node_embedding_ids(
int slice_num, std::vector<std::vector<uint64_t>> *output) {
if (is_load_reverse_edge and !FLAGS_graph_get_neighbor_id) {
if (is_load_reverse_edge && !FLAGS_graph_get_neighbor_id) {
return get_all_id(GraphTableType::EDGE_TABLE, slice_num, output);
} else {
get_all_id(GraphTableType::EDGE_TABLE, slice_num, output);
......
......@@ -466,13 +466,13 @@ void GpuPsGraphTable::move_result_to_source_gpu(int start_index,
void GpuPsGraphTable::move_degree_to_source_gpu(
int start_index, int gpu_num, int* h_left, int* h_right, int* node_degree) {
int shard_len[gpu_num];
std::vector<int> shard_len(gpu_num, 0);
for (int i = 0; i < gpu_num; i++) {
if (h_left[i] == -1 || h_right[i] == -1) {
continue;
}
shard_len[i] = h_right[i] - h_left[i] + 1;
int cur_step = (int)path_[start_index][i].nodes_.size() - 1;
int cur_step = static_cast<int>(path_[start_index][i].nodes_.size()) - 1;
for (int j = cur_step; j > 0; j--) {
CUDA_CHECK(
cudaMemcpyAsync(path_[start_index][i].nodes_[j - 1].val_storage,
......@@ -1566,8 +1566,12 @@ void GpuPsGraphTable::get_node_degree(
len * sizeof(int),
phi::Stream(reinterpret_cast<phi::StreamId>(stream)));
int* d_shard_degree_ptr = reinterpret_cast<int*>(d_shard_degree->ptr());
split_input_to_shard(
(uint64_t*)(key), d_idx_ptr, len, d_left_ptr, d_right_ptr, gpu_id);
split_input_to_shard(reinterpret_cast<uint64_t*>(key),
d_idx_ptr,
len,
d_left_ptr,
d_right_ptr,
gpu_id);
heter_comm_kernel_->fill_shard_key(
d_shard_keys_ptr, key, d_idx_ptr, len, stream);
CUDA_CHECK(cudaStreamSynchronize(stream));
......@@ -1594,8 +1598,12 @@ void GpuPsGraphTable::get_node_degree(
shard_len * sizeof(uint64_t),
shard_len * sizeof(uint64_t) + sizeof(int) * shard_len + shard_len % 2);
}
walk_to_dest(
gpu_id, total_gpu, h_left, h_right, (uint64_t*)(d_shard_keys_ptr), NULL);
walk_to_dest(gpu_id,
total_gpu,
h_left,
h_right,
reinterpret_cast<uint64_t*>(d_shard_keys_ptr),
NULL);
for (int i = 0; i < total_gpu; ++i) {
if (h_left[i] == -1) {
continue;
......@@ -1610,11 +1618,11 @@ void GpuPsGraphTable::get_node_degree(
get_table_offset(i, GraphTableType::EDGE_TABLE, edge_idx);
tables_[table_offset]->get(reinterpret_cast<uint64_t*>(node.key_storage),
reinterpret_cast<uint64_t*>(node.val_storage),
(size_t)(h_right[i] - h_left[i] + 1),
static_cast<size_t>(h_right[i] - h_left[i] + 1),
resource_->remote_stream(i, gpu_id));
GpuPsNodeInfo* node_info_list =
reinterpret_cast<GpuPsNodeInfo*>(node.val_storage);
int* node_degree_array = (int*)(node_info_list + shard_len);
int* node_degree_array = reinterpret_cast<int*>(node_info_list + shard_len);
int grid_size_ = (shard_len - 1) / block_size_ + 1;
get_node_degree_kernel<<<grid_size_,
block_size_,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册