Skip to content

[OpenMP] Fix child processes to use affinity_none #91391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2024

Conversation

jpeyton52
Copy link
Contributor

When a child process is forked with OpenMP already initialized, the child process resets its affinity mask and sets proc-bind-var to false so that the entire original affinity mask is used. This patch corrects an issue with the affinity initialization code setting affinity to compact instead of none for this special case of forked children.

The test trying to catch this only testing explicit setting of KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

Fixes: #91098

When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.

Fixes: llvm#91098
@jpeyton52 jpeyton52 requested a review from TerryLWilmarth May 7, 2024 20:08
@llvmbot llvmbot added the openmp:libomp OpenMP host runtime label May 7, 2024
@jpeyton52 jpeyton52 requested a review from jhuber6 May 7, 2024 20:08
@jpeyton52 jpeyton52 merged commit 73bb8d9 into llvm:main May 8, 2024
6 checks passed
@jpeyton52 jpeyton52 added this to the LLVM 18.X Release milestone May 8, 2024
@jpeyton52
Copy link
Contributor Author

/cherry-pick 73bb8d9

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request May 8, 2024
When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.

The test trying to catch this only testing explicit setting of
KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

Fixes: llvm#91098
(cherry picked from commit 73bb8d9)
@llvmbot
Copy link
Member

llvmbot commented May 8, 2024

/pull-request #91479

tstellar pushed a commit to llvmbot/llvm-project that referenced this pull request May 10, 2024
When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.

The test trying to catch this only testing explicit setting of
KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

Fixes: llvm#91098
(cherry picked from commit 73bb8d9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Limited to single CPU core on v16.x+
3 participants