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
It would be nice to know what is the memory required before executing a circuit using a simulator.
It is impossible to exactly know the memory needed when using the extended_simulator. Looking at the code extended_stabilizer_state.hpp. The formula required_chi() used by the extended simulator does not seem to be only a function of the exact gate counts in the circuit
size_t State::required_memory_mb(uint_t num_qubits,
const std::vectoroperations::Op &ops) const {
size_t required_chi = compute_chi(ops.cbegin(), ops.cend());
// 5 vectors of num_qubits*8byte words
// Plus 2*CHSimulator::scalar_t which has 3 4 byte words
Here is an example that shows this would help if knowing the exact memory required per circuit.
Consider 2 different circuits, with the following gates (CircuitA is having less gates than CircuitB) :
I found issue in calling required_memory_mb function that State::set_config is not called before calculating required memory. In extended stabilizer, extended_stabilizer_approximation_error was not set from config parameters. This parameter can control size requirement when setting lerger error acceptance
By the way, extended stabilizer allocates state buffer whose size is calculated by the same logic as compute_chi function at beginning. I think setting larger extended_stabilizer_approximation_error is the only way to decrease memory usage
What is the expected behavior?
It would be nice to know what is the memory required before executing a circuit using a simulator.
It is impossible to exactly know the memory needed when using the extended_simulator. Looking at the code extended_stabilizer_state.hpp. The formula
required_chi()
used by the extended simulator does not seem to be only a function of the exact gate counts in the circuitHere is an example that shows this would help if knowing the exact memory required per circuit.
Consider 2 different circuits, with the following gates (Circuit A is having less gates than Circuit B) :
Circuit A
OrderedDict([
('u1', 272),
('sx', 133),
('cx', 114),
('h', 36),
('measure', 36)])
Circuit B
OrderedDict([
('u1', 480),
('cx', 228),
('sx', 216),
('h', 36),
('measure', 36)])
Then execute those 2 circuits on the
extended_stabilizer
Circuit A is failing with message
while Circuit B works. (even though Circuit B is much bigger than Circuit A)
The text was updated successfully, but these errors were encountered: