Cirq
Cirq copied to clipboard
`NoiseModelFromGoogleNoiseProperties` should raise an error when simulations use qubits not on the device or an uncompiled circuit
Description of the issue Noisy Simulation describes how to run simulations with realistic noise obtained from a real quantum device. however when using that noise model with a gate that is not native to the device the simulation, no noise gets added (e.g. https://github.com/quantumlib/Cirq/issues/6607#issuecomment-2118721221). another issue is that when the circtuit uses qubits not on the device a key error is raised with little information explaining why that is.
Proposed Solution Before (or while) running the simulation validate that the qubits and gets in the circuit uses supported qubits and gates.
How to reproduce the issue https://github.com/quantumlib/Cirq/issues/6607
Cirq version
1.4.0.dev20240419073809
Hi, I'm interested in taking on this issue. Will look more into the current implementation.
@shef4 thanks for offering to help
Hi @NoureldinYosri , please assign this issue to another developer. Thank you for learning opportunity. The cirq meetings are a great place for students to learn about real world development practices and I hope they continue to help new and experienced developers grow and learn.
Hi @NoureldinYosri Can i take this up
@nivedha1 sure, thanks for offering to help
Hi @NoureldinYosri
I was able to implement the first part of the problem "To raise an error when trying to run simulations with qubits not on the device"
But for "A circuit not compiled to a supported gateset" part,
Im unable to figure out a way to get the target gateset from the compiled gateset to check if it is part of supported gateset.
Please Advise
Thanks!
Hi @nivedha1, from the comment made about this issue https://github.com/quantumlib/Cirq/issues/6607#issuecomment-2118721221 by cosenal
And in fact, CNOT (CXPowGate) doesn't even show up in the list from noise_props.expected_gates() 🤔
you might need you use this function to check which gates are supported by the device noise_props.expected_gates()
Honestly, I'm not sure.
- I would assume the user selects the device they'd want to run the circuit on so it might be an input parameter that related to a specific processor ID.
- If not Cirq might take advantage of a load balancer to decide which processor to use - in that case it might be an inherited variable from a parent class or stored in a database that gets called from at runtime.
@NoureldinYosri would need to shed more light on the matter.
Hope this helps!
@shef4 One follow up question How to find the processor id for the underlying quantum device Thanks!
Hi @nivedha1,
Honestly not sure, but this is a good question to bring up in the Cirq bi-weekly meetings
Hi, please check https://github.com/quantumlib/Cirq/issues/6607#issuecomment-2118116080 for the methods that you will need ... namely noise_props.qubits for qubits and noise_props.expected_gates() for gates. you don't need to worry about processor_id or anything related to the hardware.
This issue isn't about talking to the actualy hardware but about fixing a simulation that tries to mimic the hardware... the mimicing of the hardware happens through the noise model. this issue is about validating that the circuit is consistent with the noise model.