[Python, Remote-Sim] Cannot use cudaq::complex() for remote simulation
Open
Nobody has claimed this yet.
stale-notified
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
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
Runtime error when using np arrays with dtype=cudaq.complex() on remote simulator.
Steps to reproduce the bug
test.py
import numpy as np
import cudaq
cudaq.set_target("remote-mqpu", url="localhost:3030")
c = np.array([1. / np.sqrt(2.), 1. / np.sqrt(2.), 0., 0.],
dtype=cudaq.complex())
state = cudaq.State.from_data(c)
@cudaq.kernel
def kernel(s: cudaq.State):
q = cudaq.qvector(s)
counts = cudaq.sample(kernel, state)
assert '00' in counts
assert '10' in counts
Run commands (in parallel):
bin/cudaq-qpud --port 3030
python3 test.py
Result:
RuntimeError: [sim-state] invalid data precision.
Note: changing the dtype to complex works.
Expected behavior
Runs successfully when using cudaq.complex() dtype on both nvidia and remote-mqpu targets.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version:
- Python version:
- C++ compiler:
- Operating system:
Suggestions
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in test.py and run bin/cudaq-qpud --port 3030 alongside python3 test.py. Compare the handling of dtype=cudaq.complex() on the remote-mqpu and nvidia targets; done means the remote run completes without the invalid data precision error and both expected counts are present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100