bind core
This commit is contained in:
parent
2aac7f0105
commit
633cb21740
|
@ -278,6 +278,11 @@ int CoreAffinity::InitHardwareCoreInfo() {
|
|||
|
||||
std::vector<int> CoreAffinity::GetCoreId(size_t thread_num, BindMode bind_mode) {
|
||||
std::vector<int> bind_id;
|
||||
#ifdef SERVER_INFERENCE
|
||||
if (bind_mode == Power_NoBind) {
|
||||
return bind_id;
|
||||
}
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
return bind_id;
|
||||
#elif defined(BIND_CORE)
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
#ifdef SERVER_INFERENCE
|
||||
#define BIND_CORE
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
#define BIND_CORE
|
||||
#include <sched.h>
|
||||
|
|
|
@ -61,6 +61,11 @@ void Worker::InitWorkerMask(const std::vector<int> &core_list, size_t workers_si
|
|||
static uint32_t windows_core_index = 0;
|
||||
core_id_ = windows_core_index++;
|
||||
#elif defined(BIND_CORE)
|
||||
#ifdef SERVER_INFERENCE
|
||||
if (core_list.empty()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
cpu_set_t mask;
|
||||
CPU_ZERO(&mask);
|
||||
if (core_list.size() > 0) {
|
||||
|
|
Loading…
Reference in New Issue