View source on GitHub |
Collection of processors backed by local samplers.
Inherits From: AbstractLocalEngine
, AbstractEngine
cirq_google.engine.SimulatedLocalEngine(
processors: List[cirq_google.engine.AbstractLocalProcessor
]
)
This class is a wrapper around AbstractLocalEngine
and
adds no additional functionality and exists for naming consistency
and for possible future extension.
This class assumes that all processors are local. Processors are given during initialization. Program and job querying functionality is done by serially querying all child processors.
Methods
get_processor
get_processor(
processor_id: str
) -> cirq_google.engine.AbstractLocalProcessor
Returns an EngineProcessor for a Quantum Engine processor.
Args | |
---|---|
processor_id
|
The processor unique identifier. |
Returns | |
---|---|
A EngineProcessor for the processor. |
get_program
get_program(
program_id: str
) -> cirq_google.engine.AbstractProgram
Returns an existing AbstractProgram given an identifier.
Iteratively checks each processor for the given id.
Args | |
---|---|
program_id
|
Unique ID of the program within the parent project. |
Returns | |
---|---|
An AbstractProgram for the program. |
Raises | |
---|---|
KeyError
|
if program does not exist |
get_sampler
get_sampler(
processor_id: Union[str, List[str]]
) -> cirq.Sampler
Returns a sampler backed by the engine.
Args | |
---|---|
processor_id
|
String identifier, or list of string identifiers, determining which processors may be used when sampling. |
Raises | |
---|---|
ValueError
|
if multiple processor ids are given. |
list_jobs
list_jobs(
created_before: Optional[Union[datetime.datetime, datetime.date]] = None,
created_after: Optional[Union[datetime.datetime, datetime.date]] = None,
has_labels: Optional[Dict[str, str]] = None,
execution_states: Optional[Set[quantum.ExecutionStatus.State]] = None
) -> List[cirq_google.engine.AbstractJob
]
Returns the list of jobs in the project.
All historical jobs can be retrieved using this method and filtering options are available too, to narrow down the search baesd on:
- creation time
- job labels
- execution states
Args | |
---|---|
created_after
|
retrieve jobs that were created after this date or time. |
created_before
|
retrieve jobs that were created after this date or time. |
has_labels
|
retrieve jobs that have labels on them specified by
this dict. If the value is set to * , filters having the label
regardless of the label value will be filtered. For example, to
query programs that have the shape label and have the color
label with value red can be queried using
{'color': 'red', 'shape':'*'} |
execution_states
|
retrieve jobs that have an execution state that
is contained in execution_states . See
quantum.ExecutionStatus.State enum for accepted values.
|
list_processors
list_processors() -> Sequence[cirq_google.engine.AbstractLocalProcessor
]
Returns a list of Processors that the user has visibility to in the current Engine project. The names of these processors are used to identify devices when scheduling jobs and gathering calibration metrics.
Returns | |
---|---|
A list of EngineProcessors to access status, device and calibration information. |
list_programs
list_programs(
created_before: Optional[Union[datetime.datetime, datetime.date]] = None,
created_after: Optional[Union[datetime.datetime, datetime.date]] = None,
has_labels: Optional[Dict[str, str]] = None
) -> List[cirq_google.engine.AbstractProgram
]
Returns a list of previously executed quantum programs.
Args | |
---|---|
created_after
|
retrieve programs that were created after this date or time. |
created_before
|
retrieve programs that were created after this date or time. |
has_labels
|
retrieve programs that have labels on them specified by
this dict. If the value is set to * , filters having the label
regardless of the label value will be filtered. For example, to
query programs that have the shape label and have the color
label with value red can be queried using
{'color: red', 'shape:*'}
|