static int numa_check(void) { DIR *dp; struct dirent *dir; int node; int j; common -> num_nodes = 0; dp = opendir(NODE_DIR); if (dp == NULL) { common -> num_nodes = 1; return 0; } for (node = 0; node < MAX_NODES; node ++) { for (j = 0; j<MAX_BITMASK_LEN; j++) common -> node_info[node][j] = 0; } while ((dir = readdir(dp)) != NULL) { if (strncmp(dir->d_name, "node", 4)==0) { node = atoi(&dir -> d_name[4]); if (node > MAX_NODES) { fprintf(stderr, "\nOpenBLAS Warning : MAX_NODES (NUMA) is too small. Terminated.\n"); exit(1); } common -> num_nodes ++; get_cpumap(node, common->node_info[node]); } } closedir(dp); if (common -> num_nodes == 1) return 1; #ifdef DEBUG fprintf(stderr, "Numa found : number of Nodes = %2d\n", common -> num_nodes); for (node = 0; node < common -> num_nodes; node ++) fprintf(stderr, "MASK (%2d) : %08lx\n", node, common -> node_info[node][0]); #endif return common -> num_nodes; }
static int numa_check(void) { DIR *dp; struct dirent *dir; int node; common -> num_nodes = 0; dp = opendir(NODE_DIR); if (dp == NULL) { common -> num_nodes = 1; return 0; } for (node = 0; node < MAX_NODES; node ++) common -> node_info[node] = 0; while ((dir = readdir(dp)) != NULL) { if (*(unsigned int *) dir -> d_name == 0x065646f6eU) { node = atoi(&dir -> d_name[4]); if (node > MAX_NODES) { fprintf(stderr, "\nGotoBLAS Warining : MAX_NODES (NUMA) is too small. Terminated.\n"); exit(1); } common -> num_nodes ++; common -> node_info[node] = get_cpumap(node); } } closedir(dp); if (common -> num_nodes == 1) return 1; #ifdef DEBUG fprintf(stderr, "Numa found : number of Nodes = %2d\n", common -> num_nodes); for (node = 0; node < common -> num_nodes; node ++) fprintf(stderr, "MASK (%2d) : %08lx\n", node, common -> node_info[node]); #endif return common -> num_nodes; }