CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Partitioner.hpp File Reference

A partitioner is a light callable object that takes a pair of iterators and returns the middle of the sequence. More...

Go to the source code of this file.

Classes

class  CeresEngine::HalvePartitioner
 The halve partitioner always splits the sequence into two parts of roughly equal size. More...
 
class  CeresEngine::ThreadPartitioner
 A partitioner that splits the ranges until it identifies we are not moving to new threads. More...
 
struct  CeresEngine::traits::is_range_partitioner< T, R >
 Determine if P is a valid partitioner for the range R. More...
 
struct  CeresEngine::traits::is_range_partitioner< T, R >
 

Namespaces

namespace  CeresEngine
 
namespace  CeresEngine::traits
 

Concepts

concept  CeresEngine::traits::partitioner
 
concept  CeresEngine::traits::range_partitioner
 

Typedefs

using CeresEngine::DefaultPartitioner = ThreadPartitioner
 Default partitioner used by parallel algorithms.
 
template<class T , class I , class S >
using CeresEngine::traits::is_partitioner = std::conjunction< std::conditional_t< traits::is_input_iterator_v< I >, std::true_type, std::false_type >, std::conditional_t< traits::is_input_iterator_v< S >, std::true_type, std::false_type >, std::is_invocable< T, I, S > >
 Determine if P is a valid partitioner for the iterator range [I,S].
 

Functions

constexpr std::size_t CeresEngine::make_grain_size (const std::size_t n, const std::size_t occupancy=hardware_concurrency())
 Determine a reasonable minimum grain size depending on the number of elements in a sequence.
 
DefaultPartitioner CeresEngine::make_default_partitioner (const size_t n, const std::size_t occupancy=hardware_concurrency())
 Create an instance of the default partitioner with a reasonable grain size for n elements.
 
template<traits::input_iterator I, traits::sentinel_for< I > S>
DefaultPartitioner CeresEngine::make_default_partitioner (I first, S last, const std::size_t occupancy=hardware_concurrency())
 Create an instance of the default partitioner with a reasonable grain for the range first, last.
 
template<traits::input_range R>
DefaultPartitioner CeresEngine::make_default_partitioner (R &&r, std::size_t occupancy=hardware_concurrency())
 Create an instance of the default partitioner with a reasonable grain for the range r.
 
template<traits::executor E>
DefaultPartitioner CeresEngine::make_default_partitioner (const E &executor, const size_t n)
 Create an instance of the default partitioner for the given executor.
 
template<traits::executor E, traits::input_iterator I, traits::sentinel_for< I > S>
DefaultPartitioner CeresEngine::make_default_partitioner (const E &executor, I first, S last)
 Create an instance of the default partitioner with a reasonable grain for the range first, last.
 
template<traits::executor E, traits::input_range R>
DefaultPartitioner CeresEngine::make_default_partitioner (const E &executor, R &&r)
 Create an instance of the default partitioner with a reasonable grain for the range r.
 

Variables

template<class T , class I , class S >
constexpr bool CeresEngine::traits::is_partitioner_v = is_partitioner<T, I, S>::value
 Determine if P is a valid partitioner for the iterator range [I,S].
 
template<class T , class R >
constexpr bool CeresEngine::traits::is_range_partitioner_v = is_range_partitioner<T, R>::value
 Determine if P is a valid partitioner for the range R.
 

Detailed Description

A partitioner is a light callable object that takes a pair of iterators and returns the middle of the sequence.

In particular, it returns an iterator middle that forms a subrange first/middle which the algorithm should solve inline before scheduling the subrange middle/last in the executor.