22static int node_mapping[MAX_NODES];
29init_mappings_from_file()
36 if(fscanf(cfg,
"%d", &max_cpus) <= 0) {
37 perror(
"Could not parse input!\n");
40 for(i = 0; i < max_cpus; i++){
41 if(fscanf(cfg,
"%d", &node_mapping[i]) <= 0) {
42 perror(
"Could not parse input!\n");
62 if( init_mappings_from_file() == 0 ) {
65 max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
66 for(i = 0; i < max_cpus; i++){
85 return node_mapping[thread_id % max_cpus];
98static int numa[][16] = {
99 {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60},
100 {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61},
101 {2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62},
102 {3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63} };
110 for(
int i = 0; i < 4; i++)
111 for(
int j = 0; j < 16; j++)
112 if(numa[i][j] == mytid){
138 get_mempolicy(&numa_node, NULL, 0, ptr, MPOL_F_NODE | MPOL_F_ADDR);
Provides cpu mapping utility function.
int get_num_numa_regions(void)
int get_numa_node_of_address(void *ptr)
#define CUSTOM_CPU_MAPPING
int get_cpu_id(int thread_id)
int get_numa_id(int mytid)
A wrapper file ensuring 64bit key size.