quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.22k stars 1.01k forks source link

program_id or Engine tags on cirq.Circuit #2816

Open mpharrigan opened 4 years ago

mpharrigan commented 4 years ago

When using the QuantumEngineSampler object to run programs on Quantum Engine there is no way to tag programs/jobs with short metadata which allows one to scan active jobs from the web UI.

If you use the Engine object, you can set the program_id parameter which is helpful but comes with its own set of restrictions (restricted character set; limited to 64 chars). "Tags" has been suggested to me as a better solution for this.

In any event, it would be nice if we could add an optional member variable to cirq.Circuit which contains either a program_id or tag to be used by QuantumEngineSampler

dabacon commented 4 years ago

Programs and jobs in Engine have labels which you should be able to set with less restrictions (also they are string string maps)

Because the sampler interface is rigid, we can't add it to the run sweep.

I guess we could add a mutable state on EngineSampler for these job and program fields

sampler = engine.sampler(processor_id='mine', gate_set=my_gate_set)
sampler.set_program_id('mine')
sampler.run_sweep(my_circuit)

You'd need to set it each time, so maybe it would be

sampler.set_next_program_id('mine')

Other ways to do this?

mpharrigan commented 4 years ago

What about having an optional label/program_id attribute on Circuit?

balopat commented 3 years ago

A label on Circuit sounds good to me - we can use that in Circuit diagrams as well as in SubCircuits later. cc @95-martin-orion

dstrain115 commented 6 months ago

Assigning to @wcourtney for triage. Should we allow tags on a circuit that get turned into program labels?