-
Notifications
You must be signed in to change notification settings - Fork 128
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
Optionally auto-scale the number of threads used for alignment and tree building #222
Conversation
If the allowed values for --method are updated without the case-by-case conditional being updated to match, an error will now be thrown instead of the command running with the wrong tree builder (FastTree). This type of defensive or comprehensive check is a common best practice.
It's leftover from when "refine" (née "treetime") and "tree" were the same command, before commit 6832839.
By default, FastTree with OpenMP support uses all available cores. This mismatches the other tree builders we use and the interface presented by the "tree" command (which allows a specific number of threads to be set).
For posterity, @tsibley and I talked about this yesterday with respect to how to make it work on OS X and Windows environments that don't have the same "affinity state" methods. We agreed on two complementary approaches: to default to |
…ee building Passing "--nthreads auto" to the "align" or "tree" commands will use all the available CPU cores. The default is reduced from 2 to 1, which is the only safe assumption. Auto-scaling is not the default because it's not necessarily reasonable to assume that all cores should be used without more information about the system's workload. For example, someone running two simple `augur tree` commands may not reasonably expect them to conflict with each other, but they would with auto-scaling enabled by default. Parallelism requires co-operation and thus an explicit opt-in.
c029d8f
to
40040eb
Compare
Re: our discussion, I've just re-pushed this changing the default and implementing a better fallback cascade for CPU count. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This works for me and I love the use of "auto" for explicitly requesting all cores.
Thanks for the review! |
Uses all the available CPU cores by default instead of just 2. It is still possible to limit the number of threads to a certain number using the
--nthreads
options to "align" and "tree".Auto-scaling by default is particularly nice because it means the same command invocations in Snakefile can make the most of the system they're run on, whether that's a laptop or the cluster or a beefy AWS instance.
This PR builds off PR #217 (the
command-architecture
branch), so should wait to merge until that is merged.