q-optimize / c3

Toolset for control, calibration and characterization of physical systems
https://c3-toolset.readthedocs.io/
Apache License 2.0
66 stars 36 forks source link

Using C3 with IBM Open Pulse as a close loop optimization #174

Closed vsandinh closed 2 years ago

vsandinh commented 2 years ago

Describe the missing feature

I am trying to optimize some gates for Qiskit open pulse

Describe the solution you'd like

It would be nice if I can feed the pulse to IBM device and get the result to feed to C3

Describe alternatives you've considered

I am a beginner so I am trying to do this with C3

lazyoracle commented 2 years ago

Hi @vsandinh, great to know that you are using c3-toolset and would like to optimize pulses with IBM hardware in the loop. If I understand correctly, you are using the Pulse Gates feature, that lets you define arbitrary pulses for your qiskit gates, and then play them on hardware. I don't think it is possible to directly send the pulse produced by C3 into the qiskit pulse schedule. However, if you have gone through our Simulated Calibration example notebook, you might notice that it only expects a blackbox interface with the hardware. This means, that it can accept a bunch of parameters, and some fidelity function (eg ORBIT) and then produce optimized parameters based on feedback it receives from the hardware.

Example

If we look at the basic Pulse Gates documentation here, we see that the Gaussian pulse for the Hadamard gate that they are defining has 3 parameters (duration, amp and sigma). You could set these as optimization parameters for the c3-toolset calibration and then have the parameters provided by the optimizer sent to the qiskit pulse builder for running your benchmark circuit with these parameters. Once the circuit is run and you have the results back, this could be fed back into the optimizer for the next run. Let me know if this makes sense or you need more details.

lazyoracle commented 2 years ago

The Full Loop example notebook now demonstrates how to use a qiskit interface to perform calibration tasks. This interface could connect to non c3 qiskit backends too for performing optimization tasks.