#include #include void* pthread_run(void *) { hwloc_topology_t topology; hwloc_bitmap_t bitmap; bitmap = hwloc_bitmap_alloc(); hwloc_topology_init(&topology); hwloc_topology_load(topology); hwloc_get_cpubind(topology, bitmap, 0); return NULL; } int main(int argc, char *argv[]) { pthread_t threads[2]; for (int i = 0; i < 2; i++) { pthread_create(&(threads[i]), NULL, pthread_run, NULL); } for (int i = 0; i < 2; i++) { pthread_join(threads[i], NULL); } return 0; }