quantify_scheduler.compilation
Compiler for the quantify_scheduler.
Module Contents
Functions
Determines the absolute timing of a schedule based on the timing constraints. |
|
|
|
Adds pulse information specified in the device config to the schedule. |
|
|
Validate a configuration using a schema. |
|
Compile and assemble a |
|
Add pulse information to operations based on device config file. |
|
Add compiled instructions to the schedule based on the hardware config file. |
Attributes
- determine_absolute_timing(schedule: quantify_scheduler.schedules.schedule.Schedule, time_unit: Literal[physical, ideal, None] = 'physical') quantify_scheduler.schedules.schedule.Schedule [source]
Determines the absolute timing of a schedule based on the timing constraints.
This function determines absolute timings for every operation in the
schedulables
. It does this by:iterating over all and elements in the
schedulables
.determining the absolute time of the reference operation.
determining the start of the operation based on the rel_time and duration of operations.
- Parameters:
schedule – The schedule for which to determine timings.
time_unit – Whether to use physical units to determine the absolute time or ideal time. When
time_unit == "physical"
the duration attribute is used. Whentime_unit == "ideal"
the duration attribute is ignored and treated as if it is1
. Whentime_unit == None
it will revert to"physical"
.
- Returns:
a new schedule object where the absolute time for each operation has been determined.
- add_pulse_information_transmon(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: dict) quantify_scheduler.schedules.schedule.Schedule [source]
Adds pulse information specified in the device config to the schedule.
- Parameters:
schedule – The schedule for which to add pulse information.
device_cfg – A dictionary specifying the required pulse information.
- Returns:
a new schedule object where the pulse information has been added.
Supported operations
The following gate type operations are supported by this compilation step.
Configuration specification
JSON schema for a transmon based device configuration.
type
object
properties
backend
Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.
type
string
qubits
A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.
type
object
edges
A dictionary with pairs of qubit names separated by an underscore (str) as keys e.g., ‘q0_q1’. The items contain the information to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.
type
object
additionalProperties
False
- validate_config(config: dict, scheme_fn: str) bool [source]
Validate a configuration using a schema.
- Parameters:
config – The configuration to validate
scheme_fn – The name of a json schema in the quantify_scheduler.schemas folder.
- Returns:
True if valid
- qcompile(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Optional[Union[quantify_scheduler.backends.circuit_to_device.DeviceCompilationConfig, dict]] = None, hardware_cfg: Optional[dict] = None) quantify_scheduler.schedules.schedule.CompiledSchedule [source]
Compile and assemble a
Schedule
into aCompiledSchedule
ready for execution using theInstrumentCoordinator
.- Parameters:
schedule – The schedule to be compiled.
device_cfg – Device specific configuration, defines the compilation step from the quantum-circuit layer to the quantum-device layer description.
hardware_cfg – Hardware configuration, defines the compilation step from the quantum-device to a hardware layer.
- Returns:
The prepared schedule if no backend is provided, otherwise whatever object returned by the backend
Configuration specification
JSON schema for a transmon based device configuration.
type
object
properties
backend
Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.
type
string
qubits
A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.
type
object
edges
A dictionary with pairs of qubit names separated by an underscore (str) as keys e.g., ‘q0_q1’. The items contain the information to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.
type
object
additionalProperties
False
Todo
Add a schema for the hardware config.
- device_compile(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Union[quantify_scheduler.backends.circuit_to_device.DeviceCompilationConfig, dict]) quantify_scheduler.schedules.schedule.Schedule [source]
Add pulse information to operations based on device config file.
- Parameters:
schedule – To be compiled.
device_cfg – Device specific configuration, defines the compilation step from the gate-level to the pulse level description.
- Returns:
The updated schedule.
- hardware_compile(schedule: quantify_scheduler.schedules.schedule.Schedule, hardware_cfg: dict) quantify_scheduler.schedules.schedule.CompiledSchedule [source]
Add compiled instructions to the schedule based on the hardware config file.
- Parameters:
schedule – To be compiled.
hardware_cfg – Hardware specific configuration, defines the compilation step from the quantum-device layer to the control-hardware layer.
- Returns:
The compiled schedule.