未验证 提交 6abe03be 编写于 作者: Q Qiyang Min 提交者: GitHub

Merge pull request #13317 from velconia/fix_python35_CI_random_fail

Fix manylinux ci random fail problem
......@@ -352,7 +352,10 @@ void ParallelExecutor::FeedAndSplitTensorIntoLocalScopes(
ParallelExecutor::~ParallelExecutor() {
if (member_->own_local_scope_) {
for (size_t i = 1; i < member_->local_scopes_.size(); ++i) {
member_->global_scope_->DeleteScope(member_->local_scopes_[i]);
Scope *local_scope = member_->local_scopes_[i];
if (member_->global_scope_->HasKid(local_scope)) {
member_->global_scope_->DeleteScope(local_scope);
}
}
}
}
......
......@@ -72,6 +72,12 @@ void Scope::DropKids() {
kids_.clear();
}
bool Scope::HasKid(const Scope* scope) const {
std::unique_lock<std::mutex> lock(mutex_);
auto it = std::find(this->kids_.begin(), this->kids_.end(), scope);
return it != this->kids_.end();
}
std::vector<std::string> Scope::LocalVarNames() const {
std::unique_lock<std::mutex> lock(mutex_);
std::vector<std::string> known_vars;
......
......@@ -71,6 +71,9 @@ class Scope {
/// Drop all kids scopes belonged to this scope.
void DropKids();
/// Find if a scope exists in the kid scopes
bool HasKid(const Scope* scope) const;
// enumerate all the variables current contains.
std::vector<std::string> LocalVarNames() const;
......
......@@ -178,7 +178,4 @@ if __name__ == '__main__':
for parallel in (False, True):
if use_cuda and not core.is_compiled_with_cuda():
continue
# TODO(minqiyang): remove this line after fixing the deletion
# order problem of Scope in ParallelExecutor in manylinux
if six.PY2:
main(use_cuda=use_cuda, parallel=parallel)
......@@ -152,7 +152,4 @@ if __name__ == '__main__':
for parallel in (False, True):
if use_cuda and not core.is_compiled_with_cuda():
continue
# TODO(minqiyang): remove this line after fixing the deletion
# order problem of Scope in ParallelExecutor in manylinux
if six.PY2:
main(use_cuda=use_cuda, parallel=parallel)
......@@ -155,7 +155,4 @@ if __name__ == '__main__':
for parallel in (False, True):
if use_cuda and not core.is_compiled_with_cuda():
continue
# TODO(minqiyang): remove this line after fixing the deletion
# order problem of Scope in ParallelExecutor in manylinux
if six.PY2:
main(use_cuda=use_cuda, parallel=parallel)
......@@ -137,7 +137,4 @@ if __name__ == '__main__':
for parallel in (False, True):
if use_cuda and not core.is_compiled_with_cuda():
continue
# TODO(minqiyang): remove this line after fixing the deletion
# order problem of Scope in ParallelExecutor in manylinux
if six.PY2:
main(use_cuda=use_cuda, parallel=parallel)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册