This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
AI流水线
Repositories
Datasets
Forum
实训
竞赛
大数据
AI开发
Register
Sign In
wangwei
/
MegEngine
Not watched
Unwatch
Watch all
Watch but not notify
1
Star
0
Fork
0
Code
Releases
31
Wiki
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
Browse Source
fix(core): fix nr_threads is zero
GitOrigin-RevId:
0ccbe3c69b
tags/v1.5.0
Megvii Engine Team
4 years ago
parent
67f117882b
commit
ddba5c9674
3 changed files
with
5 additions
and
2 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-1
dnn/test/common/utils.h
+3
-0
src/core/impl/utils/thread_pool.cpp
+1
-1
src/core/include/megbrain/utils/thread_pool.h
+ 1
- 1
dnn/test/common/utils.h
View File
@@ -102,7 +102,7 @@ class CpuDispatchChecker final : MegcoreCPUDispatcher {
std::vector<std::thread> m_workers;
#endif
//! Total number of threads, including main thread.
size_t m_nr_threads =
0
;
size_t m_nr_threads =
1
;
};
//! track number of CpuDispatchChecker instances to avoid leaking
+ 3
- 0
src/core/impl/utils/thread_pool.cpp
View File
@@ -20,6 +20,9 @@ ThreadPool::ThreadPool(size_t threads_num)
m_main_affinity_flag{false},
m_stop{false},
m_active{false} {
if (threads_num < 1) {
m_nr_threads = 1;
}
if (m_nr_threads > 1) {
if (m_nr_threads > static_cast<uint32_t>(sys::get_cpu_count())) {
mgb_log_debug(
+ 1
- 1
src/core/include/megbrain/utils/thread_pool.h
View File
@@ -80,7 +80,7 @@ public:
~ThreadPool();
private:
const size_t m_nr_threads = 0
;
size_t m_nr_threads = 1
;
//! Indicate whether the main thread have binding
bool m_main_affinity_flag;
//! The callback binding the threads to cores
Write
Preview
Loading…
Cancel
Save