[dynamics] cp.array() fails and cudaq.evolve fails with cuDensityMatError #3294
-
[dynamics] cp.array() fails and cudaq.evolve fails with cuDensityMatError I am attempting to run the example code in the 'Quick Start' section of the dynamics documentation (for cudaq 0.11.0). The example is: import cudaq
import cupy as cp
from cudaq.dynamics import Schedule
# Set the target to our dynamics simulator
cudaq.set_target("dynamics")
# Dimensions of sub-systems: a single two-level system.
dimensions = {0: 2}
# Initial state of the system (ground state).
rho0 = cudaq.State.from_data(
cp.array([[1.0, 0.0], [0.0, 0.0]], dtype=cp.complex128))
# Schedule of time steps.
steps = np.linspace(0, t_final, n_steps)
schedule = Schedule(steps, ["t"])
# Run the simulation.
evolution_result = cudaq.evolve(hamiltonian,
dimensions,
schedule,
rho0,
observables=[spin.x(0),
spin.y(0),
spin.z(0)],
collapse_operators=[],
store_intermediate_results=True) When I run this I get the following error:
I then set import cupy as cp
a = cp.array([1, 2, 3], dtype=cp.float64)
How can I fix this? If I then change the original code snippet to use numpy instead of cupy in
Are these issues related? I presume they are. Is there a simple fix? My system and versions are the following: === OS & Kernel === === Python === === ENV VARS === === GPU & CuPy === === nvidia-smi === +-----------------------------------------------------------------------------------------+ === Package Versions === === pip freeze (filtered) === |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @calumholker, CUDA-Q is not compatible with the latest cupy version (v13.5+). In the upcoming CUDA-Q release, we constrain the cupy version in the dependency list. For CUDA-Q v0.11, we would need to manually downgrade the cupy version if it's 13.5+, e.g., with |
Beta Was this translation helpful? Give feedback.
Hi @calumholker,
CUDA-Q is not compatible with the latest cupy version (v13.5+). In the upcoming CUDA-Q release, we constrain the cupy version in the dependency list.
For CUDA-Q v0.11, we would need to manually downgrade the cupy version if it's 13.5+, e.g., with
pip install cupy-cuda12x==13.4.1