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 mismatches between input state and simulation engine precision. #1680

Merged

Conversation

schweitzpgi
Copy link
Collaborator

@schweitzpgi schweitzpgi commented May 14, 2024

It may be the case that the state vector data is in a precision that does not match that of the simulator. The runtime library knows precisely what simulator has been selected and can therefore convert the state vector to the expected format at runtime. This conversion may be expensive if the state vector is quite long. As a result, the runtime may want to emit a warning when a conversion path is taken.

The following conversions happen at runtime with this change:

  vector<float> -> vector<complex<float>>
  vector<float> -> vector<complex<double>>
  vector<double> -> vector<complex<float>>
  vector<double> -> vector<complex<double>>
  vector<complex<float>> -> vector<complex<double>>
  vector<complex<double>> -> vector<complex<float>>

If the input is vector<complex<float>> or vector<complex<double>> and the simulator's precision is a precise match, no conversions or runtime overhead is incurred.

Fix #1670

Description

github-actions bot pushed a commit that referenced this pull request May 15, 2024
@schweitzpgi schweitzpgi enabled auto-merge (squash) May 15, 2024 16:02
github-actions bot pushed a commit that referenced this pull request May 15, 2024
github-actions bot pushed a commit that referenced this pull request May 15, 2024
github-actions bot pushed a commit that referenced this pull request May 15, 2024
It may be the case that the state vector data is in a precision that
does not match that of the simulator. The runtime library knows
precisely what simulator has been selected and can therefore convert the
state vector to the expected format at runtime. This conversion may be
*expensive* if the state vector is quite long. As a result, the runtime
may want to emit a warning when a conversion path is taken.

The following conversions happen at runtime with this change:
  vector<float> -> vector<complex<float>>
  vector<float> -> vector<complex<double>>
  vector<double> -> vector<complex<float>>
  vector<double> -> vector<complex<double>>
  vector<complex<float>> -> vector<complex<double>>
  vector<complex<double>> -> vector<complex<float>>

If the input is vector<complex<float>> or vector<complex<double>> and
the simulator's precision is a precise match, no conversions or runtime
overhead is incurred.

Fix NVIDIA#1670
@schweitzpgi schweitzpgi merged commit e0a2e98 into NVIDIA:experimental/stateHandling May 16, 2024
112 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants