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

Add EMST example #1214

Merged
merged 2 commits into from
Feb 7, 2025
Merged

Add EMST example #1214

merged 2 commits into from
Feb 7, 2025

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Feb 6, 2025

Fix #1189.

@aprokop aprokop added the examples Anything to do with examples label Feb 6, 2025
// #2: (0, 1, 1.41)
// #3: (3, 4, 2.24)
// #4: (1, 2, 2.24)
printEdges(edges);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would do printEdges(emst.edges);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did that at first. But decided to explicitly show a user how to get the edges in a separate line. Felt a bit more clear.


template <typename MemorySpace>
void printEdges(
Kokkos::View<ArborX::Experimental::WeightedEdge *, MemorySpace> edges)
Copy link
Contributor

Choose a reason for hiding this comment

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

To be pedantic one would want to ensure that the view is contiguous here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be more correct, yes. Don't think it's worthwhile, though.

{
auto edges_host =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, edges);
std::sort(edges_host.data(), edges_host.data() + edges_host.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could sort it on the device with Kokkos

@aprokop aprokop merged commit c3ebac5 into arborx:master Feb 7, 2025
1 of 2 checks passed
@aprokop aprokop deleted the emst_example branch February 7, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Anything to do with examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EMST example
2 participants