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
Making custom backends is much more difficult than previous releases #1828
Comments
The So creating another one shouldn't be hard if you just derive from |
True, that is where I got it from, but I should not need to know about |
maybe @diego-plan9 can comment on whether some of those fields can be turned into a default value if not provided. or if there's a way to turn off validation so the validator does not complain. So would write something like:
Here you would only add the I'm open to moving FakeBackend elsewhere and highlighting its use. But this is all part of standardizing the configuration format. |
I'd rather turn the attention to:
Can you elaborate on the need for them, and the use case and scenarios/flow where the need arises? It might hint towards a different problem (the compilation process as a whole being too "bound" to a backend instance in some steps where just requiring the relevant pieces of data would be enough and more flexible). If that is the case and the need is common enough, I'd rather try to tackle the root cause via some reorganizing instead of introducing the concept of a fake backend as part of terra. |
I basically solved this myself in #1837. However, many times you want to create a custom topology and compile against it. For example, a linear chain 0 - 1 - 2 - 3 is an useful backend to have. Compiling against this backend gives you generic circuits that you can then run on an actual device using the |
Can you share a minimal example of the relevant parts where you use a fake backend for that purpose? |
It is easy |
I think #1837 really solves all the issues. |
After some digging, it seems that the issue boils down to the need of specifying a compile(circuits, backend=None, coupling_map=foo, basis_gates=bar) (since it calls Depending on how needed this feature is, we could think of sweetening it a bit in terra - either via some convenience functions that are a variation of : def generic_compile_with_a_custom_coupling_map_etc(circuits, coupling_map):
return compile(circuits, backend=None,
coupling_map=coupling_map, basis_gates=sensible_default) or by revising the current |
I am not sure why there is so much hesitation to expose to users a functionality that we use ourselves, but I will close this issue, and #1837 and just add the routine to my "user space" |
@jaygambetta also wants to change the |
No worries, I can add it to an addons package in the mean time |
What is the expected behavior?
In Terra-0.6 one could create a custom backend to compile against by simply doing:
Now it requires the following:
Creating custom, abstracted backends is very convenient for creating generic instances of circuits that can later be mapped to a given actual backend via
initial_layout
. There should be a helper function that makes building these objects easier.The text was updated successfully, but these errors were encountered: