qcs_sdk.qpu.translation

class TranslationOptions:

Options available for Quil program translation.

This wraps [ApiTranslationOptions] in order to improve the user experience, because the structs auto-generated by prost can be clumsy to use directly.

def use_backend_v1(self, /):

Use the first-generation translation backend available on QCS since 2018.

def use_backend_v2(self, /):

Use the second-generation translation backend available on QCS since 2023.

def use_q_ctrl(self, /, q_ctrl=None):

Compile the program through Q-CTRL's API prior to translation.

The client should generally leave the q_ctrl compile options unset as it is specially authorized and not generally available.

def use_riverlane(self, /, riverlane=Ellipsis):

Configure Riverlane features prior to execution.

Options here are specially authorized and are not generally available to the client.

def v1():

Use the v1 backend for translation, available on QCS since 2018.

def v2( *, prepend_default_calibrations=None, passive_reset_delay_seconds=None, allow_unchecked_pointer_arithmetic=None, allow_frame_redefinition=None):

Use the v2 backend for translation, available on QCS since 2023.

Parameters
  • prepend_default_calibrations: If False, do not prepend the default calibrations to the translated program.
  • passive_reset_delay_seconds: The delay between passive resets, in seconds.
  • allow_unchecked_pointer_arithmetic: If True, disable runtime memory bounds checking. Only available to certain users.
  • allow_frame_redefinition: If True, allow defined frames to differ from Rigetti defaults. Only available to certain users. Otherwise, only INITIAL-FREQUENCY and CHANNEL-DELAY may be modified.
def encode_as_protobuf(self, /):

Serialize these translation options into the Protocol Buffer format.

backend

Get the backend used for translation

class TranslationResult:

The result of a call to [translate] which provides information about the translated program.

program

The translated program.

ro_sources

A mapping from the program's memory references to the key used to index the results map.

class TranslationBackend:

The backend used for translation.

class QCtrl:

Options for compiling programs through the Q-CTRL API.

Options here are specially authorized and are not generally available to the client.

class Riverlane:

Options for configuring Riverlane features prior to execution.

Options here are specially authorized and are not generally available to the client.

class TranslationError(qcs_sdk.QcsSdkError):

Errors raised due to failure to translate a program.

def get_quilt_calibrations(quantum_processor_id, client=None, timeout=None):

Retrieve the calibration data used for client-side Quil-T generation.

Parameters
  • quantum_processor_id: The ID of the quantum processor.
  • client: The Qcs client to use. Creates one using environment configuration if unset - see https: //docs.rigetti.com/qcs/references/qcs-client-configuration
  • timeout: Maximum duration to wait for API calls to complete, in seconds. Defaults to 10 seconds.

:returns: The Quil calibration program for the requested quantum processor.

Raises
  • LoadClientError: If there is an issue loading the QCS Client configuration.
  • TranslationError: If there was a problem fetching Quil-T calibrations.
def get_quilt_calibrations_async(quantum_processor_id, client=None, timeout=None):

Retrieve the calibration data used for client-side Quil-T generation.

Parameters
  • quantum_processor_id: The ID of the quantum processor.
  • client: The Qcs client to use. Creates one using environment configuration if unset - see https: //docs.rigetti.com/qcs/references/qcs-client-configuration
  • timeout: Maximum duration to wait for API calls to complete, in seconds. Defaults to 10 seconds.

:returns: The Quil calibration program for the requested quantum processor.

Raises
  • LoadClientError: If there is an issue loading the QCS Client configuration.
  • TranslationError: If there was a problem fetching Quil-T calibrations.
def translate( native_quil, num_shots, quantum_processor_id, client=None, translation_options=None):

Translates a native Quil program into an executable program.

Parameters
  • native_quil: A Quil program.
  • num_shots: The number of shots to perform.
  • quantum_processor_id: The ID of the quantum processor the executable will run on (e.g. "Aspen-M-2").
  • client: The Qcs client to use. Creates one using environment configuration if unset - see https: //docs.rigetti.com/qcs/references/qcs-client-configuration
  • translation_options: Optional translation options.
Raises
  • LoadClientError: If there is an issue loading the QCS Client configuration.
  • TranslationError: If the native_quil program could not be translated.
def translate_async( native_quil, num_shots, quantum_processor_id, client=None, translation_options=None):

Translates a native Quil program into an executable program.

Parameters
  • native_quil: A Quil program.
  • num_shots: The number of shots to perform.
  • quantum_processor_id: The ID of the quantum processor the executable will run on (e.g. "Aspen-M-2").
  • client: The Qcs client to use. Creates one using environment configuration if unset - see https: //docs.rigetti.com/qcs/references/qcs-client-configuration
  • translation_options: Optional translation options.
Raises
  • LoadClientError: If there is an issue loading the QCS Client configuration.
  • TranslationError: If the native_quil program could not be translated.