Skip to content
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

Implement parallelization using rayon #252

Closed
wants to merge 13 commits into from
Closed

Implement parallelization using rayon #252

wants to merge 13 commits into from

Conversation

bluss
Copy link
Member

@bluss bluss commented Dec 21, 2016

  • IntoParallelIterator for ArrayView, ArrayViewMut, &Array and &mut Array
  • IntoParallelIterator for AxisIter and AxisIterMut

The axis iterators are straightforward. They are indexed and exact length, and in order.

The element iterators have no guaranteed order (so that we can split the array where it's best for memory locality). The inner loop can not be customized yet, but will be when upstream rayon releases fold_with (this is important when the operation is cheap and wants to be autovectorized).

Fixes #248 and much more

@bluss
Copy link
Member Author

bluss commented Dec 21, 2016

@pegasos1 even though implementing these general interfaces first seem like the best starting point, the whole thing already feels very complex. User needs to pick between using the built in higher order methods like map_inplace (that exist because iterators are not as efficient as a custom loop inside map inplace), and using these parallel iterators.

@bluss
Copy link
Member Author

bluss commented Dec 22, 2016

To go further, the higher order methods themselves can be parallelized.

  • map: array f -> array Needs custom collect
  • map_inplace can use this PR internally
    • Possible sketch API: parallel(&mut a).map_inplace(|x| *x = x.exp())
    • Possible sketch API: a.map_inplace(parallel(|x| *x = x.exp()))
    • I favour the second one. It can be extended with options later (parallel(f).max_threads(2)).

Much later: Parallelize array zip.

@bluss
Copy link
Member Author

bluss commented Jan 18, 2017

Superseded for now #264

@bluss bluss closed this Jan 18, 2017
@bluss bluss deleted the par-iter-2 branch March 15, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant