-
Notifications
You must be signed in to change notification settings - Fork 169
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
Detect SIMD architecture from qsimcirq #361
Comments
One can add a template parameter to std::vector<std::complex<double>> qsim_simulate_expectation_values(
const py::dict &options,
const std::vector<std::tuple<
std::vector<OpString<Cirq::GateCirq<float>>>,
unsigned>>& opsums_and_qubit_counts,
uint64_t input_state) {
return SimulatorHelper::simulate_expectation_values(
options, opsums_and_qubit_counts, false, input_state);
} can be modified as follows std::vector<std::complex<double>> qsim_simulate_expectation_values(
const py::dict &options,
const std::vector<std::tuple<
std::vector<OpString<Cirq::GateCirq<float>>>,
unsigned>>& opsums_and_qubit_counts,
uint64_t input_state) {
auto instruction_set = DetectInstructions();
switch (instruction_set) {
case kAVX512:
return SimulatorHelper<SimulatorAVX512<For>>::simulate_expectation_values(
options, opsums_and_qubit_counts, false, input_state);
case kAVX:
return SimulatorHelper<SimulatorAVX<For>>::simulate_expectation_values(
options, opsums_and_qubit_counts, false, input_state);
case kSSE:
return SimulatorHelper<SimulatorSSE<For>>::simulate_expectation_values(
options, opsums_and_qubit_counts, false, input_state);
default:
return SimulatorHelper<SimulatorBasic<For>>::simulate_expectation_values(
options, opsums_and_qubit_counts, false, input_state);
}
} We need to implement |
I think we can fulfill #334 with this by allowing users to pass in @sergeisakov, do you have the bandwidth to take this item? Otherwise we can check if @laurynasas would be interested in implementing the fix. |
@95-martin-orion I'd be happy to work on this it's just that it would take me some time to set up and get started, but if that's ok sign me up! |
@laurynasas, thank you! I can help you with |
I had some time to look at this, do we want to have something like this? While this compiles and produces the Python wheel, I get the following error For MacOS: For Linux: The tests succeed on: For Linux: For Windows: I'm not sure why the same tests pass on the same CPU on Win but fails on Linux. Looking at the full stack trace seems like the
Could this be due to the flags ( |
Why do you use |
This is resolved. It may also be interesting to expose the choice of SIMD modes to the user in qsimcirq, but that is a separate concern. |
Related to #313. In order for users to have access to the instruction set their machine supports, we need to allow qsimcirq to dynamically choose between the different simulator implementations present in C++. Currently this is handled by the use of
simmux.h
in the pybind layer, but to enable the use of wheels additional handling may be required.The text was updated successfully, but these errors were encountered: