Rayon alternatives #1072
Replies: 7 comments 9 replies
-
|
Looks like the thread pool, at least, is on the orx-parallel roadmap: orxfun/orx-parallel#82 Maybe it'd be worth asking the author about Wild's graph algorithms via discussion? Regarding |
Beta Was this translation helpful? Give feedback.
-
|
I filed an issue on the orx-parallel repo to ask about scopes. The situation with per-thread init functions looks better with orx-parallel than it is with rayon's |
Beta Was this translation helpful? Give feedback.
-
|
Hello all! I'm a contributor to So I've been working on a new thread pool called It supports spawn (for both futures and closures), join, scopes, and scoped spawns (also for both futures and closures). There's no broadcast or parallel iterators yet, but I am working on them (and these will eventually include something basically identical to It's very likely you won't be able to use it in it's current state. But if yall are interested in the general direction and are able to provide a list of blockers, I'd be happy to work on resolving them so that you can evaluate it properly. |
Beta Was this translation helpful? Give feedback.
-
|
Another alternative that was suggested on Reddit is spindle. It seems to be built on top of rayon, but is optimised for small tasks. The README is still pretty minimal, so I'm guessing it's still early days yet, but worth keeping an eye on. |
Beta Was this translation helpful? Give feedback.
-
Random idea: could you create a On top of that you might want to set a minimum chunk length in rayon to force at least that many items to be processed at once in a thread, which should guaranteed the init closure to be run only once for all of them. |
Beta Was this translation helpful? Give feedback.
-
|
Just throwing this in here: https://docs.rs/tokio-par-util/latest/tokio_par_util My uninformed guess would be that there is some static overhead with setting up the tokio scheduler, which will probably have diminishing impact the more compute is actually used for linking. So likely overall slower then Rayon for small projects, but similarly fast in bigger projects, and that of course with better ecosystem integration and the likes. |
Beta Was this translation helpful? Give feedback.
-
|
I've missed that discussion was happening here, so apologies for the copy-paste from #1127. I'd like to pitch paralight that I've been working on, a lightweight parallelism built from scratch on a different architecture than Rayon. It's not complete yet (hence the alpha version 0.0.6) and won't support all the patterns that Rayon offers (Paralight targets parallelizing sequential objects such as slices), but as a trade-off it brings performance improvements on the supported cases. In particular, Paralight indeed supports a One caveat is that a thread pool must be explicitly passed on each call to create a parallel iterator, and that each parallel pipeline must have exclusive access to the thread pool (via a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Rayon serves us pretty well. We do have some problems though. For example, it runs the init closure passed to
try_for_each_initonce for each work item instead of once for each thread. This is pretty wasteful, since each call allocates a new arena, so for 32 threads we end up with about ~1000 arenas instead of 32. It's also hard to be sure what the overhead of rayon is unless we try other things.Unfortunately, we make so much use of rayon that switching to anything else is pretty hard. In addition to the usual
par_iter, we also usepar_bridge, join, scopes, spawn, scoped spawning and spawn_broadcast.I've just had a look at orx-parallel which looks interesting. The two main issues that I've observed, without actually trying to do any conversion, so there may be more are:
WorkQueue<T>where some initial work could be added to the queue, then more work could be added to the queue in response to processing other items from the queue.Another possibility is chili. This is lower level and only provides
join. We'd probably need some abstractions built on top of this before using it would be practical.There's a fork of rayon that uses chili. I'm not sure how actively this is being worked on. It doesn't have its own repository, but lives in a repository with other stuff. It also doesn't appear to support scopes or anything else that we could use to implement our graph algorithms.
Beta Was this translation helpful? Give feedback.
All reactions