Skip to content

Commit 05c3079

Browse files
authored
sparse_sort_crs: fix column shuffle indices (#2346)
* random_shuffle -> shuffle random_shuffle is deprecated / removed * sparse_sort_crs: Fix row begin/end offset in entry shuffle
1 parent 2472963 commit 05c3079

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

perf_test/sparse/KokkosSparse_sort_crs.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ void run_experiment(int argc, char** argv, const CommonInputParams& common_param
7979
// Randomly shuffle the entries within each row, so that the rows aren't
8080
// already sorted. Leave the values alone; this changes the matrix numerically
8181
// but this doesn't affect sorting.
82+
std::random_device rd;
83+
std::mt19937 g(rd());
8284
for (lno_t i = 0; i < m; i++) {
83-
std::random_shuffle(entriesHost.data() + i, entriesHost.data() + i + 1);
85+
const size_type rowBegin = rowmapHost(i);
86+
const size_type rowEnd = rowmapHost(i + 1);
87+
std::shuffle(entriesHost.data() + rowBegin, entriesHost.data() + rowEnd, g);
8488
}
8589
Kokkos::deep_copy(shuffledEntries, entriesHost);
8690
exec_space exec;

0 commit comments

Comments
 (0)