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

Wrap kernel with target #1823

Open
1 task done
zohimchandani opened this issue Jun 16, 2024 · 1 comment
Open
1 task done

Wrap kernel with target #1823

zohimchandani opened this issue Jun 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@zohimchandani
Copy link
Collaborator

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

@zohimchandani zohimchandani added the enhancement New feature or request label Jun 16, 2024
@bettinaheim
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants