AdamNiederer / faster

SIMD for humans
Mozilla Public License 2.0
1.56k stars 51 forks source link

Compatibility with Rayon #7

Closed spease closed 6 years ago

spease commented 6 years ago

It wasn’t clear to me if faster can also work with rayon. I tried the simple example both with into_* and placing par_iter before and after simd_iter with no luck. So it looks to me like this isn’t a supported combination right now, but if it is, an example would be nice.

Thanks!

AdamNiederer commented 6 years ago

You should be able to do something like

vec.par_iter(|a| a.simd_iter().simd_map(|b| ...))

Faster is a library containing operations that can only be executed on a single thread, so it should be perfectly compatible with Rayon.

The above code won't compile on 0.2.1 because the API is unstable, but that should be the gist of it.

spease commented 6 years ago

So I'd need to be using master? Any general idea of when you're planning on making an official version that is compatible?

AdamNiederer commented 6 years ago

0.3.0 is coming out at the end of December, and it breaks more than half the API. You can use 0.2.1 with Rayon as well - I think it's just .into_simd_iter().map(|a| {..}) instead. Just do whatever SIMD operations you want in your per-core closure.

Apologies for the confusion - I've forgotten what 0.2.1 does and doesn't contain at this point.

AdamNiederer commented 6 years ago

0.3.0 has been released, and you should be able to use this with Rayon without much issue. If you have any further questions, feel free to re-open or file another issue.