You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#479 According to the response _(@damiansteiger),_ the memory issue is related to the number of qubits, with 40 qubits requiring 16TB of RAM. However, I have tested another circuit with 60 qubits and it runs successfully while using only 1GB of RAM. Below is the code for that:
from projectq import MainEngine
from projectq.ops import H, X, CNOT, Measure,Toffoli
from projectq.backends import CircuitDrawer, ResourceCounter, ClassicalSimulator
# Create a main compiler engine
Simulate = ClassicalSimulator()
eng = MainEngine(Simulate)
# Allocate a qubit register (60 qubits in this case)
qubits = eng.allocate_qureg(60)
# Put the second and third qubits in a simple entangled state
X | qubits[1]
CNOT | (qubits[1], qubits[2])
CNOT | (qubits[12], qubits[2])
CNOT | (qubits[3], qubits[2])
CNOT | (qubits[4], qubits[2])
CNOT | (qubits[5], qubits[2])
CNOT | (qubits[6], qubits[2])
Toffoli | (qubits[3], qubits[2], qubits[11])
Toffoli | (qubits[3], qubits[7], qubits[12])
Toffoli | (qubits[3], qubits[9], qubits[10])
Toffoli | (qubits[3], qubits[0], qubits[13])
CNOT | (qubits[2], qubits[3])
CNOT | (qubits[3], qubits[2])
CNOT | (qubits[4], qubits[2])
CNOT | (qubits[36], qubits[2])
Toffoli | (qubits[5], qubits[0], qubits[1])
Toffoli | (qubits[54], qubits[0], qubits[1])
CNOT | (qubits[10], qubits[2])
CNOT | (qubits[1], qubits[2])
# Measure all qubits
for qubit in qubits:
Measure | qubit
# Execute the quantum circuit
eng.flush()
# Print the measurement results
print("Measured state:", [int(qubit) for qubit in qubits])
Is there is any issuse of simulator usage or any other?
I would greatly appreciate any insights or suggestions on how I might resolve this issue or better understand the underlying cause.
The text was updated successfully, but these errors were encountered:
The question in #479 uses the Simulator which is a full-state simulator which stores the 2^n amplitudes in a vector for an n-qubit simulation and allows all operations.
This code snippet here uses the ClassicalSimulator which does only allow classical operations, see doc. This means it does not need to store any superposition state but only n-bits.
#479 According to the response
_(@damiansteiger),_
the memory issue is related to the number of qubits, with 40 qubits requiring 16TB of RAM. However, I have tested another circuit with 60 qubits and it runs successfully while using only 1GB of RAM. Below is the code for that:Is there is any issuse of simulator usage or any other?
I would greatly appreciate any insights or suggestions on how I might resolve this issue or better understand the underlying cause.
The text was updated successfully, but these errors were encountered: