18#ifdef QDP_USE_OMP_THREADS
25 int tid = omp_get_thread_num();
28 int core = tid/threadsPerCore;
29 int smtid = tid - core*threadsPerCore;
38 int hw_procid = smtid + 4*core;
43 CPU_SET(hw_procid, &set);
46 if((sched_setaffinity(0,
sizeof(set), &set)) == -1) {
47 QDPIO::cout <<
"WARN: Cound not do sched_setaffinity for thread " << tid <<
"\n";
58 uint32_t cids[64], htids[64];
62 htids[omp_get_thread_num()] = Kernel_ProcessorThreadID();
63 cids[omp_get_thread_num()] = Kernel_ProcessorCoreID();
67 for (
int i = 0; i < omp_get_max_threads(); ++i)
68 QDPIO::cout <<
"OMP thread " << i <<
": core = " << cids[i] <<
" hardware thread = " << htids[i] << std::endl;
74 QDPIO::cout <<
"Thread binding only implemented for OpenMP Threads\n";
79 QDPIO::cout <<
"reportAffinity: only implemented for OpenMP Threads \n";