Link Copied
Hi Dan,
Regarding the meaning of affinity mask (cpu_set_t), please see http://www.kernel.org/doc/man-pages/online/pages/man3/CPU_SET.3.html. It says:
The first available CPU on the system corresponds to a cpu value of 0, the
next CPU corresponds to a cpu value of 1, and so on. The constant CPU_SETSIZE
(currently 1024) specifies a value one greater than the maximum CPU number
that can be stored in cpu_set_t.
In the above example, it binds all threads to two cores. Process 0 was binded to core 0 (mask=1 or 2^0) and other processes were binded to core 2 (mask=4 or 2^2). You can change affinity mask of course. E.g. bind each process to each core (assuming the number of processes = the number of cores) like this.
CPU_SET(tid, &new_mask);
Thank you.
Feilong H.
Intel Developer Support
For more complete information about compiler optimizations, see our Optimization Notice.