ket.remote

Remote quantum execution module.

This module provides a tool to execute quantum code on a remote server. It includes the Remote class, which facilitates the connection to a remote server.

Classes ket.remote

Remote

Remote quantum execution.

class Remote(url: str, verify_ssl=None, timeout: int | None = None, private_key: PathLike | None = None, passphrase: bool | bytes | None = None)

Remote quantum execution.

The Remote class enables the execution of quantum circuits on a remote server. It provides functionality to establish a connection with the server and configure the connection parameters.

The remote server’s configuration is specified using the url parameter, while additional connection parameters can be passed as keyword arguments to the connect method. The exact arguments required depend on the server’s implementation. Refer to the server’s documentation for detailed setup instructions.

Once connected, the Remote instance integrates with a Process object, which handles the actual quantum execution. The server determines the capabilities available for execution, such as calculating expectation values or dumping quantum states. The execution is set to batch.

Note

This module requires additional dependencies from ket-lang[remote].

Install with: pip install ket-lang[remote].

Example

from ket.remote import Remote

# Initialize a remote server connection
remote = Remote("https://remote-server-url.com")

# Connect to the remote server and start a quantum process
process = Process(remote.connect(...))
Parameters:
  • url – The URL of the remote server.

  • timeout – The timeout for the requests. Defaults to None.

  • verify_ssl – Flag to disable SSL certificate verification. This value is passed directly to the requests.get() call. Defaults to None.

  • private_key – Path to an OpenSSH RSA private key for authentication. If set to None, authentication will not be performed. Defaults to None.

  • passphrase

    Passphrase to decrypt the private key:

    • True: Prompts the user to enter the passphrase interactively;

    • bytes: Provides the passphrase directly as a byte string;

    • None: Assumes the private key is unencrypted. Defaults to None.

submit_execution(circuit: dict, parameters: list[float])

Get the quantum circuit to execute.

Warning

This method is called by Libket and should not be called directly.

get_result() dict

Get the result of the quantum circuit execution.

Warning

This method is called by Libket and should not be called directly.

clear()

Clear the data to start a new execution.

Warning

This method is called by Libket and should not be called directly.

set(**kwargs)

Configure the execution.

Parameters:

kwargs – Keyword arguments specifying connection parameters. The required arguments depend on the remote server’s API.

connect()

Call ket.clib.libket.BatchExecution.configure with the appropriated arguments to generate the quantum execution target.

Warning

This method is called automatically by Process. It is not necessary to call it manually.