def run_sweep( self, program: 'cirq.Circuit', program_id: Optional[str] = None, job_id: Optional[str] = None, params: study.Sweepable = None, repetitions: int = 1, processor_ids: Sequence[str] = ('xmonsim',), gate_set: Optional[sgs.SerializableGateSet] = None, program_description: Optional[str] = None, program_labels: Optional[Dict[str, str]] = None, job_description: Optional[str] = None, job_labels: Optional[Dict[str, str]] = None, ) -> engine_job.EngineJob: """Runs the supplied Circuit via Quantum Engine.Creates In contrast to run, this runs across multiple parameter sweeps, and does not block until a result is returned. Args: program: The Circuit to execute. If a circuit is provided, a moment by moment schedule will be used. program_id: A user-provided identifier for the program. This must be unique within the Google Cloud project being used. If this parameter is not provided, a random id of the format 'prog-################YYMMDD' will be generated, where # is alphanumeric and YYMMDD is the current year, month, and day. job_id: Job identifier to use. If this is not provided, a random id of the format 'job-################YYMMDD' will be generated, where # is alphanumeric and YYMMDD is the current year, month, and day. params: Parameters to run with the program. repetitions: The number of circuit repetitions to run. processor_ids: The engine processors that should be candidates to run the program. Only one of these will be scheduled for execution. gate_set: The gate set used to serialize the circuit. The gate set must be supported by the selected processor. program_description: An optional description to set on the program. program_labels: Optional set of labels to set on the program. job_description: An optional description to set on the job. job_labels: Optional set of labels to set on the job. Returns: An EngineJob. If this is iterated over it returns a list of TrialResults, one for each parameter sweep. """ if not gate_set: raise ValueError('No gate set provided') engine_program = self.create_program( program, program_id, gate_set, program_description, program_labels ) return engine_program.run_sweep( job_id=job_id, params=params, repetitions=repetitions, processor_ids=processor_ids, description=job_description, labels=job_labels, )
def run_sweep( self, *, # Force keyword args. program: 'cirq.Circuit', program_id: Optional[str] = None, job_config: Optional[JobConfig] = None, params: study.Sweepable = None, repetitions: int = 1, priority: int = 500, processor_ids: Sequence[str] = ('xmonsim', ), gate_set: serializable_gate_set.SerializableGateSet = None ) -> engine_job.EngineJob: """Runs the supplied Circuit via Quantum Engine. In contrast to run, this runs across multiple parameter sweeps, and does not block until a result is returned. Args: program: The Circuit to execute. If a circuit is provided, a moment by moment schedule will be used. program_id: A user-provided identifier for the program. This must be unique within the Google Cloud project being used. If this parameter is not provided, a random id of the format 'prog-################YYMMDD' will be generated, where # is alphanumeric and YYMMDD is the current year, month, and day. job_config: Configures the names and properties of jobs. params: Parameters to run with the program. repetitions: The number of circuit repetitions to run. priority: The priority to run at, 0-100. processor_ids: The engine processors that should be candidates to run the program. Only one of these will be scheduled for execution. Returns: An EngineJob. If this is iterated over it returns a list of TrialResults, one for each parameter sweep. """ gate_set = gate_set or gate_sets.XMON engine_program = self.create_program(program, program_id, gate_set) return engine_program.run_sweep(job_config=job_config, params=params, repetitions=repetitions, priority=priority, processor_ids=processor_ids)