when run npu, cpu op not bind core

This commit is contained in:
zhaozhenlong 2021-04-16 10:42:15 +08:00
parent f4724ea85c
commit a40984e1bf
1 changed files with 9 additions and 1 deletions

View File

@ -38,7 +38,15 @@ InnerContext::InnerContext(const Context *context, NPUManager *npu_manager) {
this->thread_num_ = context->thread_num_;
this->device_list_.clear();
for (auto &device_ctx : context->device_list_) {
this->device_list_.push_back(device_ctx);
// npu server would use one core so we don't bind core to avoid competition.
// If user does not set npu device, we still bind core.
if (device_ctx.device_type_ == DT_CPU && IsUserSetNpu()) {
auto cpu_ctx = device_ctx;
cpu_ctx.device_info_.cpu_device_info_.cpu_bind_mode_ = NO_BIND;
this->device_list_.push_back(cpu_ctx);
} else {
this->device_list_.push_back(device_ctx);
}
}
this->npu_manager_ = npu_manager;
}