Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

openmp thread mapping

nik80
Beginner
465 Views
Hi,
is there a way in icc's openmp implementation to force openmp threads to be bound onto processors according to a specific arrangement? For example, if we have an SMP of multicores and an openmp application with 2 threads, how would we map the threads onto different physical packages or onto the same package but different cores? I know that Linux affinity system calls do exactly this job, but I am not sure how they could be incorporated easily and incrementaly in parallel constructs such as for loops.

Thanks in advance
0 Kudos
3 Replies
TimP
Honored Contributor III
465 Views
If your requirements don't justify the complication of affinity calls, have you considered using taskset(1) ?
0 Kudos
nik80
Beginner
465 Views
OK, so " taskset [mask] -- [command] [arguments] " seems to do the work for me, supposing that: 1) all forked threads inherit the affinity mask of the master thread, and 2) the Linux scheduler distributes application's threads in such way that the total workload is balanced accross the cpus corresponding to 'mask'. I think that the current Linux scheduler actually does both jobs, doesn't it?
But, as a general discussion, it seems to me weird that the openmp standard or a popular implementation of openmp such as this provided by icc, have not yet incorporated such cpu affinity extensions, given that we are entering the multicore era.
Anyway, thanks a lot!

0 Kudos
Martyn_C_Intel
Employee
465 Views

Hi,

A mechanism to control the order of mapping OpenMP threads to physical processors (sockets), cores and logical processors has recently been implemented in an update to the Intel compiler 9.1.A description has not yet been incorporated into the main compiler documentation;however, if you care to submit a request to Intel Premier Support at https://premier.intel.com, and mention my name (Martyn), I shall be happy to send you a copy of the preliminary documentation.The feature will be fully documented in the next major version of the Intel compiler.

0 Kudos
Reply