Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerator ExecutionInfo #353

Closed
amccaskey opened this issue Dec 7, 2020 · 1 comment
Closed

Accelerator ExecutionInfo #353

amccaskey opened this issue Dec 7, 2020 · 1 comment
Assignees

Comments

@amccaskey
Copy link
Contributor

We need a general and extensible for Accelerator backends to supply users with custom execution-related information. A simple example of this may be the quantum state from a simulation Accelerator implementation, or perhaps to run a simulation and then to request specific local expectation values. I would still like to keep the interfaces in xacc/ somewhat co-processor type-agnostic, so I propose we provide a new method to Accelerator that enables one to query this type of execution-related information.

Maybe something like

Accelerator::getExecutionInfo() : HeterogeneousMap
Accelerator::getExecutionInfo<T>(key : string) : T

This would let us also return generators of information

auto local_exp_gen = qpu->getExecutionInfo<std::function<double(Observable&)>>("local-exp-gen");
auto x0x1_exp = local_exp_gen(createObservable("X0 X1").get());

This functionality is pertinent to ORNL-QCI/tnqvm#82 and ORNL-QCI/tnqvm#83

@tnguyen-ornl @DmitryLyakh

@amccaskey amccaskey self-assigned this Dec 7, 2020
@DmitryLyakh
Copy link
Contributor

Yeah, this is a fully dynamic approach how this can done, which looks fine to me. Essentially, each Accelerator implementation is expected to fill in its ExecutionInfo HetMap with the specific execution results. The only thing we need to be careful is what is returned by T to avoid copying large objects, like WaveFunction. As long as we store execution info in the HetMap with shared pointers, it should be OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants