NVIDIA / cuQuantum

Home for cuQuantum Python & NVIDIA cuQuantum SDK C++ samples
https://docs.nvidia.com/cuda/cuquantum/
BSD 3-Clause "New" or "Revised" License
320 stars 63 forks source link

`CircuitToEinsum` fails for some qiskit `QuantumCircuit` #99

Closed derwind closed 1 month ago

derwind commented 7 months ago

Informations

Python 3.10.12 (Google Colab) qiskit 0.45.0 qiskit-terra 0.45.0 cuquantum-python 23.10.0 cuquantum-python-cu11 23.10.0

What is the current behavior?

Recently, qiskit 0.45.0 was released. According to its release note:

Starting in this release, all unparametrized gates in the Qiskit standard circuit library are now singletons.

This changed the type of CXGate from <class 'qiskit.circuit.library.standard_gates.x.CXGate'> to <class '_SingletonCXGate'>.

So, get_decomposed_gates of circuit_parser_utils_qiskit.py fails if CXGate is used since the condition of #L42 is now False: if 'standard_gate' in str(type(operation)) or isinstance(operation, UnitaryGate):

Steps to reproduce the problem

Executing snippets below leads to AttributeError: 'NoneType' object has no attribute 'qubits' at #L56.

from qiskit import QuantumCircuit
from cuquantum import CircuitToEinsum

qc = QuantumCircuit(2)
qc.cx(0, 1)
converter = CircuitToEinsum(qc)
yangcal commented 7 months ago

Thanks for reporting the issue. This is under our radar and we will address it in our next release.

nathanieltornow commented 1 month ago

Hi all, I came across the same issue in version 23.10 (docker image), but in the newest version (24.03) it works again :) So, I think we can close this issue.

(Maybe we could also update the official website to point to the new version)

yangcal commented 1 month ago

Hello all,

Sorry that we forgot to update the ticket. In cuquantum-python 24.03, we have fixed the bug, see the release notes here. Our newest 24.03 docker container was just recently released and so glad that @nathanieltornow have found this out. We will be soon updating the doc page to point to the latest appliance container. I will mark this issue closed.

Cheers, Yang