-
Notifications
You must be signed in to change notification settings - Fork 4
CUDA and Gaussian GPU support #77
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
Open
riteshbhirud
wants to merge
13
commits into
QuantumSavory:main
Choose a base branch
from
riteshbhirud:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+5,016
−71
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
For now I placed all the gpu tests and benchmarks (commented out for now) in test_CUDAExt file as I was not sure about where to place them as its an extension. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR covers two things:
1. Fixes a bug in CPU based non gaussian states I noticed:
- Incorrect normalization for squeezed cat states
Issue: The normalization calculation for squeezed cat states was using the coherent state overlap formula exp(-2|α|²) regardless of whether squeezing was applied. This is mathematically incorrect for squeezed states, where the overlap ⟨α,r,θ|-α,r,θ⟩ depends on both the displacement and squeeze parameters.
Fix: Added proper branch logic to compute normalization differently for coherent vs squeezed cases:
Coherent states: Use analytical formula exp(-2|α|²)
Squeezed states: Use numerical overlap calculation via _overlap() function
This ensures squeezed cat states have correct quantum mechanical normalization.
- Wrong function call in multi-mode odd cat states
Issue: The multi-mode catstate_odd() function was incorrectly calling catstate_even() in its loop, causing all multi-mode "odd" cat states to actually be even cat states.
Fix: Changed the function call to catstate_odd() to match the intended behavior.
Please correct me if I am making any wrong understanding here.
2. Introduces CUDA extension and Gaussian Functionality (Non Gaussian will be done in a separate PR):
Simple GPU Workflow
Device Management
Precision Control
Automatic GPU Dispatch
When you use GPU arrays as inputs, operations automatically happen on GPU:
GPU State Creation
Basic Gaussian States
Typed GPU Constructors
For direct GPU creation with specific precision:
GPU Operations
Gaussian Unitaries
Gaussian Channels
Mixed Device Operations
Operations work seamlessly across CPU/GPU:
Tensor Products and Partial Traces
GPU Linear Combinations
Creating Superposition States
Linear Combination Arithmetic
Normalization and Simplification
Operations on Linear Combinations
State Metrics
Wigner Functions on GPU
Single-Point Evaluation
Batch Evaluation (High Performance)
Measured speedups:
Multi-Mode Wigner Functions
Multi-mode systems show excellent GPU performance:
Cross-Wigner Functions
Interference Wigner Functions
Interference calculations show excellent GPU performance:
Batch Operations for Maximum GPU Advantage
Measured Performance Scaling
Based on benchmark results:
Wigner function performance scaling:
Interference Wigner functions:
Multi-mode systems:
Measured Performance Gains: