NVIDIA / NVIDIA/cuda-quantum

observe() generates more kernels than necessary

Open
#2,534 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement 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

cudaq.observe seems to generate more kernels/programs than necessary. E.g. one of the internal test cases

hamiltonian = (5.907 - 2.1433 * spin.x(0) * spin.x(1) -
                   2.1433 * spin.y(0) * spin.y(1) + 0.21829 * spin.z(0) -
                   6.125 * spin.z(1))

generates 4 kernels that are executed separatly, but 3 should be sufficient, since z(0) and z(1) can be sampled in the same shot.
Is this a feature that I simply have to enable, or is this just not implemented yet?

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 with the cudaq.observe entry point and the internal test case described in the issue. Trace how Hamiltonian terms become executed kernels, focusing on whether z(0) and z(1) can share a shot. Done means the example uses three executions instead of four, with coverage in the relevant internal test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
quantum-computing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.