Skip to content

Commit

Permalink
sparse_sort_crs: fix column shuffle indices (#2346)
Browse files Browse the repository at this point in the history
* random_shuffle -> shuffle

random_shuffle is deprecated / removed

* sparse_sort_crs: Fix row begin/end offset in entry shuffle
  • Loading branch information
cwpearson authored Oct 7, 2024
1 parent 2472963 commit 05c3079
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion perf_test/sparse/KokkosSparse_sort_crs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ void run_experiment(int argc, char** argv, const CommonInputParams& common_param
// Randomly shuffle the entries within each row, so that the rows aren't
// already sorted. Leave the values alone; this changes the matrix numerically
// but this doesn't affect sorting.
std::random_device rd;
std::mt19937 g(rd());
for (lno_t i = 0; i < m; i++) {
std::random_shuffle(entriesHost.data() + i, entriesHost.data() + i + 1);
const size_type rowBegin = rowmapHost(i);
const size_type rowEnd = rowmapHost(i + 1);
std::shuffle(entriesHost.data() + rowBegin, entriesHost.data() + rowEnd, g);
}
Kokkos::deep_copy(shuffledEntries, entriesHost);
exec_space exec;
Expand Down

0 comments on commit 05c3079

Please sign in to comment.