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 quantum execution. |
- class Remote(url: str, timeout: int | 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 theconnect
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 aProcess
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 class requires the requests library to be installed. You can install it with:
`pip install requests`
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.
- connect(**kwargs)¶
Establishes a connection to the remote server.
This method initializes a connection to the remote server using the provided keyword arguments. The returned configuration must be passed to the
Process
constructor to create a new process connected to the server.Note that this method must be called for each new process that needs to interact with the server.
- Parameters:
**kwargs – Keyword arguments specifying connection parameters. The required
API. (arguments depend on the remote server's)
- Returns:
The configuration required to initialize a process.
- Return type:
Configuration object