Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::parallel_detail Namespace Reference

Classes

struct  chunk_bounds
 

Functions

ThreadPoolselected_parallel_pool (const ParallelOptions &options)
 
size_t chunk_count (const size_t n, const size_t chunk_size) noexcept
 
chunk_bounds bounds_for_chunk (const size_t idx, const size_t n, const size_t chunk_size) noexcept
 
size_t chunk_size (const size_t n, const size_t num_threads, const size_t min_chunk=64)
 Calculate optimal chunk size based on data size and thread count.
 
template<typename Container >
constexpr bool has_random_access ()
 Check if container supports random access.
 
template<typename Container >
auto ensure_random_access (const Container &c)
 For containers with random access, just return a pointer to it For non-random access, copy to vector.
 
template<typename T >
decltype(autoderef (T &&ptr)
 Get reference from pointer or unique_ptr.
 
size_t effective_parallel_chunk_size (const size_t n, const ThreadPool &pool, const ParallelOptions &options, const size_t min_chunk=64)
 
bool use_sequential_parallel_path (const size_t n, const ThreadPool &pool, const ParallelOptions &options) noexcept
 
void throw_if_parallel_canceled (const CancellationToken &token)
 
ThreadPoolselect_pool (const ParallelOptions &options)
 
size_t resolve_chunk_size (const size_t total, const size_t num_threads, const ParallelOptions &options, const size_t min_chunk=1)
 
bool use_sequential_path (const size_t total, const ThreadPool &pool, const ParallelOptions &options) noexcept
 
void throw_if_canceled (const CancellationToken &token)
 
template<typename InputIt1 , typename InputIt2 , typename OutputIt , typename Compare >
void merge_sequential (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Compare comp, const CancellationToken &token)
 

Function Documentation

◆ bounds_for_chunk()

chunk_bounds Aleph::parallel_detail::bounds_for_chunk ( const size_t  idx,
const size_t  n,
const size_t  chunk_size 
)
inlinenoexcept

Definition at line 149 of file ah-parallel.H.

References chunk_size(), and offset.

◆ chunk_count()

size_t Aleph::parallel_detail::chunk_count ( const size_t  n,
const size_t  chunk_size 
)
inlinenoexcept

Definition at line 144 of file ah-parallel.H.

References chunk_size().

◆ chunk_size()

size_t Aleph::parallel_detail::chunk_size ( const size_t  n,
const size_t  num_threads,
const size_t  min_chunk = 64 
)
inline

Calculate optimal chunk size based on data size and thread count.

Definition at line 157 of file ah-parallel.H.

References Aleph::divide_and_conquer_partition_dp(), and Aleph::size().

Referenced by bounds_for_chunk(), chunk_count(), effective_parallel_chunk_size(), and resolve_chunk_size().

◆ deref()

template<typename T >
decltype(auto) Aleph::parallel_detail::deref ( T &&  ptr)

Get reference from pointer or unique_ptr.

Definition at line 188 of file ah-parallel.H.

◆ effective_parallel_chunk_size()

size_t Aleph::parallel_detail::effective_parallel_chunk_size ( const size_t  n,
const ThreadPool pool,
const ParallelOptions options,
const size_t  min_chunk = 64 
)
inline

◆ ensure_random_access()

template<typename Container >
auto Aleph::parallel_detail::ensure_random_access ( const Container c)

For containers with random access, just return a pointer to it For non-random access, copy to vector.

Definition at line 178 of file ah-parallel.H.

References Aleph::divide_and_conquer_partition_dp().

◆ has_random_access()

template<typename Container >
constexpr bool Aleph::parallel_detail::has_random_access ( )
constexpr

Check if container supports random access.

Definition at line 168 of file ah-parallel.H.

◆ merge_sequential()

void Aleph::parallel_detail::merge_sequential ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  d_first,
Compare  comp,
const CancellationToken token 
)

◆ resolve_chunk_size()

size_t Aleph::parallel_detail::resolve_chunk_size ( const size_t  total,
const size_t  num_threads,
const ParallelOptions options,
const size_t  min_chunk = 1 
)
inline

Definition at line 1401 of file thread_pool.H.

References chunk_size(), Aleph::divide_and_conquer_partition_dp(), and options.

◆ select_pool()

ThreadPool & Aleph::parallel_detail::select_pool ( const ParallelOptions options)
inline

Definition at line 1396 of file thread_pool.H.

References Aleph::default_pool(), and options.

◆ selected_parallel_pool()

ThreadPool & Aleph::parallel_detail::selected_parallel_pool ( const ParallelOptions options)
inline

Definition at line 139 of file ah-parallel.H.

References Aleph::default_pool(), and options.

◆ throw_if_canceled()

void Aleph::parallel_detail::throw_if_canceled ( const CancellationToken token)
inline

◆ throw_if_parallel_canceled()

void Aleph::parallel_detail::throw_if_parallel_canceled ( const CancellationToken token)
inline

◆ use_sequential_parallel_path()

bool Aleph::parallel_detail::use_sequential_parallel_path ( const size_t  n,
const ThreadPool pool,
const ParallelOptions options 
)
inlinenoexcept

Definition at line 212 of file ah-parallel.H.

References Aleph::and, and options.

◆ use_sequential_path()

bool Aleph::parallel_detail::use_sequential_path ( const size_t  total,
const ThreadPool pool,
const ParallelOptions options 
)
inlinenoexcept

Definition at line 1424 of file thread_pool.H.

References Aleph::and, Aleph::divide_and_conquer_partition_dp(), and options.