Fix required_memory_mb for MPS and extended stabilizer #1933
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This is the fix for
required_memory_mb
that returned wrong (larger) memory size for MPS and extended stabilizer.Fix for issues #1920 , #1921 and #1927
Details and comments
required_memory_mb
for MPS returned only initial size and returned size in byte not MB so it was very large. I added size estimator to calculate max bond dimension and now it returns reasonable memory size.This size estimation only calculates size of tensors from the input operators and it takes ignorable time, but I think it is not good to call this multiple times. Before this fix,
required_memory_mb
was called from some functions. I changed to call this once at the beginning of simulation.required_memory_mb
for extended stabilizer did not refer to the configurable optionextended_stabilizer_approximation_error
becuaseState::set_config
was not called before callingrequired_memory_mb
.The issue #1921 and #1927 are not resolved as is, but we can decrease required memory size by setting larger
extended_stabilizer_approximation_error
option.