NVIDIA / NVIDIA/cuda-quantum

Perform hybrid computations in parallel

Open
#1,097 0 comments 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

A simple hybrid algorithm to minimize a cost function looks something like this in CUDAQ:

import cudaq 
from cudaq import spin 
import numpy as np 

kernel, params = cudaq.make_kernel(list)
qubits = kernel.qalloc(1)
kernel.rx(params[0], qubits[0])

hamiltonian = spin.z(0)
  
    
def cost(parameters):
    return cudaq.observe(kernel, hamiltonian, parameters).expectation()

optimizer = cudaq.optimizers.COBYLA()
optimizer.initial_parameters = np.random.uniform(0,1, 1)   
optimizer.max_iterations = 50

result = optimizer.optimize(dimensions = 1, function=cost)

The minimization procedure runs the observe call in tandem with classical processing.

I would like to execute multiple minimization procedures in parallel. The observe call could be replaced with observe_async however the classical processing done by COBYLA will require one to set up a multiprocessing loop spawning multiple threads to achieve this.

We would like users to not have to manually set up the multiprocessing loop but rather have a minimize_async functionality. This would be similar in scope to the vqe functionality we have but one where we can minimize different kernels and hamiltonians in parallel.

cc @mmvandieren

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 Python optimization example in the issue and review the existing vqe functionality as the closest reference point. Define how a minimize_async API should run multiple kernel and Hamiltonian minimizations in parallel without user-managed multiprocessing, then add coverage for the supported behavior.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.