KEMBAR78
Improve thread-safety of CUDAQ static variables by 1tnguyen · Pull Request #1078 · NVIDIA/cuda-quantum · GitHub
Skip to content

Conversation

@1tnguyen
Copy link
Collaborator

@1tnguyen 1tnguyen commented Jan 9, 2024

Description

There are a couple of static variables in cudaq.cpp that might be accessed concurrently.

For example:

  • Thread 1 calls deviceCodeHolderAdd (.thunk function) => vector::emplace_back

  • Thread 2 calls get_quake_by_name => iterate over the same vector => BANG.

This PR adds a mutex to guard access to those vars.

There are a couple of static variables in `cudaq.cpp` which might be
accessed concurrently.

This PR adds a mutex to guard access to those vars.
@github-actions
Copy link

github-actions bot commented Jan 9, 2024

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jan 9, 2024
Copy link
Collaborator

@amccaskey amccaskey left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

Nice find👍

@1tnguyen 1tnguyen merged commit ae70a45 into NVIDIA:main Jan 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2024
@bettinaheim bettinaheim added the bug fix To be listed under Bug Fixes in the release notes label Jan 22, 2024
@bettinaheim bettinaheim added this to the release 0.6.0 milestone Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug fix To be listed under Bug Fixes in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants