Page MenuHomePhabricator

Reset initial affinity in children processes

Authored by jlpeyton on Jun 12 2017, 1:09 PM.



If OpenMP is initialized before fork()-ing occurs and affinity is set to
something like compact, then the master thread will be pinned to a single HW
thread/core after initialization. If the master (or any other thread) then
forks N processes, all N processes will then be pinned to that same single HW
thread/core. To reset the affinity for the new child process, the atfork
handler for the child process can call kmp_set_thread_affinity_mask_initial() to
reset its affinity to the initial affinity of the application before it
re-initializes libomp. The parent process will not be affected and still
keeps its affinity setting.

Diff Detail


Event Timeline

jlpeyton created this revision.Jun 12 2017, 1:09 PM
This revision is now accepted and ready to land.Jun 12 2017, 1:48 PM
This revision was automatically updated to reflect the committed changes.