Skip to content
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

[fleet_execurot] add flag to control timer #39241

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions paddle/fluid/distributed/fleet_executor/dist_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -611,27 +611,43 @@ bool DistModel::Run(const std::vector<DistModelTensor> &input_data,

DistModelTimer timer;
timer.tic();
double feed_elapse;
double fleet_exe_elapse;
double fetch_elapse;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面可以把这个功能做进timer里面的,toc_and_reset


if (!FeedData(input_data, scope_.get())) {
LOG(ERROR) << "DistModel failed at feeding data.";
return false;
}
double feed_elapse = timer.toc();
VLOG(3) << "Finish loading data, cost " << feed_elapse << "ms.";
if (config_.enable_timer) {
feed_elapse = timer.toc();
LOG(INFO) << "Finish loading data, cost " << feed_elapse << "ms.";
} else {
VLOG(3) << "Finish loading data.";
}

fleet_exe->Run(carrier_id_);
double fleet_exe_elapse = timer.toc();
VLOG(3) << "Finish FleetExe running, cost " << fleet_exe_elapse - feed_elapse
<< "ms.";
if (config_.enable_timer) {
fleet_exe_elapse = timer.toc();
LOG(INFO) << "Finish FleetExe running, cost "
<< fleet_exe_elapse - feed_elapse << "ms.";
} else {
VLOG(3) << "Finish FleetExe running.";
}

if (!FetchResults(output_data, scope_.get())) {
LOG(ERROR) << "DistModel failed at fetching result.";
return false;
}
double fetch_elapse = timer.toc();
VLOG(3) << "Finish fetching data, cost " << fetch_elapse - fleet_exe_elapse
<< "ms.";
VLOG(3) << "DistModel finish inf, cost " << fetch_elapse << "ms";
if (config_.enable_timer) {
fetch_elapse = timer.toc();
LOG(INFO) << "Finish fetching data, cost "
<< fetch_elapse - fleet_exe_elapse << "ms.";
LOG(INFO) << "DistModel finish inf, cost " << fetch_elapse << "ms";
} else {
VLOG(3) << "Finish fetching data.";
VLOG(3) << "DistModel finish inf.";
}
return true;
}

Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/distributed/fleet_executor/dist_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct DistModelConfig {
int64_t mp_ring_id{-1};
int64_t pp_upstream_ring_id{-1};
int64_t pp_downstream_ring_id{-1};
bool enable_timer{false};
};

class DistModel {
Expand Down
1 change: 1 addition & 0 deletions paddle/fluid/pybind/bind_fleet_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void BindFleetExecutor(py::module* m) {
.def_readwrite("mp_degree", &DistModelConfig::mp_degree)
.def_readwrite("pp_degree", &DistModelConfig::pp_degree)
.def_readwrite("mp_ring_id", &DistModelConfig::mp_ring_id)
.def_readwrite("enable_timer", &DistModelConfig::enable_timer)
.def_readwrite("pp_upstream_ring_id",
&DistModelConfig::pp_upstream_ring_id)
.def_readwrite("pp_downstream_ring_id",
Expand Down