NVIDIA / NVIDIA/cuda-quantum

Wrap kernel with target

Open
#1,823 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement language RFC stale-notified
Dominant language
C++
Stars
1.1k
Forks
456
Avg merge
1d 22h
Merged PRs (30d)
165

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing set_target implementation and the cudaq.kernel decorator, then trace how targets are selected when kernels execute. The issue does not name specific files or tests; done would mean allowing each kernel to retain its own target so different kernels can run on different architectures without sequential global changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
quantum-computing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.