qp.backline.Placement

class Placement(*, controller, coprocessors=(), transport, qec_code=None)[source]

Bases: object

Declarative placement for heterogeneous execution.

Contains a controller node, any coprocessor nodes, and the transport that carries data between them. Rather than constructing this directly, use Backline to assemble a controller, coprocessors, and transport into a device; the resulting placement is available as placement.

Warning

Backline is experimental and only usable through the Catalyst compiler.

Keyword Arguments:
  • controller (Controller) – The Controller running the QNode.

  • coprocessors (Sequence[Coprocessor]) – The coprocessing accelerators. Defaults to ().

  • transport (str | Transport) – Which transport carries data between nodes, as a Transport or its registry name (e.g. "rdma"). A name is resolved on construction, so this reads back as a Transport. "none" places the controller alone and cannot be used with coprocessors.

  • qec_code (str | None) – The quantum error-correcting code the circuit is encoded for. Defaults to None, which leaves the circuit unencoded.

Example

A placement is built for you by Backline and read back off the device:

>>> con = qp.Controller(name="cpu-controller")
>>> coproc = qp.Coprocessor(coprocessor_fn="decoder", endpoint=qp.Endpoint("127.0.0.1", 7760))
>>> dev = qp.Backline(controller=con, coprocessors=[coproc], transport="rdma")
>>> dev.placement.transport
Transport(name='rdma')
>>> dev.placement.controller.name
'cpu-controller'
>>> len(dev.placement.coprocessors)
1

coprocessors accepts any sequence and is normalized to a tuple, and transport accepts either a registry name or a Transport:

>>> isinstance(dev.placement.coprocessors, tuple)
True

coprocessors

The coprocessing accelerators.

qec_code

The quantum error-correcting code for logical qubit encoding, e.g. "steane".

controller

The Controller running the QNode.

transport

Which transport carries data between nodes.

in_bytes

the controller's in_bytes when set, else the size its coprocessors' functions declare (message_bytes), else DEFAULT_MESSAGE_BYTES.

out_bytes

The size in bytes of each reply the controller receives, resolved like in_bytes.

coprocessors = ()

The coprocessing accelerators. Any sequence is accepted, and is stored as a tuple.

qec_code = None

The quantum error-correcting code for logical qubit encoding, e.g. "steane". Naming it here lets the compiler encode the circuit, and no separate lowering step is needed. Defaults to None, which leaves the circuit unencoded.

controller = <dataclasses._MISSING_TYPE object>

The Controller running the QNode.

transport = <dataclasses._MISSING_TYPE object>

Which transport carries data between nodes. Accepts a Transport, or its registry name (e.g. "rdma"), which is resolved with get_transport() on construction - so this attribute always reads back as a Transport. The transport itself is implemented in the compiled runtime.

in_bytes = <dataclasses._MISSING_TYPE object>

the controller’s in_bytes when set, else the size its coprocessors’ functions declare (message_bytes), else DEFAULT_MESSAGE_BYTES.

Type:

The size in bytes of each message the controller sends to every coprocessor

out_bytes = <dataclasses._MISSING_TYPE object>

The size in bytes of each reply the controller receives, resolved like in_bytes.