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

sort to accept DynamicView and [begin,end) indices #691

Closed
bathmatt opened this issue Mar 17, 2017 · 6 comments
Closed

sort to accept DynamicView and [begin,end) indices #691

bathmatt opened this issue Mar 17, 2017 · 6 comments
Assignees
Labels
Enhancement Improve existing capability; will potentially require voting

Comments

@bathmatt
Copy link

I need to sort DynamicViews. To do so I need to create a subview of a dynamic view.
Here is my routine

Can we add at least subviews with slightly smaller lengths for dynamic view?


  int max_elems = MapContainer::getElementMap()->getNodeNumElements();
  int min_elems = 0, num_elems = max_elems-min_elems+1;
  BinOp binner(num_elems, min_elems, max_elems);

  Kokkos::pair<size_t, size_t> reduced_size(0,size());
  KeyViewType local_ielement = Kokkos::subview(element_, reduced_size);

  Kokkos::BinSort<KeyViewType , BinOp > Sorter(local_ielement,binner,false);
  Sorter.create_permute_vector();
  Sorter.sort< KeyViewType >(local_ielement);

  Sorter.sort(Kokkos::subview(x_, reduced_size));
  Sorter.sort(Kokkos::subview(x_ref_, reduced_size));
  Sorter.sort(Kokkos::subview(v_, reduced_size));
  Sorter.sort(Kokkos::subview(v_ref_, reduced_size));
@crtrott
Copy link
Member

crtrott commented Mar 18, 2017

Would it be sufficient to provide only a subview function outside of parallel kernels?
Also: as a minimum requirement subviews would not be growable themselves, and shrinking the original view while a subview exist is undefined behavior.

@bathmatt
Copy link
Author

bathmatt commented Mar 18, 2017 via email

@crtrott crtrott added the Enhancement Improve existing capability; will potentially require voting label Mar 20, 2017
@hcedwar
Copy link
Contributor

hcedwar commented Apr 5, 2017

@bathmatt : how urgent?
This appears to be two enhancements:

  • subview of DynamicView and
  • sort algorithm to accept subview of DynamicView

To create a subview it would have to be aligned with the DynamicView chunking - it cannot be arbitrary.

@bathmatt
Copy link
Author

bathmatt commented Apr 5, 2017 via email

@hcedwar hcedwar changed the title DynamicView and sort sort to accept DynamicView and [begin,end) indices Apr 5, 2017
@hcedwar
Copy link
Contributor

hcedwar commented Apr 5, 2017

Follow up conversation with @bathmatt
Root requirement is to sort a subrange of a DynamicView.
The subview discussion is only due to the current sort functions' interface only working on a full View so that a subview must currently be created to sort a subrange.
The root requirement can be satisfied at lower effort with sort functions that accept a DynamicView and [begin,end) range indices.

@hcedwar hcedwar added this to the 2017-April-end milestone Apr 5, 2017
@hcedwar hcedwar self-assigned this Apr 5, 2017
hcedwar added a commit that referenced this issue Apr 10, 2017
in particular Kokkos::DynamicView for issue #691 .

Sort of DynamicView unit test working on Host and Cuda.

Enhance DynamicView to improve unsability with Cuda memory space.
@hcedwar
Copy link
Contributor

hcedwar commented Apr 10, 2017

@bathmatt
A unit test applying Kokkos::sort to a Kokkos::Experimental::DynamicView is now in the develop branch.
https://github.com/kokkos/kokkos/blob/develop/algorithms/unit_tests/TestSort.hpp#L206
Please have a look as to whether the capability is sufficient for your use case.

@crtrott crtrott closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improve existing capability; will potentially require voting
Projects
None yet
Development

No branches or pull requests

3 participants