Browse Source

!15257 in npu mode remaining cpu ops not bind core

From: @zhaozhenlong
Reviewed-by: @hangangqiang,@hangangqiang,@zhang_xue_tong,@zhanghaibo5
Signed-off-by: @hangangqiang,@hangangqiang,@zhang_xue_tong
pull/15257/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
fc5a1c9136
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      mindspore/lite/src/inner_context.cc

+ 9
- 1
mindspore/lite/src/inner_context.cc View File

@@ -38,7 +38,15 @@ InnerContext::InnerContext(const Context *context, NPUManager *npu_manager) {
this->thread_num_ = context->thread_num_; this->thread_num_ = context->thread_num_;
this->device_list_.clear(); this->device_list_.clear();
for (auto &device_ctx : context->device_list_) { 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; this->npu_manager_ = npu_manager;
} }


Loading…
Cancel
Save