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

a broadcast that only gets executed on idle threads #1163

Open
sarah-quinones opened this issue May 6, 2024 · 0 comments
Open

a broadcast that only gets executed on idle threads #1163

sarah-quinones opened this issue May 6, 2024 · 0 comments

Comments

@sarah-quinones
Copy link

this would be useful for code that needs a known number of threads before entering the parallel region, though im not sure how feasible it is to implement in rayon

example user code could look like this

rayon::broadcast_idle(|num_threads, broadcast| {
    let barrier = std::sync::Barrier::new(num_threads);
    broadcast.run(|ctx| {
        // run task on each thread

        // synchronize
        barrier.wait();
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants