-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Feature Request: OpenMP/TBB like Parallel For Loops #12619
Comments
Blocked on #11781 for memory safety. See the following for an outline of the current plan to allow constructing memory-safe fork-join libraries
It might end up looking something like (or something completely different...) // sequential
for (bi, ai) in bi.mut_iter().zip(ai.iter()) {
*bi = foo(*ai)
}
// parallel
par_for(bi.mut_iter().zip(ai.iter()), |(bi, ai)| {
*bi = foo(*ai);
}) (The simple interface above won't necessarily be able to get 100% the performance of TBB and OMP---the cost of memory safety---but I imagine more technical ones can get pretty close.) |
Also blocked on #12624, at least to have the API I want. |
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#859 |
For anyone who finds this issue by googling "rust OpenMP", take a look at Rayon. |
Handle `rustc_on_unimplemented` in duplicated_attributes ```rust #[rustc_on_unimplemented( on( _Self = "&str", label = "`a" ), on( _Self = "alloc::string::String", label = "a" ), )] ``` The lint treats this as a repetition because `rustc_on_unimplemented::on::label` appears twice, but that's ok. Fixes rust-lang#12619 changelog: [`duplicated_attributes`]: fix handling of `rustc_on_unimplemented`
Is it possible to have some easy to use parallel for loops like OpenMP or Intel TBB in Rust? As far as I know their parallel for loops divide the range by CPU cores (or specified worker threads), then every worker thread will access a sequential stream of data in memory (better CPU cache utilization) and idle worker threads are also able to steal tasks from busy ones to balance the load (which is optional in OMP, and the default for the TBB).
Serial code:
Intel TBB example:
OpenMP example:
The text was updated successfully, but these errors were encountered: