Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

`NoiseModelFromGoogleNoiseProperties` should raise an error when simulations use qubits not on the device or an uncompiled circuit

Open NoureldinYosri opened this issue 1 year ago • 11 comments

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

NoureldinYosri avatar May 20 '24 18:05 NoureldinYosri

Hi, I'm interested in taking on this issue. Will look more into the current implementation.

ghost avatar Jun 12 '24 17:06 ghost

@shef4 thanks for offering to help

NoureldinYosri avatar Jun 12 '24 18:06 NoureldinYosri

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.

ghost avatar Aug 12 '24 21:08 ghost

Hi @NoureldinYosri Can i take this up

nivedha1 avatar Aug 12 '24 22:08 nivedha1

@nivedha1 sure, thanks for offering to help

NoureldinYosri avatar Aug 13 '24 00:08 NoureldinYosri

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!

nivedha1 avatar Aug 13 '24 04:08 nivedha1

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()

ghost avatar Aug 13 '24 15:08 ghost

Honestly, I'm not sure.

  1. 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.
  2. 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!

ghost avatar Aug 13 '24 15:08 ghost

@shef4 One follow up question How to find the processor id for the underlying quantum device Thanks!

nivedha1 avatar Aug 13 '24 16:08 nivedha1

Hi @nivedha1,

Honestly not sure, but this is a good question to bring up in the Cirq bi-weekly meetings

ghost avatar Aug 13 '24 20:08 ghost

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.

NoureldinYosri avatar Aug 13 '24 21:08 NoureldinYosri