Quantum Manager Server

This module defines the function to use for the quantum manager server.

This function should be started on a separate process for parallel simulation, using the mpi_tests/qm_server.py script or similar. Additionally defined are utility functions for socket connections and the messages used by the client/server.

class parallel.src.quantum_manager_server.QuantumManagerMessage(msg_type: QuantumManagerMsgType, keys: List[int], args: List[any])

Message for quantum manager communication.

type

type of message.

Type:

Enum

keys

list of ALL keys serviced by request.

Type:

List[int]

args

list of other arguments for the request.

Type:

List[any]

deserialize(j_data)

Method to reconstruct a message from serialized data.

Parameters:

j_data – serialized QuantumManagerMessage data.

serialize()

Serializes the data stored in the message.

Returns:

A dictionary with the following keys: - “type”: name of the type for the message. - “keys”: keys for all modified qubits in the quantum state manager, in hex format. - “args”: JSON-like serialized version of arguments

Return type:

Dict[str, any]

class parallel.src.quantum_manager_server.QuantumManagerMsgType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
parallel.src.quantum_manager_server.start_server(ip: str, port: int, client_num, formalism='KET', log_file='server_log.json')

Main function to run quantum manager server.

Will run until all clients have disconnected or TERMINATE message received. Will block processing until all clients connected.

Parameters:
  • ip (str) – ip address server should bind to.

  • port (int) – port server should bind to.

  • client_num (int) – number of remote clients that should be connected (one per process).

  • formalism (str) – formalism to use for quantum manager (default “KET” for ket vector).

  • log_file (str) – output log file to store server information (default “server_log.json”).