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

TensorNetwork converter fails on some random all-to-all connected circuits #88

Closed
erinaldiq opened this issue Mar 21, 2024 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@erinaldiq
Copy link
Collaborator

erinaldiq commented Mar 21, 2024

I get this error after calling TensorNetwork(circuit) using cuQuantum 23.10 and pytket-cutensornet 0.5.2

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[34], line 2
      1 # Set the operand data (same on all processes).
----> 2 ket = TensorNetwork(circuit)
      3 ovl = ket.vdot(ket)
      4 if rank == root: print(f"Contracting {int(len(ovl)/2)} tensors.")

File ~/.conda/envs/py-cuquantum-23.10.0-mypich-py3.11/lib/python3.11/site-packages/pytket/extensions/cutensornet/tensor_network_convert.py:68, in TensorNetwork.__init__(self, circuit, adj, loglevel)
     63 self._logger.debug(
     64     f"NX output index to (possibly re-labeled) qubit objects map: "
     65     f"{self._output_index_to_qubit}"
     66 )
     67 self._network = self._graph.as_nx()
---> 68 self._node_tensors = self._assign_node_tensors(adj=adj)
     69 self._node_tensor_indices, self.sticky_indices = self._get_tn_indices(
     70     self._network, adj=adj
     71 )
     72 self._cuquantum_interleaved = self._make_interleaved()

File ~/.conda/envs/py-cuquantum-23.10.0-mypich-py3.11/lib/python3.11/site-packages/pytket/extensions/cutensornet/tensor_network_convert.py:211, in TensorNetwork._assign_node_tensors(self, adj)
    209             self._logger.debug(f"Adding a downward gate tensor")
    210     else:
--> 211         node_tensors.append(self._gate_tensors[node[1]["desc"]][0])
    212         self._logger.debug(f"Adding a 1-qubit gate tensor")
    213 else:

IndexError: list index out of range

circuit is saved in the json file
issue_circuit.json
and it has

Counter({<OpType.PhasedX: 68>: 416,
         <OpType.Rz: 36>: 288,
         <OpType.ZZPhase: 73>: 128})

There are not measurements and no classical wires.
If I rebase to the gateset {X,RZ,CX} I get the same error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[18], line 2
      1 # Set the operand data (same on all processes).
----> 2 ket = TensorNetwork(circuit)
      3 ovl = ket.vdot(ket)
      4 if rank == root: print(f"Contracting {int(len(ovl)/2)} tensors.")

File ~/.conda/envs/py-cuquantum-23.10.0-mypich-py3.11/lib/python3.11/site-packages/pytket/extensions/cutensornet/tensor_network_convert.py:68, in TensorNetwork.__init__(self, circuit, adj, loglevel)
     63 self._logger.debug(
     64     f"NX output index to (possibly re-labeled) qubit objects map: "
     65     f"{self._output_index_to_qubit}"
     66 )
     67 self._network = self._graph.as_nx()
---> 68 self._node_tensors = self._assign_node_tensors(adj=adj)
     69 self._node_tensor_indices, self.sticky_indices = self._get_tn_indices(
     70     self._network, adj=adj
     71 )
     72 self._cuquantum_interleaved = self._make_interleaved()

File ~/.conda/envs/py-cuquantum-23.10.0-mypich-py3.11/lib/python3.11/site-packages/pytket/extensions/cutensornet/tensor_network_convert.py:211, in TensorNetwork._assign_node_tensors(self, adj)
    209             self._logger.debug(f"Adding a downward gate tensor")
    210     else:
--> 211         node_tensors.append(self._gate_tensors[node[1]["desc"]][0])
    212         self._logger.debug(f"Adding a 1-qubit gate tensor")
    213 else:

IndexError: list index out of range
@erinaldiq
Copy link
Collaborator Author

Same error with the updated version of pytket-cutensornet = v0.5.4

@PabloAndresCQ PabloAndresCQ self-assigned this Mar 27, 2024
@PabloAndresCQ PabloAndresCQ added the bug Something isn't working label Mar 27, 2024
@PabloAndresCQ PabloAndresCQ mentioned this issue Mar 27, 2024
3 tasks
@PabloAndresCQ
Copy link
Collaborator

Fixed by #90. @erinaldiq are you able to use pytket-cutensornet installed from a local repo? So that you can use the fix without need for an immediate release.

@erinaldiq
Copy link
Collaborator Author

I do not need a release. Let me try if it gets installed properly on Perlmutter.

@PabloAndresCQ
Copy link
Collaborator

Closing now that the bugfix #90 is merged in develop. Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants