Qiskit-Extensions / qiskit-experiments

Qiskit Experiments
https://qiskit-extensions.github.io/qiskit-experiments/
Apache License 2.0
151 stars 122 forks source link

Serialize CompositeAnalysis execution #1425

Open wshanks opened 3 months ago

wshanks commented 3 months ago

CompositeAnalysis was calling run() on each subcomponent, which starts a new thread for each one, and then waiting on all of them to finish. Because of the way Python executes threads only one thread executes Python code at a time and there is not much performance benefit to starting all the threads at once. Here, the code is changed to wait for each subcomponent's run() to complete before starting the next one. Executing sequentially like this avoids starting an uncontrolled numbers of threads simultaneously.

This is a temporary mitigation and a wider refactor should be done to handle analysis execution better.