提交 b3526fb4 编写于 作者: M malin10

tmp

上级 613df707
...@@ -458,7 +458,7 @@ void GeoCommunicator::Send(const std::vector<std::string> &var_names, ...@@ -458,7 +458,7 @@ void GeoCommunicator::Send(const std::vector<std::string> &var_names,
// var_tables.size(), 1, // var_tables.size(), 1,
// platform::errors::InvalidArgument("var_tables.size() == 1 is // platform::errors::InvalidArgument("var_tables.size() == 1 is
// permitted")); // permitted"));
auto before_send = GetCurrentUS();
std::shared_ptr<SparseIdsMap> ids_table = std::make_shared<SparseIdsMap>(); std::shared_ptr<SparseIdsMap> ids_table = std::make_shared<SparseIdsMap>();
for (size_t i = 0; i < var_tables.size(); i++) { for (size_t i = 0; i < var_tables.size(); i++) {
auto table_name = var_tables[i]; auto table_name = var_tables[i];
...@@ -494,7 +494,8 @@ void GeoCommunicator::Send(const std::vector<std::string> &var_names, ...@@ -494,7 +494,8 @@ void GeoCommunicator::Send(const std::vector<std::string> &var_names,
} }
} }
need_push_queue_->Push(ids_table); need_push_queue_->Push(ids_table);
VLOG(1) << "run send_op finish."; auto after_send = GetCurrentUS();
VLOG(0) << "run send_op finish. using " << (after_send - before_send);
} }
void GeoCommunicator::MainThread() { void GeoCommunicator::MainThread() {
...@@ -506,25 +507,12 @@ void GeoCommunicator::MainThread() { ...@@ -506,25 +507,12 @@ void GeoCommunicator::MainThread() {
} }
while (running_) { while (running_) {
// int meet = Meet();
// VLOG(1) << "async_meet: " << meet;
// SendGlobalStep(meet);
auto before = GetCurrentUS();
SendByCommunicator(0);
auto after = GetCurrentUS();
VLOG(0) << "finish one SendByCommunicator using " << (after - before);
}
VLOG(1) << "geo-communicator stopped, send thread exit";
}
void GeoCommunicator::SendByCommunicator(int batches) {
std::vector<std::future<void>> tasks; std::vector<std::future<void>> tasks;
tasks.reserve(send_var_nums_); tasks.reserve(send_var_nums_);
auto before_send_by_communicator = GetCurrentUS(); auto before_send_by_communicator = GetCurrentUS();
size_t wait_times = 0; size_t wait_times = 0;
while (ids_send_vec_.size() < static_cast<size_t>(max_merge_var_num_)) { while (ids_send_vec_.size() < static_cast<size_t>(max_merge_var_num_)) {
VLOG(1) << "ids_send_vec_ Size: " << ids_send_vec_.size(); VLOG(1) << "ids_send_vec_ Size: " << ids_send_vec_.size();
if (need_push_queue_->Size() > 0) { if (need_push_queue_->Size() > 0) {
...@@ -545,7 +533,8 @@ void GeoCommunicator::SendByCommunicator(int batches) { ...@@ -545,7 +533,8 @@ void GeoCommunicator::SendByCommunicator(int batches) {
if (ids_send_vec_.size() >= static_cast<size_t>(max_merge_var_num_)) { if (ids_send_vec_.size() >= static_cast<size_t>(max_merge_var_num_)) {
auto before_send_global_step = GetCurrentUS(); auto before_send_global_step = GetCurrentUS();
VLOG(0) << "finish ins_send_vec using time " VLOG(0) << "finish ins_send_vec using time "
<< (before_send_global_step - before_send_by_communicator); << (before_send_global_step - before_send_by_communicator)
<< "; send_var_nums_ = " << send_var_nums_;
SendGlobalStep(max_merge_var_num_); SendGlobalStep(max_merge_var_num_);
auto after_send_global_step = GetCurrentUS(); auto after_send_global_step = GetCurrentUS();
VLOG(0) << "finish send global_step using " VLOG(0) << "finish send global_step using "
...@@ -574,8 +563,9 @@ void GeoCommunicator::SendByCommunicator(int batches) { ...@@ -574,8 +563,9 @@ void GeoCommunicator::SendByCommunicator(int batches) {
VLOG(0) VLOG(0)
<< "send recv " << "send recv "
<< send_varname_to_ctx_.at(var_name).splited_varnames[ep_idx] << send_varname_to_ctx_.at(var_name).splited_varnames[ep_idx]
<< " finish, using " << (after_send_sparse - before_send_sparse) << " finish, using "
<< " and " << (after_recv_sparse - after_send_sparse) << (after_send_sparse - before_send_sparse) << " and "
<< (after_recv_sparse - after_send_sparse)
<< "; total = " << (after_recv_sparse - before_send_sparse); << "; total = " << (after_recv_sparse - before_send_sparse);
}; };
tasks.emplace_back( tasks.emplace_back(
...@@ -605,7 +595,10 @@ void GeoCommunicator::SendByCommunicator(int batches) { ...@@ -605,7 +595,10 @@ void GeoCommunicator::SendByCommunicator(int batches) {
} }
ids_send_vec_.clear(); ids_send_vec_.clear();
VLOG(1) << "Finish SendByCommunicator"; auto finish_one_comm = GetCurrentUS();
VLOG(0) << "Finish SendByCommunicator "
<< (finish_one_comm - after_send_global_step);
}
} }
} }
......
...@@ -424,7 +424,7 @@ class GeoCommunicator : public AsyncCommunicator { ...@@ -424,7 +424,7 @@ class GeoCommunicator : public AsyncCommunicator {
const std::vector<std::string> &var_tables, const std::vector<std::string> &var_tables,
const framework::Scope &scope) override; const framework::Scope &scope) override;
void SendByCommunicator(int batches) override; // void SendByCommunicator(int batches) override;
void SendSparse(const std::string &varname, int ep_idx); void SendSparse(const std::string &varname, int ep_idx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册