45 hwloc_topology_t topology;
46 hwloc_cpuset_t cpuset;
49 hwloc_topology_init(&topology);
51 hwloc_topology_load(topology);
53 obj = hwloc_get_obj_by_type(topology, HWLOC_OBJ_CORE,
id);
55 ret = hwloc_set_cpubind(topology, obj->cpuset, HWLOC_CPUBIND_THREAD);
57 printf(
"Couldn't bind to core %d\n",
id);
60 printf(
"Bound to core %d\n",
id);
63 hwloc_topology_destroy(topology);
74 hwloc_topology_t topology;
75 hwloc_cpuset_t cpuset;
76 hwloc_obj_t obj, cobj;
77 hwloc_obj_type_t otype;
79 hwloc_topology_init(&topology);
81 hwloc_topology_load(topology);
84 *ncores = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE);
87 *nnodes = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_NODE);
89 otype = HWLOC_OBJ_SOCKET;
91 *nnodes = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_SOCKET);
93 otype = HWLOC_OBJ_NODE;
98 obj = hwloc_get_obj_by_type(topology, otype, 0);
101 *cnode = hwloc_get_nbobjs_inside_cpuset_by_type(topology, obj->cpuset, HWLOC_OBJ_CORE);
103 hwloc_topology_destroy(topology);
111 unsigned i, n, j, ncores, nnodes, cnode;
113 hwloc_topology_t topology;
114 hwloc_cpuset_t cpuset;
115 hwloc_obj_t obj, cobj;
116 hwloc_obj_type_t otype;
118 hwloc_topology_init(&topology);
120 hwloc_topology_load(topology);
123 ncores = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE);
124 printf(
"ncores: %d\n",ncores);
126 nnodes = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_NODE);
128 otype = HWLOC_OBJ_SOCKET;
129 printf(
"grouping with sockets\n");
130 nnodes = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_SOCKET);
132 otype = HWLOC_OBJ_NODE;
133 printf(
"grouping with NUMA nodes\n");
137 obj = hwloc_get_obj_by_type(topology, otype, 0);
140 cnode = hwloc_get_nbobjs_inside_cpuset_by_type(topology, obj->cpuset, HWLOC_OBJ_CORE);
142 for(i=0; i<nnodes; i++){
144 obj = hwloc_get_obj_by_type(topology, otype, i);
146 cnode = hwloc_get_nbobjs_inside_cpuset_by_type(topology, obj->cpuset, HWLOC_OBJ_CORE);
149 cobj = hwloc_get_next_obj_inside_cpuset_by_type(topology, obj->cpuset, HWLOC_OBJ_CORE, NULL);
150 topo[(i*cnode)] = cobj->logical_index;
152 for(j=1; j<cnode; j++){
153 cobj = hwloc_get_next_obj_inside_cpuset_by_type(topology, obj->cpuset, HWLOC_OBJ_CORE, cobj);
154 topo[(i*cnode)+j] = cobj->logical_index;
161 hwloc_topology_destroy(topology);
void qrm_hwloc_topo(int *nodes, int *topo)
void qrm_hwloc_info(int *ncores, int *nnodes, int *cnode)
void qrm_hwloc_bind(int id)