Large scale Clifford circuit simulation


Does pennylane support large scale Clifford circuit simulations?
When I tried to run a circuit more than 32 qubits, I get the following error. I understand in general this blows up exponentially, however is there any device specifically for Clifford circuits?

--> 184 self._state = self._create_basis_state(0)
ValueError: maximum supported dimension for an ndarray is 32, found 35


Hey @yan_c! This is likely behaviour in NumPy that’s limiting the number of qubits at 32. Speaking with some folks on the PL performance team, it probably allows for better performance with static allocations. See here: numpy/ndarraytypes.h at maintenance/1.23.x · numpy/numpy · GitHub

Thank you, and yes, that’s right. Numpy throws an error because currently it’s initializing an array in _create_basis_state() like this

self._reshape(state, [2] * self.num_wires)

Can I get around this somehow? What do you mean by static allocations?

You can try using jax:

import pennylane as qml
import jax
import jax.numpy as jnp

from jax.config import config
config.update("jax_enable_x64", True)

dev = qml.device('default.qubit.jax', wires=33)
1 Like