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

unclear error message when calling cudaq.adjoint outside of a kernel #1855

Open
3 of 4 tasks
mmvandieren opened this issue Jun 26, 2024 · 0 comments
Open
3 of 4 tasks
Labels
user experience Issue or PR that significantly impacts user experience
Milestone

Comments

@mmvandieren
Copy link
Contributor

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

There is no (or difficult to find) documentation on the cudaq.adjoint operator applied to a kernel to indicate that the behaviors below might not be allowed (unless one has a solid understanding of decorators, which I don't think all of our user base will necessarily have). The error message produced doesn't really help since it seems to indicate that this function doesn't even exist.

error message: module 'cudaq' has no attribute 'adjoint'

Steps to reproduce the bug

def quantum_fourier_transform(qubits: cudaq.qview):
    qubit_count = len(qubits)
    # Apply Hadamard gates and controlled rotation gates.
    for i in range(qubit_count):
        h(qubits[i])
        for j in range(i + 1, qubit_count):
            angle = (2 * np.pi) / (2**(j - i + 1))
            cr1(angle, [qubits[j]], qubits[i])

@cudaq.kernel
def test(q:int):
    qubits = cudaq.qvector(q)
    quantum_fourier_transform(qubits)

test_adj = cudaq.adjoint(test,3)

print(cudaq.draw(test_adj))

Expected behavior

An error message that better explains the problem and doesn't mislead the user that this operation isn't defined at all.

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version: 0.7.1
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response

@bettinaheim bettinaheim added the user experience Issue or PR that significantly impacts user experience label Jul 1, 2024
@bettinaheim bettinaheim added this to the release 0.8.0 milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user experience Issue or PR that significantly impacts user experience
Projects
None yet
Development

No branches or pull requests

2 participants