!47821 fix mbuf only send data test case

Merge pull request !47821 from luoyang/r1.10
This commit is contained in:
i-robot 2023-01-13 07:46:15 +00:00 committed by Gitee
commit ce8bc49cf0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 9 additions and 0 deletions

View File

@ -189,6 +189,15 @@ AscendTdtQueue::AscendTdtQueue(const std::string &channel_name) : DataQueue(chan
MS_EXCEPTION_IF_NULL(MsContext::GetInstance());
device_id_ = MsContext::GetInstance()->get_param<uint32_t>(MS_CTX_DEVICE_ID);
#if defined(ENABLE_PYTHON) && !defined(ENABLE_ANDROID)
// There is a python flag in MindSpore to recognize if the runtime env is python.
// If we only use MD feature, python_env_flag will not set to true,
// then init.cc will not call ClearResAtexit at the end of MindSpore to clean resource.
// The original case is [only MD + mbuf + device_queue + send], the ascend stream release
// failed if we don't call ClearResAtexit first.
mindspore::python_adapter::set_python_env_flag(true);
#endif
// create acl tdt handle
if (!channel_name_.empty()) {
// When "capacity" is too large, device memory will be exploded