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

Use rayon and bump-herd to crazy fast parallel search #9

Open
uselessgoddess opened this issue Aug 10, 2022 · 1 comment
Open

Use rayon and bump-herd to crazy fast parallel search #9

uselessgoddess opened this issue Aug 10, 2022 · 1 comment
Labels
Issue:Incomplete Issue: this is incomplete Issue:Middle Issue: requires a set of knowledge Parallel:Rayon Parallel: use potential rayon parallelism

Comments

@uselessgoddess
Copy link
Member

uselessgoddess commented Aug 10, 2022

You can start with this example

fn par_each_impl(..., root: T) {
    if magic_appropriate_to_join(...) {
        rayon::join(
            || par_each_impl(..., left(root)),
            || par_each_impl(..., right(root)),
        )
    } else {
        seq_each_impl(..., root)
    }
}
@uselessgoddess uselessgoddess added Issue:Incomplete Issue: this is incomplete Issue:Middle Issue: requires a set of knowledge Parallel:Rayon Parallel: use potential rayon parallelism labels Aug 10, 2022
@uselessgoddess
Copy link
Member Author

uselessgoddess commented Aug 16, 2022

par_each_iter_impl might look something like this:

fn par_each_iter_impl(..., buf) {
    if magic_appropriate_to_join(...) {
        let mid-cnt = count(left(...)); // mid-cnt + right-cnt == cnt
        rayon::join(
            || par_each_impl(..., buf[..mid-cnt]),
            || par_each_impl(..., buf[mid-cnt..]),
        )
    } else {
        seq_each_iter_impl(..., buf)
    }
}

fn par_each_iter(...) {
    let mut buf = with_capacity(count(...));
    par_each_impl_iter(buf[...])
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue:Incomplete Issue: this is incomplete Issue:Middle Issue: requires a set of knowledge Parallel:Rayon Parallel: use potential rayon parallelism
Projects
None yet
Development

No branches or pull requests

1 participant