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
Currently, generating a backend with AerSimulator() does not cache the .target property. The target is only cached if AerSimulator._from_backend is set by passing a target to AerSimulator's constructor. The target generation is somewhat expensive, about 0.7 seconds on my machine. When looping over circuits, this time can add up. Looking at the code, I think the target could be cached safely as long as the cache was invalidated by calling set_option since that is the only supported way of changing configuration() and properties() which are the only things AerSimulator.target references.
I noticed this when finally tracking down why some code that looped over circuits calling transpile had gotten slow (it had been slow for a while, probably since support for BackendV2 was added to Aer). I can address it locally by changing the code to call transpile on the lists of circuits but it would still be worth considering doing this caching if it seems reasonable to the maintainers.
The text was updated successfully, but these errors were encountered:
What is the expected behavior?
Currently, generating a backend with
AerSimulator()
does not cache the.target
property. The target is only cached ifAerSimulator._from_backend
is set by passing atarget
toAerSimulator
's constructor. The target generation is somewhat expensive, about 0.7 seconds on my machine. When looping over circuits, this time can add up. Looking at the code, I think the target could be cached safely as long as the cache was invalidated by callingset_option
since that is the only supported way of changingconfiguration()
andproperties()
which are the only thingsAerSimulator.target
references.I noticed this when finally tracking down why some code that looped over circuits calling
transpile
had gotten slow (it had been slow for a while, probably since support forBackendV2
was added to Aer). I can address it locally by changing the code to calltranspile
on the lists of circuits but it would still be worth considering doing this caching if it seems reasonable to the maintainers.The text was updated successfully, but these errors were encountered: