Browse Source

!734 sync ge_dev to master 20221115

Merge pull request !734 from zhangfan/ge_dev
pull/737/MERGE
王涛 Gitee 2 years ago
parent
commit
b56c597fda
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 14 additions and 2 deletions
  1. +1
    -1
      metadef
  2. +13
    -1
      parser/common/thread_pool.cc

+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit 0dfbec2ebe779ef1206f40cb65a182c22c3613cd
Subproject commit c796c53d1971952beb1941fb3699dacc907d9625

+ 13
- 1
parser/common/thread_pool.cc View File

@@ -21,10 +21,22 @@
#include <stdexcept>

#include "register/register_types.h"
#include "graph/ge_context.h"
#include "mmpa/mmpa_api.h"

namespace ge {
namespace {
const char* const kMultiThreadCompile = "MULTI_THREAD_COMPILE";
const char* const kDisEnableFlag = "0";
bool IsSingleThreadCompile() {
std::string compile_thread;
return ((ge::GetContext().GetOption(kMultiThreadCompile, compile_thread) == GRAPH_SUCCESS)
&& (compile_thread.compare(kDisEnableFlag) == 0));
}
}

FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ThreadPool::ThreadPool(uint32_t size) : is_stoped_(false) {
idle_thrd_num_ = size < 1 ? 1 : size;
idle_thrd_num_ = ((size < 1U) || IsSingleThreadCompile()) ? 1U : size;

for (uint32_t i = 0; i < idle_thrd_num_; ++i) {
pool_.emplace_back(ThreadFunc, this);


Loading…
Cancel
Save