1

I am trying to compute some unitary matrix for some big circuit on GPU using qiskit-aer, specifically a 11 qubits circuit with the following error:

Simulation failed and returned the following error message:
ERROR:  [Experiment 0] ChunkContainer::StoreUintParams size = 4107/266 iChunk = 0 : cudaErrorInvalidValue

I do not understand what the issue is or how to fix it, the same kind of circuit works with 10 qubits and I should not be short on memory as I am running the experiment on a 32gb V100

Here the code to reproduce the issue

import time
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit.quantum_info import random_unitary

seed = 42

def create_random_unitary(num_qubits, seed=None): return random_unitary(2 ** num_qubits, seed=seed)

num_qubits = 11

circuit = QuantumCircuit(num_qubits)

gate1_qubits = list(range(0, num_qubits))

Gate 2 spans the second set of qubits

gate2_qubits = list(range(0, num_qubits))

left_unitary = create_random_unitary(len(gate1_qubits), seed) right_unitary = create_random_unitary(len(gate2_qubits), seed)

circuit.unitary(left_unitary, gate1_qubits) circuit.unitary(right_unitary, gate2_qubits)

save a fig of the circuit in pics folder

circuit.draw(output='mpl', filename=f'pics/{num_qubits}.png')

simulator = AerSimulator(method='unitary', device='GPU')

circuit.save_unitary()

transpiled_circuit = transpile(circuit, simulator) ## doesn't matter

start_time = time.time()

job = simulator.run(circuit) result = job.result() unitary_matrix = result.get_unitary(circuit)

end_time = time.time()

execution_time_ms = (end_time - start_time) * 1000

print(execution_time_ms)

1 Answers1

1

I'm assuming you're trying to benchmark your GPUs performance but if you're not then removing device='GPU' printed 20046.831846237183 on my local machine and on the qbraid server which should resolve your issue.

Remember that your circuit matrix blows up exponentially so a 2^10 size matrix might have been fine but 2^11 for 11 qubits is double the size this might be too big for your GPU which is suggested by the error message.

broncosaurus
  • 341
  • 5