27 static hwloc_topology_t quark_topology = NULL;
28 static volatile int quark_nbr = 0;
33 if (!topo_initialized) {
36 hwloc_topology_init(&quark_topology);
39 hwloc_topology_load(quark_topology);
42 sys_corenbr = hwloc_get_nbobjs_by_type(quark_topology, HWLOC_OBJ_CORE);
54 if ((topo_initialized ==1) && (quark_nbr == 0)) {
56 hwloc_topology_destroy(quark_topology);
74 hwloc_cpuset_t cpuset;
76 if (!topo_initialized) {
82 obj = hwloc_get_obj_by_type(quark_topology, HWLOC_OBJ_CORE, rank);
88 #if !defined(HWLOC_BITMAP_H)
89 cpuset = hwloc_cpuset_dup(obj->cpuset);
90 hwloc_cpuset_singlify(cpuset);
92 cpuset = hwloc_bitmap_dup(obj->cpuset);
93 hwloc_bitmap_singlify(cpuset);
97 if (hwloc_set_cpubind(quark_topology, cpuset, HWLOC_CPUBIND_THREAD)) {
99 #if !defined(HWLOC_BITMAP_H)
100 hwloc_cpuset_asprintf(&str, obj->cpuset);
102 hwloc_bitmap_asprintf(&str, obj->cpuset);
104 printf(
"Couldn't bind to cpuset %s\n", str);
110 rank = obj->children[0]->os_index;
113 #if !defined(HWLOC_BITMAP_H)
114 hwloc_cpuset_free(cpuset);
116 hwloc_bitmap_free(cpuset);