Skip to content

qubic.soc_rpc_server

Functions for running an RPC server on the ZCU216 to allow users to submit remote jobs/circuits. See the Getting Started Guide for details on how to configure.

run_soc_server(ip, port, xsa_commit, enable_local_batching=False)

Start an xmlrpc server that exposes an instance of CircuitRunner over a network. Intended to be run from the RFSoC ARM core python (pynq) environment. IP should only be accessible locally!

Parameters:

Name Type Description Default
ip str
required
port int
required
xsa_commit str
required
enable_local_batching bool

if True, allow clients to submit batches of circuits directly to the SOC (bypassing the JobServer). Default is False.

False
Source code in qubic/soc_rpc_server.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def run_soc_server(ip: str, port: int, xsa_commit: str, 
                   enable_local_batching: bool = False):
    """
    Start an xmlrpc server that exposes an instance of CircuitRunner over a 
    network. Intended to be run from the RFSoC ARM core python (pynq) 
    environment. IP should only be accessible locally!

    Parameters
    ----------
    ip : str
    port : int
    xsa_commit : str
    enable_local_batching : bool
        if True, allow clients to submit batches of circuits directly to 
        the SOC (bypassing the JobServer). Default is False.
    """
    runner = CircuitRunner(commit=xsa_commit)

    server = xmlrpc.server.SimpleXMLRPCServer((ip, port), logRequests=True, allow_none=True)

    server.register_function(runner.load_circuit)
    server.register_function(runner.run_circuit)
    server.register_function(runner.load_and_run_acq)

    if enable_local_batching:
        run_circuit_batch = partial(runner.run_circuit_batch, from_server=True)
        update_wrapper(run_circuit_batch, runner.run_circuit_batch)
        server.register_function(run_circuit_batch)

    print('RPC server running on {}:{}'.format(ip, port))

    server.serve_forever()