Controller Host

class interlinq.components.controller_host.ControllerHost(host_id: str, clock: interlinq.components.clock.Clock, computing_host_ids: list = [], gate_time: Optional[dict] = None, backend=None)

Controller host object which acts as a master node in a centralised distributed network system.

property computing_host_ids

Get the computing_host_ids associated to the controller host :returns: The IDs of computing/slave hosts :rtype: (list)

connect_host(computing_host_id: str, gate_time: Optional[dict] = None)

Adds a computing host to the distributed network

Parameters
  • computing_host_id (str) – The ID of the computing host

  • gate_time (dict) – A mapping of gate names to time the gate takes to execute for the computing host to be added

connect_hosts(computing_host_ids: list, gate_times: Optional[list] = None)

Adds multiple computing hosts to the distributed network

Parameters
  • computing_host_ids (list) – The ID of the computing host

  • gate_times (list) – A list of mappings of gate names to time the gate takes to execute for the computing host to be added

create_distributed_network(num_computing_hosts: int, num_qubits_per_host: int) → tuple

Create a network of num_computing_hosts completely connected computing nodes with num_qubits_per_host each.

Parameters
  • num_computing_hosts (int) – The number of computing hosts to initalize

  • num_qubits_per_host (int) – The number of qubits on each computing host

Returns

The list of computing hosts and the qubit map for their qubits

Return type

(tuple)

generate_and_send_schedules(circuit: interlinq.objects.circuit.Circuit)

Generate and send distributed schedules to all the computing hosts associated to the circuit

Parameters

circuit (Circuit) – The Circuit object which contains information regarding a quantum circuit

receive_results()

Receive the final output results from all the computing hosts

property results

Get the final output of the algorithm or the error reported by the computing hosts :returns: The final output/error from every computing host :rtype: (dict)

class interlinq.components.controller_host.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
default(obj)

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)