KEMBAR78
Proper handling of `evolve_async` input state by 1tnguyen · Pull Request #2951 · NVIDIA/cuda-quantum · GitHub
Skip to content

Conversation

@1tnguyen
Copy link
Collaborator

Description

The input state to evolve_async may be constructed on a different device (GPU), as this state is built on the main thread before the async. functor is executed.

Hence, adding a helper function to detect and migrate the state data if needed.

1tnguyen and others added 2 commits May 23, 2025 03:10
Need to migrate the input state to proper QPU for execution.

Signed-off-by: Thien Nguyen <thiennguyen@nvidia.com>
@1tnguyen 1tnguyen requested review from mitchdz and sacpis May 23, 2025 03:18
Copy link
Collaborator

@sacpis sacpis left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @1tnguyen.

@sacpis
Copy link
Collaborator

sacpis commented May 23, 2025

A question. Do we cover this case in tests for evolve_async?

@1tnguyen
Copy link
Collaborator Author

A question. Do we cover this case in tests for evolve_async?

Yes. In fact, it's how I detected this bug :) It came to light thanks to the refactor we did in to_density_matrix, which now operates directly on GPU data.

The DynamicsAsyncTester should cover this case now with the refactored code. Previously, this was an issue, but the test couldn't detect it since the task assigned to QPU 1 requires to_density_matrix. This method was using device -> host transfer before, thus masking this issue.

@sacpis
Copy link
Collaborator

sacpis commented May 23, 2025

Thanks @1tnguyen.

github-actions bot pushed a commit that referenced this pull request May 23, 2025
@github-actions
Copy link

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

github-actions bot pushed a commit that referenced this pull request May 23, 2025
@github-actions
Copy link

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

@1tnguyen 1tnguyen enabled auto-merge (squash) May 23, 2025 08:45
@1tnguyen 1tnguyen merged commit 6b148d4 into NVIDIA:main May 23, 2025
198 of 199 checks passed
github-actions bot pushed a commit that referenced this pull request May 23, 2025
github-actions bot pushed a commit that referenced this pull request May 23, 2025
annagrin pushed a commit to annagrin/cuda-quantum that referenced this pull request Jun 17, 2025
Need to migrate the input state to proper QPU for execution.

Signed-off-by: Thien Nguyen <thiennguyen@nvidia.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
@bettinaheim bettinaheim added the bug fix To be listed under Bug Fixes in the release notes label Jul 22, 2025
@bettinaheim bettinaheim added this to the release 0.12.0 milestone Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

3 participants