Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.05k stars 2.33k forks source link

Accurate Control Channels #3311

Closed lcapelluto closed 4 years ago

lcapelluto commented 4 years ago

Information

This only applies for OpenPulse enabled backends, for users trying to get data from the backend to build Pulse Schedules.

What is the current behavior?

backend.configuration().control(qubit: int) returns a trivial mapping to a ControlChannel with index specified by the given int qubit. This is not correct. It should be possible to determine the correct channel by inspecting the backend hamiltonian, if it is provided.

What is the expected behavior?

Right now the easiest (and hacky) way to get the correct channel is by reverse engineering the control channel index by inspecting the cmd_def of backend.defaults().

Suggested solutions

I think the Pulse simulator does some hamiltonian parsing to figure out the same information that would be required to implement this feature. That is probably a good starting place. It should be implemented in qiskit.providers.models.PulseBackendConfiguration.control.

nkanazawa1989 commented 4 years ago

Yes. This is absolutely important feature. To be more specific, this is what we need to do in current pulse module for getting a control channel instance to drive CR with a combination of two specific qubits.

    try:
        cx_ref = cmd_def.get('cx', qubits=(c_qubit, t_qubit))
    except PulseError:
        raise Error
    cx_ref = cx_ref.filter(instruction_types=[pulse.commands.PulseInstruction])
    for channel in cx_ref.channels:
        if isinstance(channel, pulse.ControlChannel):
            cr_drive = channel
            break
    else:
        raise Error

This is not smart solution, and cr_drive should be provided by backend. However, a device Hamiltonian depends on system architecture, and it might be difficult to create general parser to extract qubit-channel mapping. Functionality of control channel is also system dependent.

We can start from comparing Hamiltonian of several different architectures, e.g. fixed-frequency, tunable coupler, frequency tunable superconducting / spin / trapped ion qubits, and check if we can create general model to map channel-qubit topology. If not, we need to think about adding BackendConfig to describe control channel functionality in an explicit manner.

SooluThomas commented 4 years ago

As a first step to tackle this issue, adding qubit_channel_map (List[List[]] containing qubit, control channel and measure channel info in each inner list) to the backend configuration schema seems like an option. I'm open to suggestions for the name - qubit_channel_map.