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

[NPU] add retry on HcclGetRootInfo to fix "bind fail" #34977

Merged
merged 3 commits into from
Aug 18, 2021
Merged
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
19 changes: 17 additions & 2 deletions paddle/fluid/operators/collective/c_gen_hccl_id_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,24 @@ namespace operators {
#ifdef PADDLE_WITH_ASCEND_CL

static void GenHCCLID(std::vector<HcclRootInfo>* hccl_ids) {
constexpr int timeout = 2 * 60 + 10; // 2MSL+10s
constexpr int retry_time = 1;
for (size_t i = 0; i < hccl_ids->size(); ++i) {
PADDLE_ENFORCE_NPU_SUCCESS(
platform::dynload::HcclGetRootInfo(&(*hccl_ids)[i]));
bool failed = true;
for (auto retry_times = 0; retry_times * retry_time < timeout;
++retry_times) {
auto err = platform::dynload::HcclGetRootInfo(&(*hccl_ids)[i]);
if (err == 0) {
failed = false;
break;
}
std::this_thread::sleep_for(std::chrono::seconds(retry_time));
LOG(WARNING) << "HcclGetRootInfo failed, err is: " << err << ", retry "
<< retry_times << " times";
}
if (failed) {
PADDLE_THROW(platform::errors::External("HcclGetRootInfo failed!"));
}
}
}

Expand Down