34 std::vector<std::pair<Tkey, Tval>> zipped(len);
35 for (
u32 i = 0; i < len; ++i) {
36 zipped[i] = std::make_pair(key_stdvec[i], val_stdvec[i]);
39 std::sort(zipped.begin(), zipped.end(), [](
const auto &a,
const auto &b) {
40 return a.first < b.first;
43 for (
u32 i = 0; i < len; ++i) {
44 key_stdvec[i] = zipped[i].first;
45 val_stdvec[i] = zipped[i].second;
void sort_by_keys_std_sort(sham::DeviceBuffer< Tkey > &buf_key, sham::DeviceBuffer< Tval > &buf_values, u32 len)
Copy both buffers to host, std::sort the zipped key/value pairs, and copy back.