v0.2 ongoing

This commit is contained in:
liam 2025-02-09 22:39:01 +08:00
parent bf1d413be0
commit 098602b08f
11 changed files with 450 additions and 70 deletions

View file

@ -10,6 +10,13 @@
#include "backend.h"
#ifdef USE_NUMA
#include <numa.h>
#include <numaif.h>
thread_local int Backend::numa_node = -1;
#endif
thread_local int Backend::thread_local_id = -1;
Backend::Backend(int max_thread_num) {
@ -74,6 +81,16 @@ void Backend::do_work_stealing_job(int task_num,
}
void Backend::process_tasks(int thread_id) {
#ifdef USE_NUMA
if(numa_node == -1){
numa_node = thread_id * numa_num_configured_nodes() / thread_num_;
struct bitmask* mask = numa_bitmask_alloc(numa_num_configured_nodes());
numa_bitmask_setbit(mask, numa_node);
numa_bind(mask);
}
#endif
if (init_func_ != nullptr) {
init_func_(thread_id);
}