Open nonhermitian opened 3 months ago
Sampler can be made from backend as following
sampler = SamplerV2.from_backend(backend)
I get
QiskitError: 'ERROR: [Experiment 0] a circuit requires more memory than max_memory_mb. , ERROR: a circuit requires more memory than max_memory_mb.'
for a 6 qubit problem when targeting a noisy simulator made from a 127Q backend
I tested with script below and I can reproduce the issue with the same error message
from qiskit import transpile
from qiskit_aer import AerSimulator
from qiskit_aer.primitives import SamplerV2
from qiskit import QuantumCircuit
qc= QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
from qiskit_ibm_runtime import QiskitRuntimeService
provider = QiskitRuntimeService(channel='ibm_quantum')
backend = provider.backend("ibm_kyoto")
sampler = SamplerV2.from_backend(backend)
qc = transpile(qc, backend, optimization_level=0)
job3 = sampler.run([qc], shots=128)
And I found the transpiler fills ancilla qubits in unused qubits like this This causes simulator's memory error.
But when I transpiled as following, I can run the circuit
qc = transpile(qc, basis_gates=backend.configuration().basis_gates, optimization_level=0)
Should we truncate ancilla qubits in Aer?
The memory error issue was fixed in PR #2150 so this will be fixed in Aer 0.15
What is the expected behavior?
I would expect something like this to work: