Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to leverage all cores for sabre (backport #12780) #12841

Merged
merged 1 commit into from
Jul 29, 2024

Commits on Jul 29, 2024

  1. Add config option to leverage all cores for sabre (#12780)

    * Add config option to leverage all cores for sabre
    
    By default when running sabre in parallel we use a fixed number of
    threads (depending on optimization level). This was a tradeoff made for
    having deterministic results across multiple systems with a fixed seed
    set. However when running qiskit on systems with a lot of CPUs
    available we're leaving potential performance on the table by not using
    all the available cores. This new flag lets users opt-in to running
    sabre with n trials for n CPUs to potentially get better output results
    from the transpiler, with minimal to no runtime overhead, at the cost of
    the results not necessarily being reproducible when run on a different
    computer.
    
    * Apply suggestions from code review
    
    Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
    
    * Rework logic to use the default if larger than CPU_COUNT
    
    This commit refactors the logic added in the previous commit to a single
    helper function. This reduces the code duplication and makes it easier
    to work with. While doing this the logic has been updated so that when
    the flag is set and the default number of trials is larger than the
    CPU_COUNT we use the default. This means the logic when the flag is set
    is to run `max(default_trials, CPU_COUNT)` which should better match
    user expectations around the flag.
    
    ---------
    
    Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
    (cherry picked from commit f8ac2ad)
    mtreinish authored and mergify[bot] committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    175360f View commit details
    Browse the repository at this point in the history