Skip to content

Commit

Permalink
[Kunlun]fix multi xpu dygraph hang, test=kunlun (PaddlePaddle#32662) (P…
Browse files Browse the repository at this point in the history
  • Loading branch information
vslyu committed May 1, 2021
1 parent 09adf20 commit 2c1ed9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paddle/fluid/imperative/reducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -762,10 +762,11 @@ void Reducer::MarkGroupReady(size_t group_index) {
// TODO(liuyuhui): Add try catch to deal with exception later,
// otherwise the main thread will continue to run when an exception is
// thrown in comm_pool_.
comm_pool_->enqueue([&] {
auto next_group = next_group_;
comm_pool_->enqueue([this, run_order, next_group, &group] {
auto dev_id = BOOST_GET_CONST(platform::XPUPlace, place_).device;
platform::SetXPUDeviceId(dev_id);
FusedAllReduceSchedule(run_order, group, next_group_);
FusedAllReduceSchedule(run_order, group, next_group);
{
std::lock_guard<std::mutex> lock(mutex_);
comm_op_count_ -= 1; // lock
Expand Down

0 comments on commit 2c1ed9b

Please sign in to comment.