Closed danitrod closed 3 years ago
Can you provide code example as well as logs from "running Rayon conventionally"? It's hard to tell what's going on, but some extra info could help to narrow it down.
In theory, it should be purely Rayon issue as we don't really do anything special except spawning threads, so I'm surprised there is some difference between platforms.
Sure thing, I'm trying to produce a minimal example to share
Looks like this is my mistake, I misunderstood the way find_any
actually works. It doesn't stop any already running search, just stops the par_iterator from returning more elements when a value is found. Running conventionally actually does result in the same behaviour, I just wasn't logging in the same way. Sorry if this caused any trouble.
Ah glad you found the root cause.
When using
.find_any
or.find_map_any
on aParallelIterator
, I expected my main worker to have the first found value returned as soon as one of the workers found it and stop searching (which does happen running Rayon conventionally). However, the main worker waits for a result on every worker to stop searching. Below a screen shot of my application logs to better clarify - I am searching with a range divided between threads, and the main thread always waits until every worker finished searching to proceed. I wanted it to finish once I had the first result.Happy to provide more details on my application if needed.
Perhaps this is a too specific issue that needs to be handled directly in Rayon? Not sure