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

Fix Boruvka dendrogram generation #955

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address minor comments
  • Loading branch information
aprokop committed Oct 23, 2023
commit 07b84492e2bd22c12b3f02ad2cdf94c3fbc3c7f4
10 changes: 5 additions & 5 deletions src/details/ArborX_MinimumSpanningTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,

using MemorySpace = typename SidedParents::memory_space;

auto num_edges = edges.size();
int num_edges = edges.size();

// Encode both a sided parent and an edge weight into long long.
// This way, once we sort based on this value, edges with the same sided
Expand Down Expand Up @@ -619,8 +619,8 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
// signbit instead of >= 0 just as an extra precaution against negative
// floating zeros.
static_assert(sizeof(int) == sizeof(float));
assert(Kokkos::isfinite(edge.weight) &&
Kokkos::signbit(edge.weight) == 0);
KOKKOS_ASSERT(Kokkos::isfinite(edge.weight) &&
Kokkos::signbit(edge.weight) == 0);
keys(e) = (key << shift) + KokkosExt::bit_cast<int>(edge.weight);
});

Expand Down Expand Up @@ -660,7 +660,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
// Find the index of the smallest edge with the same weight in
// this chain
int m = i;
for (int k = i + 1; k < (int)num_edges && keys(k) == key; ++k)
for (int k = i + 1; k < num_edges && keys(k) == key; ++k)
if (edges(permute(k)) < edges(permute(m)))
m = k;

Expand All @@ -675,7 +675,7 @@ void computeParents(ExecutionSpace const &space, Edges const &edges,
Kokkos::RangePolicy<ExecutionSpace>(space, 0, num_edges),
KOKKOS_LAMBDA(int const i) {
int e = permute(i);
if (i == (int)num_edges - 1)
if (i == num_edges - 1)
{
// The parent of the root node is set to -1
parents(e) = -1;
Expand Down
2 changes: 1 addition & 1 deletion test/tstDendrogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(dendrogram_boruvka_same_weights, DeviceType,
Kokkos::atomic_inc(&counts(mst.dendrogram_parents(i)));
});

int wrong_counts = 0;
int wrong_counts;
Kokkos::parallel_reduce(
"Testing::check_counts",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, 2 * n - 1),
Expand Down