Skip to content
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

Fix setting of global thread number #1016

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Feb 5, 2024

The (thread-pool-)local thread number was being set as the global thread number. When using only one thread pool this has no impact since the local and global numbers are the same. When using multiple pools (e.g. an MPI pool) the global thread number will be wrong on all but one pool. This is especially problematic if using the global thread number to index into data structures, like in #872.

This adds a test that checks that the pool and the local/global thread numbers are correct one every pool, when creating one pool for each PU.

This also changes the callbacks in the thread manager to use more explicit lambdas instead of bind with placeholders. This is where the wrong number was being passed to init_tss.

@msimberg msimberg self-assigned this Feb 5, 2024
@msimberg msimberg added this to the 0.22.2 milestone Feb 5, 2024
@msimberg msimberg force-pushed the fix-global-thread-num-tss branch from f94b8e1 to 104e891 Compare February 5, 2024 12:51
Refactor thread manager callbacks to use more verbose, but more explicit lambdas for the callbacks.
The on_start_thread callback was passing the local instead of the global thread number to init_tss.
@msimberg msimberg force-pushed the fix-global-thread-num-tss branch from 104e891 to a172190 Compare February 5, 2024 12:52
@msimberg msimberg marked this pull request as ready for review February 5, 2024 14:32
@msimberg msimberg mentioned this pull request Feb 5, 2024
@msimberg msimberg added this pull request to the merge queue Feb 6, 2024
Merged via the queue into pika-org:main with commit e58a522 Feb 6, 2024
52 of 55 checks passed
@msimberg msimberg deleted the fix-global-thread-num-tss branch February 6, 2024 19:34
@aurianer
Copy link
Contributor

aurianer commented Feb 6, 2024

sorry I realized I hadn't posted my review, it's anyway not a so important comment :)

msimberg added a commit that referenced this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants