@@ -124,11 +124,13 @@ paddle::framework::GpuPsCommGraphFea GraphTable::make_gpu_ps_graph_fea(
124
124
}
125
125
for (size_t i = 0 ; i < tasks.size (); i++) tasks[i].get ();
126
126
127
- std::stringstream ss;
128
- for (int k = 0 ; k < slot_num; ++k) {
129
- ss << slot_feature_num_map_[k] << " " ;
127
+ if (FLAGS_v > 0 ) {
128
+ std::stringstream ss;
129
+ for (int k = 0 ; k < slot_num; ++k) {
130
+ ss << slot_feature_num_map_[k] << " " ;
131
+ }
132
+ VLOG (1 ) << " slot_feature_num_map: " << ss.str ();
130
133
}
131
- VLOG (0 ) << " slot_feature_num_map: " << ss.str ();
132
134
133
135
tasks.clear ();
134
136
@@ -137,7 +139,7 @@ paddle::framework::GpuPsCommGraphFea GraphTable::make_gpu_ps_graph_fea(
137
139
for (size_t i = 0 ; i < shard_num; i++) {
138
140
tot_len += feature_array[i].size ();
139
141
}
140
- VLOG (0 ) << " Loaded feature table on cpu, feature_list_size[" << tot_len
142
+ VLOG (1 ) << " Loaded feature table on cpu, feature_list_size[" << tot_len
141
143
<< " ] node_ids_size[" << node_ids.size () << " ]" ;
142
144
res.init_on_cpu (tot_len, (unsigned int )node_ids.size (), slot_num);
143
145
unsigned int offset = 0 , ind = 0 ;
@@ -494,6 +496,8 @@ void GraphTable::export_partition_files(int idx, std::string file_path) {
494
496
495
497
for (size_t i = 0 ; i < tasks.size (); i++) tasks[i].get ();
496
498
}
499
+ #endif
500
+
497
501
void GraphTable::clear_graph (int idx) {
498
502
for (auto p : edge_shards[idx]) {
499
503
p->clear ();
@@ -506,6 +510,7 @@ void GraphTable::clear_graph(int idx) {
506
510
}
507
511
}
508
512
513
+ #ifdef PADDLE_WITH_HETERPS
509
514
void GraphTable::release_graph () {
510
515
// Before releasing graph, prepare for sampling ids and embedding keys.
511
516
build_graph_type_keys ();
@@ -545,6 +550,7 @@ void GraphTable::release_graph_node() {
545
550
feature_shrink_to_fit ();
546
551
}
547
552
}
553
+ #endif
548
554
549
555
void GraphTable::clear_edge_shard () {
550
556
VLOG (0 ) << " begin clear edge shard" ;
@@ -590,6 +596,7 @@ void GraphTable::clear_feature_shard() {
590
596
VLOG (0 ) << " finish clear feature shard" ;
591
597
}
592
598
599
+ #ifdef PADDLE_WITH_HETERPS
593
600
void GraphTable::feature_shrink_to_fit () {
594
601
std::vector<std::future<int >> tasks;
595
602
for (auto &type_shards : feature_shards) {
@@ -619,13 +626,16 @@ void GraphTable::merge_feature_shard() {
619
626
feature_shards.resize (1 );
620
627
}
621
628
629
+ #endif
630
+
622
631
void GraphTable::clear_graph () {
623
632
VLOG (0 ) << " begin clear_graph" ;
624
633
clear_edge_shard ();
625
634
clear_feature_shard ();
626
635
VLOG (0 ) << " finish clear_graph" ;
627
636
}
628
637
638
+ #ifdef PADDLE_WITH_HETERPS
629
639
int32_t GraphTable::load_next_partition (int idx) {
630
640
if (next_partition >= static_cast <int >(partitions[idx].size ())) {
631
641
VLOG (0 ) << " partition iteration is done" ;
@@ -1203,11 +1213,21 @@ int32_t GraphTable::Load(const std::string &path, const std::string ¶m) {
1203
1213
if (load_edge) {
1204
1214
bool reverse_edge = (param[1 ] == ' <' );
1205
1215
std::string edge_type = param.substr (2 );
1206
- return this ->load_edges (path, reverse_edge, edge_type);
1216
+ int ret = this ->load_edges (path, reverse_edge, edge_type);
1217
+ if (ret != 0 ) {
1218
+ VLOG (0 ) << " Fail to load edges, path[" << path << " ] edge_type["
1219
+ << edge_type << " ]" ;
1220
+ return -1 ;
1221
+ }
1207
1222
}
1208
1223
if (load_node) {
1209
1224
std::string node_type = param.substr (1 );
1210
- return this ->load_nodes (path, node_type);
1225
+ int ret = this ->load_nodes (path, node_type);
1226
+ if (ret != 0 ) {
1227
+ VLOG (0 ) << " Fail to load nodes, path[" << path << " ] node_type["
1228
+ << node_type << " ]" ;
1229
+ return -1 ;
1230
+ }
1211
1231
}
1212
1232
return 0 ;
1213
1233
}
@@ -1319,10 +1339,19 @@ int32_t GraphTable::parse_node_and_load(std::string ntype2files,
1319
1339
return 0 ;
1320
1340
}
1321
1341
if (FLAGS_graph_load_in_parallel) {
1322
- this ->load_nodes (npath_str, " " );
1342
+ int ret = this ->load_nodes (npath_str, " " );
1343
+ if (ret != 0 ) {
1344
+ VLOG (0 ) << " Fail to load nodes, path[" << npath << " ]" ;
1345
+ return -1 ;
1346
+ }
1323
1347
} else {
1324
1348
for (size_t j = 0 ; j < ntypes.size (); j++) {
1325
- this ->load_nodes (npath_str, ntypes[j]);
1349
+ int ret = this ->load_nodes (npath_str, ntypes[j]);
1350
+ if (ret != 0 ) {
1351
+ VLOG (0 ) << " Fail to load nodes, path[" << npath << " ], ntypes["
1352
+ << ntypes[j] << " ]" ;
1353
+ return -1 ;
1354
+ }
1326
1355
}
1327
1356
}
1328
1357
return 0 ;
@@ -1397,17 +1426,30 @@ int32_t GraphTable::load_node_and_edge_file(std::string etype2files,
1397
1426
return 0 ;
1398
1427
}
1399
1428
if (FLAGS_graph_load_in_parallel) {
1400
- this ->load_nodes (npath_str, " " );
1429
+ int ret = this ->load_nodes (npath_str, " " );
1430
+ if (ret != 0 ) {
1431
+ VLOG (0 ) << " Fail to load nodes, path[" << npath_str << " ]" ;
1432
+ return -1 ;
1433
+ }
1401
1434
} else {
1402
1435
for (size_t j = 0 ; j < ntypes.size (); j++) {
1403
- this ->load_nodes (npath_str, ntypes[j]);
1436
+ int ret = this ->load_nodes (npath_str, ntypes[j]);
1437
+ if (ret != 0 ) {
1438
+ VLOG (0 ) << " Fail to load nodes, path[" << npath_str
1439
+ << " ], ntypes[" << ntypes[j] << " ]" ;
1440
+ return -1 ;
1441
+ }
1404
1442
}
1405
1443
}
1406
1444
}
1407
1445
return 0 ;
1408
1446
}));
1409
1447
}
1410
1448
for (size_t i = 0 ; i < tasks.size (); i++) tasks[i].get ();
1449
+ if (is_parse_node_fail_) {
1450
+ VLOG (0 ) << " Fail to load node_and_edge_file" ;
1451
+ return -1 ;
1452
+ }
1411
1453
return 0 ;
1412
1454
}
1413
1455
@@ -1499,7 +1541,12 @@ std::pair<uint64_t, uint64_t> GraphTable::parse_node_file(
1499
1541
node->set_feature_size (feat_name[idx].size ());
1500
1542
for (int i = 1 ; i < num; ++i) {
1501
1543
auto &v = vals[i];
1502
- parse_feature (idx, v.ptr , v.len , node);
1544
+ int ret = parse_feature (idx, v.ptr , v.len , node);
1545
+ if (ret != 0 ) {
1546
+ VLOG (0 ) << " Fail to parse feature, node_id[" << id << " ]" ;
1547
+ is_parse_node_fail_ = true ;
1548
+ return {0 , 0 };
1549
+ }
1503
1550
}
1504
1551
}
1505
1552
local_valid_count++;
@@ -1551,7 +1598,12 @@ std::pair<uint64_t, uint64_t> GraphTable::parse_node_file(
1551
1598
if (node != NULL ) {
1552
1599
for (int i = 2 ; i < num; ++i) {
1553
1600
auto &v = vals[i];
1554
- parse_feature (idx, v.ptr , v.len , node);
1601
+ int ret = parse_feature (idx, v.ptr , v.len , node);
1602
+ if (ret != 0 ) {
1603
+ VLOG (0 ) << " Fail to parse feature, node_id[" << id << " ]" ;
1604
+ is_parse_node_fail_ = true ;
1605
+ return {0 , 0 };
1606
+ }
1555
1607
}
1556
1608
}
1557
1609
local_valid_count++;
@@ -1603,6 +1655,11 @@ int32_t GraphTable::load_nodes(const std::string &path, std::string node_type) {
1603
1655
valid_count += res.second ;
1604
1656
}
1605
1657
}
1658
+ if (is_parse_node_fail_) {
1659
+ VLOG (0 ) << " Fail to load nodes, path[" << paths[0 ] << " .."
1660
+ << paths[paths.size () - 1 ] << " ] node_type[" << node_type << " ]" ;
1661
+ return -1 ;
1662
+ }
1606
1663
1607
1664
VLOG (0 ) << valid_count << " /" << count << " nodes in node_type[ " << node_type
1608
1665
<< " ] are loaded successfully!" ;
@@ -2103,36 +2160,56 @@ int GraphTable::parse_feature(int idx,
2103
2160
if (dtype == " feasign" ) {
2104
2161
// string_vector_2_string(fields.begin() + 1, fields.end(), ' ',
2105
2162
// fea_ptr);
2106
- FeatureNode::parse_value_to_bytes<uint64_t >(
2163
+ int ret = FeatureNode::parse_value_to_bytes<uint64_t >(
2107
2164
fea_fields.begin (), fea_fields.end (), fea_ptr);
2165
+ if (ret != 0 ) {
2166
+ VLOG (0 ) << " Fail to parse value" ;
2167
+ return -1 ;
2168
+ }
2108
2169
return 0 ;
2109
2170
} else if (dtype == " string" ) {
2110
2171
string_vector_2_string (
2111
2172
fea_fields.begin (), fea_fields.end (), ' ' , fea_ptr);
2112
2173
return 0 ;
2113
2174
} else if (dtype == " float32" ) {
2114
- FeatureNode::parse_value_to_bytes<float >(
2175
+ int ret = FeatureNode::parse_value_to_bytes<float >(
2115
2176
fea_fields.begin (), fea_fields.end (), fea_ptr);
2177
+ if (ret != 0 ) {
2178
+ VLOG (0 ) << " Fail to parse value" ;
2179
+ return -1 ;
2180
+ }
2116
2181
return 0 ;
2117
2182
} else if (dtype == " float64" ) {
2118
- FeatureNode::parse_value_to_bytes<double >(
2183
+ int ret = FeatureNode::parse_value_to_bytes<double >(
2119
2184
fea_fields.begin (), fea_fields.end (), fea_ptr);
2185
+ if (ret != 0 ) {
2186
+ VLOG (0 ) << " Fail to parse value" ;
2187
+ return -1 ;
2188
+ }
2120
2189
return 0 ;
2121
2190
} else if (dtype == " int32" ) {
2122
- FeatureNode::parse_value_to_bytes<int32_t >(
2191
+ int ret = FeatureNode::parse_value_to_bytes<int32_t >(
2123
2192
fea_fields.begin (), fea_fields.end (), fea_ptr);
2193
+ if (ret != 0 ) {
2194
+ VLOG (0 ) << " Fail to parse value" ;
2195
+ return -1 ;
2196
+ }
2124
2197
return 0 ;
2125
2198
} else if (dtype == " int64" ) {
2126
- FeatureNode::parse_value_to_bytes<uint64_t >(
2199
+ int ret = FeatureNode::parse_value_to_bytes<uint64_t >(
2127
2200
fea_fields.begin (), fea_fields.end (), fea_ptr);
2201
+ if (ret != 0 ) {
2202
+ VLOG (0 ) << " Fail to parse value" ;
2203
+ return -1 ;
2204
+ }
2128
2205
return 0 ;
2129
2206
}
2130
2207
} else {
2131
2208
VLOG (2 ) << " feature_name[" << name << " ] is not in feat_id_map, ntype_id["
2132
2209
<< idx << " ] feat_id_map_size[" << feat_id_map.size () << " ]" ;
2133
2210
}
2134
2211
2135
- return - 1 ;
2212
+ return 0 ;
2136
2213
}
2137
2214
// thread safe shard vector merge
2138
2215
class MergeShardVector {
0 commit comments