Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 29 10:33
    willcrozi ready_for_review #970
  • Sep 29 10:32
    willcrozi synchronize #970
  • Sep 26 19:20
    cuviper synchronize #964
  • Sep 25 04:29
    BedDweller closed #980
  • Sep 25 02:18
    BedDweller opened #980
  • Sep 24 19:32
    bors[bot] closed #978
  • Sep 24 19:32

    bors[bot] on master

    Fix typos Found via `codespell… Merge #978 978: Fix typos r=cu… (compare)

  • Sep 24 19:27

    bors[bot] on staging

    Fix typos Found via `codespell… Merge #978 978: Fix typos r=cu… (compare)

  • Sep 24 19:27

    bors[bot] on staging.tmp

    (compare)

  • Sep 24 19:27

    bors[bot] on staging.tmp

    [ci skip][skip ci][skip netlify] (compare)

  • Sep 24 19:27

    bors[bot] on staging.tmp

    Fix typos Found via `codespell… [ci skip][skip ci][skip netlify… (compare)

  • Sep 24 12:24
    kianmeng review_requested #978
  • Sep 24 12:23
    kianmeng synchronize #978
  • Sep 24 12:22
    kianmeng edited #978
  • Sep 24 12:22
    kianmeng synchronize #978
  • Sep 24 12:21
    kianmeng synchronize #978
  • Sep 24 12:07
    willcrozi synchronize #970
  • Sep 23 23:07
    bors[bot] closed #979
  • Sep 23 23:07

    bors[bot] on master

    Fix tiny typo in licensing sect… Merge #979 979: Fix tiny typo … (compare)

  • Sep 23 23:01

    bors[bot] on staging

    Fix tiny typo in licensing sect… Merge #979 979: Fix tiny typo … (compare)

enjoinedmot
@enjoinedmot:matrix.org
[m]
the very next line is .step_by(c as usize) - where c is a variable that's set a long way up the stack.
So I would think .step_by() would consume the result of the previous line. Which would be reached in a non-deterministic way, but would in fact always result in the same return.
but I am not an expert so I thought I would ask. 😅
WGH
@WGH:torlan.ru
[m]
usually rayon is used in such way it wouldn't matter
enjoinedmot
@enjoinedmot:matrix.org
[m]
It's better to know I should be concerned with such a change rather than just assuming it's okay though. 😄 thank you @djc and WGH for responding.
I appreciate your crate! I might be spending more time with it soon... 😄
WGH
@WGH:torlan.ru
[m]
I mean it's usually wrapping a bit of logic that's trivially parallelizable, and the results are aggregated in a way it's easy to reason about
What method is called on the resulting iterator, for instance?
enjoinedmot
@enjoinedmot:matrix.org
[m]
.step_by()
WGH
@WGH:torlan.ru
[m]
And then?
enjoinedmot
@enjoinedmot:matrix.org
[m]
.ennumerate()
WGH
@WGH:torlan.ru
[m]
Those are unsubstantial
enjoinedmot
@enjoinedmot:matrix.org
[m]
I think my core question is - will .step_by() ever see anything different by changing to .into_iter() rather than into_par_iter()? If it does, then I need to get into the trait bound issues.
I might need to anyway, but... 😅
If this is a 'fix' that only slows performance, that might mean I could wait to return to this issue
WGH
@WGH:torlan.ru
[m]
It won't, but this is the wrong question, because things down the line might change
But this whole question looks silly: I can imagine a code that breaks from parallelization because it assumes particular determinism
But other way around, i.e. breaking code that never assumed anything by removing nondeterminism... sounds weird
1 reply
enjoinedmot
@enjoinedmot:matrix.org
[m]
thank you WGH
HackerFoo
@hackerfoo:sandbox.hackerfoo.com
[m]
Rayon tests fail on my machine. I'm not sure if it's the new compiler or M1 Mac specific: rayon-rs/rayon#956
Ritchie Vink
@ritchie46

Hi all.. We use rayon extensively in polars and can have multiple levels of par_iter.

Now my understanding is that if the outer par_iter has sufficient groups and the inner par_iter also has many groups we can get stackoverflow due to work stealing.

I believe this can be resolved by setting with_min_len and that is a solution I want to investigate. But before I do so I have a question of another possible path.

Is it possible to retrieve the depth of par_iter calls? . Something like this. This shows two levels of nesting, but we can actually have more.


// this would be level 1
fn inner_work(seq) {
    if par_level == 0 {
        seq.par_iter().some_work()
    } else {
       seq.iter().some_work()
    }
}

// this would be level 0
fn outer_work(seq) {
   seq.par_iter().map(inner_work).collect()
}
wagnerf42
@wagnerf42
hi
we could actually write an adaptor giving you access to that info but i don't think any of the actual adaptors will allow you to retrieve it
outside of manually splitting with rayon::iter::split
Ritchie Vink
@ritchie46
That would be great. Would that be in the scope of the project? It would make it much easier for use to predict if some parallelizing job might sefgault due to SO or not.
Josh Stone
@jistone:fedora.im
[m]
could you pass your own par_level parameter through inner_work/some_work()?
I guess it depends whether you just want par_iter nesting, or the full depth of work-stealing nesting -- but we don't really track that
Ritchie Vink
@ritchie46

could you pass your own par_level parameter through inner_work/some_work()?

In this trivial example we can. But in polars we can have aribitrary nesting as expressions may call expressions. It is very hard to track in there are so many operation that may par_iter and may be very deep.

I guess it depends whether you just want par_iter nesting, or the full depth of work-stealing nesting -- but we don't really track

I am only interested in the par_iter nesting. Then we could apply a rule of thumb that the outer level has parallelization priority and can make the inner levels 1..n sequential.

xmac94x
@xmac94x:matrix.org
[m]
Hi everyone :) I just noticed some weird behavior on our game velorem where we are waiting for some threads to finish in places where we wouldn't have thought they would. I opened a issue with the details: rayon-rs/rayon#969 . Not sure if this is a bug, but we noticed that a threadpool.spawn inside a parallel iterator will let the parallel iterator wait until the spawn completed. Which is not always what we want. Do you know any good workaround for that problem ? Maybe already others experienced it (:
Josh Stone
@jistone:fedora.im
[m]
xmac94x: I think this is the nature of work-stealing, but see my reply on the issue for gory details
(also, don't take my word as gospel!)
xmac94x
@xmac94x:matrix.org
[m]
I understand that rayon is using work-stealing, but not why its not having a check to not steal unreleated work inside a par_iter ? Or even steal work from other scopes
Josh Stone
@jistone:fedora.im
[m]
it has no concept of what is "related"
there's one global queue for each pool, and each thread within the pool has a local deque
Miguel Raz Guzmán Macedo
@miguelraz
Hello!
I'm looking for a good collection of serial vs Rayon's parallelization benchmarks snippets
Thinking of stuff like
Dot product calculation,
Independently processing many strings in a big file
or anything numeric/related to linear algebra
Josh Stone
@jistone:fedora.im
[m]
rayon-demo (in the rayon repo) has some, not sure if you'd call them "good" though ;)
Miguel Raz Guzmán Macedo
@miguelraz
@jistone:fedora.im yup, those seem just like what I wanted. What's the command to run them though? cargo bench in the rayon/rayon-demo dir?
:sweat:
whoknow
@whoknow:matrix.org
[m]
Hi, somewhere in my code I need to check a big vector (also some times it can be small) for finding some data in it (Im using data.iter().find(...) in old method) its work good, I didn't notice any kind of performance lost in it, but I was thinking changing it so it search in parallel using rayon make sense? I mean there is any cost for rayon to spawn the threads everytime Im calling it? (as I said it would so many times...)
at the end is it worth it for use it in this kind of situations?
Josh Stone
@jistone:fedora.im
[m]
rayon keeps a threadpool, so after the first time it won't be spawning any new threads
3 replies
(unless you explicitly create your own ThreadPool each time)
whoknow
@whoknow:matrix.org
[m]
also one other thing, is it possible to use rayon inside normal loops?
2 replies
WGH
@WGH:torlan.ru
[m]
No clue about Windows, never really used it for any development work
On Linux, I'd use perf, if that helps
No, you can't
Josh Stone
@jistone:fedora.im
[m]
the language for loops are hard-coded to the regular Iterator trait
but if you can rewrite that with Iterator::for_each, then this can translate to ParallelIterator::for_each
I have a crate that hacks that transformation with a procedural macro: https://crates.io/crates/rayon-macro