cuda-quantum icon indicating copy to clipboard operation
cuda-quantum copied to clipboard

[Python, Remote-Sim] Cannot use cudaq::complex() for remote simulation

Open annagrin opened this issue 6 months ago • 0 comments

Required prerequisites

  • [X] 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.
  • [X] Make sure you've read the documentation. Your issue may be addressed there.
  • [X] 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

annagrin avatar Jul 31 '24 19:07 annagrin