| 487 | // which will later be fed into readers' channel |
| 488 | template <typename T> |
| 489 | void DatasetImpl<T>::LoadIntoMemory() { |
| 490 | VLOG(3) << "DatasetImpl<T>::LoadIntoMemory() begin"; |
| 491 | platform::Timer timeline; |
| 492 | timeline.Start(); |
| 493 | if (gpu_graph_mode_) { |
| 494 | VLOG(1) << "in gpu_graph_mode"; |
| 495 | #if defined(PADDLE_WITH_PSCORE) && defined(PADDLE_WITH_HETERPS) |
| 496 | std::vector<std::future<void>> wait_futures; |
| 497 | auto pool = GetReadThreadPool(thread_num_); |
| 498 | for (size_t i = 0; i < readers_.size(); i++) { |
| 499 | readers_[i]->SetGpuGraphMode(gpu_graph_mode_); |
| 500 | } |
| 501 | |
| 502 | if (STAT_GET(STAT_epoch_finish) == 1) { |
| 503 | VLOG(0) << "get epoch finish true"; |
| 504 | STAT_RESET(STAT_epoch_finish, 0); |
| 505 | for (size_t i = 0; i < readers_.size(); i++) { |
| 506 | readers_[i]->ResetPathNum(); |
| 507 | readers_[i]->ResetEpochFinish(); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | for (int64_t i = 0; i < thread_num_; ++i) { |
| 512 | wait_futures.emplace_back( |
| 513 | pool[i]->Run([this, i]() { readers_[i]->DoWalkandSage(); })); |
| 514 | } |
| 515 | for (auto& th : wait_futures) { |
| 516 | th.get(); |
| 517 | } |
| 518 | wait_futures.clear(); |
| 519 | |
| 520 | uint64_t node_num = 0; |
| 521 | std::vector<uint64_t> offsets; |
| 522 | offsets.resize(thread_num_); |
| 523 | |
| 524 | for (int i = 0; i < thread_num_; i++) { |
| 525 | auto& host_vec = (*readers_[i]->GetHostVec()); |
| 526 | offsets[i] = node_num; |
| 527 | node_num += host_vec.size(); |
| 528 | } |
| 529 | gpu_graph_total_keys_.resize(node_num + 1); |
| 530 | for (int i = 0; i < thread_num_; i++) { |
| 531 | uint64_t off = offsets[i]; |
| 532 | wait_futures.emplace_back(pool[i]->Run([this, i, off]() { |
| 533 | auto& host_vec = (*readers_[i]->GetHostVec()); |
| 534 | for (size_t j = 0; j < host_vec.size(); j++) { |
| 535 | gpu_graph_total_keys_[off + j] = host_vec[j]; |
| 536 | } |
| 537 | if (FLAGS_gpugraph_storage_mode != GpuGraphStorageMode::WHOLE_HBM) { |
| 538 | readers_[i]->clear_gpu_mem(); |
| 539 | } |
| 540 | })); |
| 541 | } |
| 542 | for (auto& th : wait_futures) { |
| 543 | th.get(); |
| 544 | } |
| 545 | wait_futures.clear(); |
| 546 |
nothing calls this directly
no test coverage detected