mirror of
https://github.com/RYDE-WORK/ktransformers.git
synced 2026-02-04 05:23:41 +08:00
Merge pull request #685 from vproxy-tools/main
fix numa cpu distribution
This commit is contained in:
commit
9660b2cc1e
@ -54,7 +54,12 @@ void Backend::do_work_stealing_job(int task_num,
|
|||||||
init_func_ = init_func;
|
init_func_ = init_func;
|
||||||
compute_func_ = compute_func;
|
compute_func_ = compute_func;
|
||||||
finalize_func_ = finalize_func;
|
finalize_func_ = finalize_func;
|
||||||
|
#ifdef USE_NUMA
|
||||||
|
// numa node location will be calculated based on the number of threads
|
||||||
|
thread_num_ = max_thread_num_;
|
||||||
|
#else
|
||||||
thread_num_ = std::min(max_thread_num_, task_num);
|
thread_num_ = std::min(max_thread_num_, task_num);
|
||||||
|
#endif
|
||||||
int base = task_num / thread_num_;
|
int base = task_num / thread_num_;
|
||||||
int remain = task_num % thread_num_;
|
int remain = task_num % thread_num_;
|
||||||
thread_state_[0].end = base + (0 < remain);
|
thread_state_[0].end = base + (0 < remain);
|
||||||
@ -146,4 +151,4 @@ void Backend::worker_thread(int thread_id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user