WIP: Speedup of _correlation_3op_dm #2315 through parallel taulist simulations #2395
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.
Objective
The primary objective was to improve the computational efficiency of the
correlation_2op_1t
function in QuTiP. This function computes two-time correlations for quantum systems, which is computationally intensive, especially for large systems or long time arrays. The goal was to enhance performance by parallelizing these computations.Enhancements Overview
Parallel Computing:
concurrent.futures
module, specificallyProcessPoolExecutor
, to parallelize the computation of correlation values over different tau values (taulist
). Each tau value computation is independent of others, making this a suitable case for parallel execution.compute_single_tau_correlation
to handle the computation for a single tau. This function manages the setup of the quantum system, computes the correlation for its specific tau, and handles any exceptions that may occur, logging them accordingly.cpu_count
from theos
module to dynamically determine the number of available processors and limited the number of worker processes to avoid overwhelming the host system. This approach helps in balancing load and performance.Error Handling and Robustness:
Testing:
Implementation Details
correlation_2op_1t
function and by maintaining the original API signature.taulist
arrays, by leveraging multiple CPU cores concurrently.Conclusion
The enhancements to the
correlation_2op_1t
function in QuTiP are designed to harness the capabilities of modern multi-core processors, thereby improving the efficiency of quantum correlation computations. This is still a WIP enhancement.