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

is rayon turned on in conda-forge releases? #3314

Open
ctb opened this issue Aug 30, 2024 · 0 comments
Open

is rayon turned on in conda-forge releases? #3314

ctb opened this issue Aug 30, 2024 · 0 comments

Comments

@ctb
Copy link
Contributor

ctb commented Aug 30, 2024

@dkoslicki asks on matrix:

quick question: is sourmash sketch dna now multithreaded in 4.8.11? My understanding was that it was single threaded, but I just noticed via top and time that a single sourmash sketch dna command is taking something like 100+ threads on my server (i.e. %CPU around 20000%). And no updated in the docs that mentions controlling the number of threads used...

first - sourmash-rs uses rayon for parallelism, and for rayon, the environmental variable RAYON_NUM_THREADS can be used to control the expected number of threads. Setting this to e.g. 16 should limit rayon to using 16 threads.


second - my understanding is that Rust-based parallelism is enabled conditionally in the Rust codebase, using the parallel feature (which is automatically turned on by the branchwater feature, as in e.g. the branchwater plugin). It looks like this may be enabled by default in pyproject.toml:

features = ["maturin", "branchwater"]

which is cool, if so, but should probably be documented somewhere! ;)


aaaaand third - yes, it looks like sketching operates in parallel at the level of multiple sketch types, e.g if you are doing a bunch of different k-mer sizes, then each k-mer size is sketched ! see:

pub fn add_sequence(&mut self, seq: &[u8], force: bool) -> Result<(), Error> {
cfg_if! {
if #[cfg(feature = "parallel")] {
self.signatures
.par_iter_mut()
.try_for_each(|sketch| {
sketch.add_sequence(seq, force) }
)?;


so that's cool :).

So my end take is: I think we should probably document this somewhere!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant