Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
sort_by_key_pow2_len.hpp File Reference

Sort by keys algorithms. More...

#include "shambackends/DeviceBuffer.hpp"
#include "shambackends/DeviceQueue.hpp"
#include "shambackends/DeviceScheduler.hpp"
#include <string>
#include <vector>
Include dependency graph for sort_by_key_pow2_len.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  shamalgs
 namespace to contain everything implemented by shamalgs
namespace  shamalgs::primitives
 namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
namespace  shamalgs::primitives::impl
 namespace to control implementation behavior

Functions

template<class Tkey, class Tval>
void shamalgs::primitives::sort_by_key_pow2_len (sycl::queue &q, sycl::buffer< Tkey > &buf_key, sycl::buffer< Tval > &buf_values, u32 len)
 Sort key-value pairs using sycl::buffers (power-of-2 optimized).
template<class Tkey, class Tval>
void shamalgs::primitives::sort_by_key_pow2_len (const sham::DeviceScheduler_ptr &sched, sham::DeviceBuffer< Tkey > &buf_key, sham::DeviceBuffer< Tval > &buf_values, u32 len)
 Sort key-value pairs using USM buffers (power-of-2 optimized).
std::vector< std::string > shamalgs::primitives::impl::get_default_impl_list_sort_by_key_pow2_len ()
 Get list of available sort by key pow2 len implementations, as config json strings.
std::string shamalgs::primitives::impl::get_current_impl_sort_by_key_pow2_len ()
 Get the current implementation for sort by key pow2 len, as a config json string.
bool shamalgs::primitives::impl::is_impl_set_sort_by_key_pow2_len ()
 Check if an implementation has been selected for sort by key pow2 len.
void shamalgs::primitives::impl::set_impl_sort_by_key_pow2_len (const std::string &impl)
 Set the implementation for sort by key pow2 len, from a config json string.
void shamalgs::primitives::impl::autoselect_impl_sort_by_key_pow2_len (const sham::DeviceScheduler_ptr &dev_sched)
 Select the default implementation for sort by key pow2 len.

Detailed Description

Sort by keys algorithms.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

This header provides parallel sorting algorithms that sort key-value pairs based on the key values. The algorithms are optimized for GPU execution using sycl::buffers or USM.

sort_by_key_pow2_len only supports buffer lengths that are a power of 2 (callers must round up beforehand, e.g. with shambase::roundup_pow2).

The USM (sham::DeviceBuffer) overload selects its implementation through the generic implementation selector mechanism (see ImplVariant.hpp), via the impl sub-namespace below.

Definition in file sort_by_key_pow2_len.hpp.