Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set use_symengine on qpy generation if symengine is installed
This commit sets the use_symengine flag during qpy export used during job payload generation if symengine is installed. For qiskit <1.0 symengine is a hard dependency on platforms that have support for it (x86_64, aarch64, and ppc64le linux and macOS) and an optional requirement on other qiskit supported platforms, and when available it greatly improves the runtime performance of symbolic expressions in Qiskit. By default QPY opts for the more compatible sympy representation of an unbound ParameterExpression as it's maximally compatible, and means that no matter the environment the payload will be loaded from it will be able to parse the payload. In QPY version 10 a new flag was added to the payload definition that enables users to use a native binary symengine representation of a symbolic expression that is significantly faster to generate and parse, but it still defaults to sympy as using this flag limits the compatibility of the payload. However, for runtime job submission we know that the service always has symengine available so we should be using this flag for job submission if the local environment has symengine installed as it will greatly speed up the serialization of unbound ParameterExpression objects. In Qiskit 1.0, symengine is promoted to a hard requriment for all environments and use_symengine=True is the default in Qiskit's qpy module. But, setting it like this is still a good idea as it will always be safe to do this, it's just in qiskit 1.0 symengine will always be installed.
- Loading branch information