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

sparse_sort_crs: fix column shuffle indices #2346

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from all commits
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
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
Loading