Skip to content

[FEATURE] Method that lists program types that you can pass to QuantumDevice.run #61

@WingCode

Description

@WingCode

Copied from qBraid/qBraid #803

Add method to qbraid.runtime.QuantumDevice that returns a list program type aliases that correspond to the registered program types that can be passed to as "run_input" to that device's .run() method.

For example, for the qbraid_qir_simulator, it could look something like:

from qbraid import QbraidProvider

provider = QbraidProvider()
device = provider.get_device("qbraid_qir_simulator")

graph = device.scheme.conversion_graph
if device._target_spec is None:
    raise ValueError("Device does not have a target spec.")

target_alias = device._target_spec.alias

supported_run_inputs = []

for program_type in graph.nodes():
    if graph.has_path(program_type, target_alias):
        supported_run_inputs.append(program_type)

print(supported_run_inputs)

However, we want a generic method that will return such a list for any instance of qbraid.runtime.QuantumDevice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions