//Initialize void myth_init_body(int worker_num,size_t def_stack_size) { myth_init_ex_body(worker_num,def_stack_size); //Create worker threads intptr_t i; for (i=1;i<g_worker_thread_num;i++){ real_pthread_create(&g_envs[i].worker,NULL,myth_worker_thread_fn,(void*)i); } g_envs[0].worker=real_pthread_self(); //Initialize each worker threads myth_worker_thread_fn((void*)(intptr_t)0); }
void myth_bind_worker(int rank) { #if defined(HAVE_PTHREAD_AFFINITY_NP) int cpu = myth_get_worker_cpu(rank); if (cpu != -1) { cpu_set_t cs; CPU_ZERO(&cs); CPU_SET(cpu, &cs); real_pthread_setaffinity_np(real_pthread_self(), sizeof(cpu_set_t), &cs); } #else (void)rank; #endif }