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

Boolean reduction algorithm for checking if all elements are non-zero. More...

#include "shambackends/DeviceBuffer.hpp"
#include "shambackends/DeviceScheduler.hpp"
#include "shambackends/sycl.hpp"
#include <string>
#include <vector>
Include dependency graph for is_all_true.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>
bool shamalgs::primitives::is_all_true (sycl::buffer< T > &buf, u32 cnt)
 Check if all elements in a sycl::buffer are non-zero.
template<class T>
bool shamalgs::primitives::is_all_true (sham::DeviceBuffer< T > &buf, u32 cnt)
 Check if all elements in a sham::DeviceBuffer are non-zero.
std::vector< std::string > shamalgs::primitives::impl::get_default_impl_list_is_all_true ()
 Get list of available is_all_true implementations, as config json strings.
std::string shamalgs::primitives::impl::get_current_impl_is_all_true ()
 Get the current implementation for is_all_true, as a config json string.
bool shamalgs::primitives::impl::is_impl_set_is_all_true ()
 Check if an implementation has been selected for is_all_true.
void shamalgs::primitives::impl::set_impl_is_all_true (const std::string &impl)
 Set the implementation for is_all_true, from a config json string.
void shamalgs::primitives::impl::autoselect_impl_is_all_true (const sham::DeviceScheduler_ptr &dev_sched)
 Select the default implementation for is_all_true.

Detailed Description

Boolean reduction algorithm for checking if all elements are non-zero.

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 check if all elements in a buffer are non-zero (logically true). The functions perform a boolean reduction operation across the entire buffer, returning true only if every element satisfies the non-zero condition.

The algorithms come in two variants:

  • is_all_true for sycl::buffer: Direct buffer-based processing
  • is_all_true for sham::DeviceBuffer: USM-based processing

Definition in file is_all_true.hpp.