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

make constraints on Kokkos::sort more visible/clear #6234

Merged
merged 9 commits into from
Jun 23, 2023

Conversation

fnrizzi
Copy link
Contributor

@fnrizzi fnrizzi commented Jun 22, 2023

Some of the constraints on the sort functions were a bit hidden: for example some overloads accept a dynamic view, while some others don't. This PR clarifies directly at the API level what the constraints are on the current sort API, thus making it clearly visible right away (aka one does not have to dig a few layers to figure out what is allowed)

Minor: clang format is turned off so that the the public API is more readable (IMMO)

@fnrizzi fnrizzi marked this pull request as draft June 22, 2023 09:50
@fnrizzi fnrizzi changed the title make constraints more visible make constraints on sort more visible Jun 22, 2023
@fnrizzi fnrizzi changed the title make constraints on sort more visible make constraints on sort more visible/clear Jun 22, 2023
@fnrizzi fnrizzi marked this pull request as ready for review June 22, 2023 10:21
@fnrizzi fnrizzi changed the title make constraints on sort more visible/clear make constraints on Kokkos::sort more visible/clear Jun 22, 2023
@dalg24
Copy link
Member

dalg24 commented Jun 22, 2023

Please remind me why we care about sorting DynamicViews in the first place.

@fnrizzi
Copy link
Contributor Author

fnrizzi commented Jun 22, 2023

Please remind me why we care about sorting DynamicViews in the first place.

I actually had no idea, and found out that it was supporting that when doing this work ... if i had to guess, it comes from lammps or maybe maybe something else particle-based. Even if lammps does not call kokkos sort directly

Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I am OK with pulling the <Kokkos_DynamicView.hpp> header into <Kokkos_Sort.hpp> in the name of better compile error diagnostic.

algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
algorithms/src/sorting/Kokkos_SortPublicAPI.hpp Outdated Show resolved Hide resolved
@fnrizzi
Copy link
Contributor Author

fnrizzi commented Jun 22, 2023

@masterleinad I made all changes you requested

@crtrott crtrott merged commit 5b6cb80 into kokkos:develop Jun 23, 2023
28 checks passed
@@ -219,6 +258,10 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(

template <class ViewType>
void sort(ViewType view, size_t const begin, size_t const end) {
// same constraints as the overload above which this gets dispatched to
static_assert(ViewType::rank == 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all need to call the member function rank() if DynRankView if rank 1 is to be supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fnrizzi fnrizzi mentioned this pull request Oct 3, 2023
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

5 participants