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 data race when polling for CUDA events #1051

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Mar 4, 2024

See commit message for description of the data race. The MPI polling already does the same as the fixed version on this PR, and does not have a data race.

Reading the size of the event vector (through empty) is done without a lock, while pushes and erases
are done with the lock. Reading without a lock leads to a data race and thread sanitizer reports
this race. We separately keep track of the number of events in the vector in an atomic, so we use
that to check if the vector is empty. We do a relaxed read since the check can be approximate.
@msimberg msimberg added this to the 0.23.0 milestone Mar 4, 2024
@msimberg msimberg self-assigned this Mar 4, 2024
Copy link
Contributor

@biddisco biddisco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@msimberg msimberg changed the title Fix data race in when polling for CUDA events Fix data race when polling for CUDA events Mar 4, 2024
@msimberg msimberg enabled auto-merge March 4, 2024 12:50
@msimberg msimberg added this pull request to the merge queue Mar 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2024
@msimberg msimberg added this pull request to the merge queue Mar 4, 2024
Merged via the queue into pika-org:main with commit 66bddd3 Mar 4, 2024
37 of 38 checks passed
@msimberg msimberg deleted the cuda-event-polling-race branch March 4, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Archive
Development

Successfully merging this pull request may close these issues.

2 participants