Wrap kernel with target
Opened this issue · 1 comments
zohimchandani commented
Required prerequisites
- Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
Currently, set_target
is set globally and if we wanted to offload different kernels onto different architectures we could do this:
cudaq.set_target("superconducting")
@cudaq.kernel
def kernel_1()
pass
#execute kernel 1 onto superconducting
cudaq.set_target("photonic")
@cudaq.kernel
def kernel_2()
pass
#execute kernel 2 on photonic now that the target has been changed
This however is not natural and somewhat cumbersome as we have to have things defined in a sequential manner.
I think wrapping a target to a kernel is more natural:
@cudaq.kernel(target = 'superconducting')
def kernel_1()
pass
@cudaq.kernel(target = 'photonic')
def kernel_2()
pass
#execute kernel 1 onto superconducting
#execute kernel 2 onto photonic
bettinaheim commented
I don't think we should mark kernels for specific targets only. We could consider allowing to pass a target to runtime functions like sample and observe instead.