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

In-place exclusive scan (prefix sum) algorithm for device buffers. More...

#include "shambase/aliases_int.hpp"
#include "shambackends/DeviceBuffer.hpp"
#include "shambackends/DeviceScheduler.hpp"
#include <string>
#include <vector>
Include dependency graph for scan_exclusive_sum_in_place.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 T>
void shamalgs::primitives::scan_exclusive_sum_in_place (sham::DeviceBuffer< T > &buf1, u32 len)
 Compute exclusive prefix sum in-place on a device buffer.
std::vector< std::string > shamalgs::primitives::impl::get_default_impl_list_scan_exclusive_sum_in_place ()
 Get list of available scan_exclusive_sum_in_place implementations.
std::string shamalgs::primitives::impl::get_current_impl_scan_exclusive_sum_in_place ()
 Get the current implementation for scan_exclusive_sum_in_place.
bool shamalgs::primitives::impl::is_impl_set_scan_exclusive_sum_in_place ()
 Check if an implementation has been selected for scan_exclusive_sum_in_place.
void shamalgs::primitives::impl::set_impl_scan_exclusive_sum_in_place (const std::string &impl)
 Set the implementation for scan_exclusive_sum_in_place, from a config json string.
void shamalgs::primitives::impl::autoselect_impl_scan_exclusive_sum_in_place (const sham::DeviceScheduler_ptr &dev_sched)
 Select the default implementation for scan_exclusive_sum_in_place.

Detailed Description

In-place exclusive scan (prefix sum) algorithm for device buffers.

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 algorithms to compute the exclusive prefix sum of elements in a device buffer. The exclusive scan operation computes for each position i the sum of all elements from index 0 to i-1, with the first element receiving the identity value (0 for addition).

The algorithm performs the operation in-place, modifying the input buffer directly without allocating additional memory for the result. This makes it memory-efficient for large datasets.

Definition in file scan_exclusive_sum_in_place.hpp.