Skip to content

Commit

Permalink
Fix bug in sort_bsr_matrix workaround path
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-kelley committed Aug 6, 2024
1 parent 07aa761 commit 5387e33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sparse/src/KokkosSparse_SortCrs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ void sort_bsr_matrix(const execution_space& exec, Ordinal blockSize, const rowma
auto keys = Impl::generateBulkCrsKeys(exec, rowmap, entries, numCols);
Kokkos::View<Offset*, execution_space> permutation(Kokkos::view_alloc(Kokkos::WithoutInitializing, "permutation"),
entries.extent(0));
KokkosKernels::Impl::sequential_fill(exec, permutation);
Ordinal vectorLength = 1;
Ordinal avgDeg = (entries.extent(0) + numRows - 1) / numRows;
while (vectorLength < avgDeg / 2) {
vectorLength *= 2;
}
if (vectorLength > TeamPol ::vector_length_max()) vectorLength = TeamPol ::vector_length_max();
Impl::MatrixSortThreadFunctor<TeamPol, Ordinal, rowmap_t, entries_t, decltype(permutation)> funct(
numRows, rowmap, entries, permutation);
Impl::MatrixSortThreadFunctor<TeamPol, Ordinal, rowmap_t, decltype(keys), decltype(permutation)> funct(
numRows, rowmap, keys, permutation);
Ordinal teamSize = TeamPol(exec, 1, 1, vectorLength).team_size_recommended(funct, Kokkos::ParallelForTag());
Kokkos::parallel_for("sort_bulk_keys_by_row[GPU,bitonic]",
TeamPol(exec, (numRows + teamSize - 1) / teamSize, teamSize, vectorLength), funct);
Expand Down

0 comments on commit 5387e33

Please sign in to comment.