Page MenuHomePhabricator

New API for restoring current thread's affinity to initial affinity of application.
ClosedPublic

Authored by jlpeyton on Jan 4 2016, 12:48 PM.

Details

Summary

This new API, int kmp_set_thread_affinity_mask_initial(), is available for use by other parallel runtime libraries inside a possibly OpenMP-registered thread. This entry point restores the current thread's affinity mask to the affinity mask of the application when it first began. If -1 is returned it can be assumed that either the thread hasn't called affinity initialization or that the thread isn't registered with the OpenMP library. If 0 is returned then, then the call was successful. Any return value greater than zero indicates an error occurred when setting affinity.

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton updated this revision to Diff 43915.Jan 4 2016, 12:48 PM
jlpeyton retitled this revision from to New API for setting initial mask for calling thread..
jlpeyton updated this object.
jlpeyton added reviewers: tlwilmar, hfinkel.
jlpeyton set the repository for this revision to rL LLVM.
jlpeyton added a subscriber: openmp-commits.
jlpeyton retitled this revision from New API for setting initial mask for calling thread. to New API for restoring current thread's affinity to initial affinity of application..Jan 8 2016, 9:05 AM
jlpeyton updated this object.
AndreyChurbanov accepted this revision.Jan 12 2016, 4:52 AM
AndreyChurbanov added a reviewer: AndreyChurbanov.
AndreyChurbanov added a subscriber: AndreyChurbanov.

LGTM

May also worth adding comment in the code:

Note: supposed usage model is: (1) remember current affinity mask of the thread, (2) set initial mask by calling this routine, (3) use non-OpenMP parallelization, (4) restore affinity mask of the thread before returning to OpenMP parallelization.

This revision is now accepted and ready to land.Jan 12 2016, 4:52 AM
This revision was automatically updated to reflect the committed changes.