C++ Library Extensions 2022.12.09
To help learn modern C++ programming
tpf_parallel.hpp File Reference
#include <tpf_types.hpp>
#include <atomic>
#include <algorithm>
#include <execution>
#include <tbb/tbb.h>
Include dependency graph for tpf_parallel.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tpf::parallel::counting_iterator< IntType >
 
struct  tpf::parallel::cache_wrapper< Type, CacheSize >
 
struct  tpf::parallel::st_cache_wrapper< T, bool >
 
struct  tpf::parallel::st_cache_wrapper< T, true >
 
struct  tpf::parallel::st_cache_aligned_array< Type, Size >
 

Namespaces

namespace  tpf
 Includes subnamespace conversion.
 
namespace  tpf::parallel
 Implements set operations.
 

Macros

#define NOMINMAX
 
#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1
 
#define DEBUGGING_MODE   0
 
#define LIB_INTERNAL_PutDebugMessageAndExit(error_msg)
 
#define Tpf_PutDebugMessageAndExit(error_msg)   LIB_INTERNAL_PutDebugMessageAndExit(error_msg)
 
#define _TPF_ITERATOR
 

Typedefs

template<typename T >
using tpf::parallel::cache_wrapper_t = typename st_cache_wrapper< T, std::is_class_v< T > >::type
 
template<typename Type , template< typename, typename... > class Container>
using tpf::parallel::cache_aligned_container_t = Container< cache_wrapper_t< Type >, tbb::cache_aligned_allocator< cache_wrapper_t< Type > > >
 
template<typename Type >
using tpf::parallel::cache_aligned_vector_t = cache_aligned_container_t< Type, std::vector >
 
template<typename Type , size_t Size>
using tpf::parallel::cache_aligned_array_t = st_cache_aligned_array< Type, Size >
 

Functions

constexpr size_t tpf::parallel::default_alignment ()
 
template<typename ElementType , typename Operation >
void tpf::parallel::atomic_operation (std::atomic< ElementType > &atom, Operation &&opr)
 
constexpr unsigned long long tpf::parallel::least_power_of_2_ge_n (unsigned long long n)
 
constexpr unsigned long long tpf::parallel::fast_integer_power (unsigned long long x, unsigned long long n)
 
template<typename Type >
bool tpf::parallel::is_cache_aligned (Type *ptr)
 
template<typename Type1 , typename Type2 >
bool tpf::parallel::is_cache_aligned (Type1 *ptr1, Type2 *ptr2)
 
template<typename Type1 , typename Type2 >
bool tpf::parallel::is_cache_aligned (Type1 &value1, Type2 &value2)
 
template<typename Type >
bool tpf::parallel::is_cache_aligned (Type &value)
 
bool tpf::parallel::go_parallel (size_t element_count, size_t greater_than)
 
template<typename IteratorType >
bool tpf::parallel::go_parallel (IteratorType begin, IteratorType end, size_t greater_than)
 
template<typename ContainerType >
bool tpf::parallel::go_parallel (ContainerType &&container, size_t greater_than)
 
template<typename IndexType , typename CallbackType >
void tpf::parallel::for_index (IndexType begin_index, IndexType end_index, CallbackType &&callback, size_t greater_than=ConcurrencyLimit)
 
template<typename ContainerType , typename CallbackType >
void tpf::parallel::for_index (ContainerType &&container, CallbackType &&callback, size_t greater_than=ConcurrencyLimit)
 
template<typename IndexType , typename InitType , typename SumupType , typename HandleParallelType >
auto tpf::parallel::reduce_index (IndexType begin_index, IndexType end_index, InitType &&init_value, SumupType &&sum_up, HandleParallelType &&handle_parallel, size_t greater_than=ConcurrencyLimit)
 
template<typename ContainerType , typename InitType , typename SumupType , typename HandleParallelType >
auto tpf::parallel::reduce_index (ContainerType &&container, InitType &&init_value, SumupType &&sum_up, HandleParallelType &&handle_parallel, size_t greater_than=ConcurrencyLimit)
 

Variables

constexpr auto tpf::parallel::cache_line_size = 64
 
constexpr size_t tpf::parallel::ConcurrencyLimit = 10
 
constexpr size_t tpf::parallel::ForceSequential = ConcurrencyLimit - 1
 
constexpr size_t tpf::parallel::ForceParallel = ConcurrencyLimit + 1
 

Detailed Description

Author
your name (you@d.nosp@m.omai.nosp@m.n.com)
Version
0.1
Date
2019-10-26

Definition in file tpf_parallel.hpp.

Macro Definition Documentation

◆ _TPF_ITERATOR

#define _TPF_ITERATOR

Definition at line 138 of file tpf_parallel.hpp.

◆ DEBUGGING_MODE

#define DEBUGGING_MODE   0

Definition at line 45 of file tpf_parallel.hpp.

◆ LIB_INTERNAL_PutDebugMessageAndExit

#define LIB_INTERNAL_PutDebugMessageAndExit (   error_msg)
Value:
{ std::cerr<<"File name ["<<__FILE__<< "]\n" \
<< "Line " << __LINE__ << " : " << error_msg; \
std::exit(1); }

Definition at line 50 of file tpf_parallel.hpp.

◆ NOMINMAX

#define NOMINMAX

Definition at line 16 of file tpf_parallel.hpp.

◆ TBB_SUPPRESS_DEPRECATED_MESSAGES

#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1

Definition at line 32 of file tpf_parallel.hpp.

◆ Tpf_PutDebugMessageAndExit

#define Tpf_PutDebugMessageAndExit (   error_msg)    LIB_INTERNAL_PutDebugMessageAndExit(error_msg)

Definition at line 57 of file tpf_parallel.hpp.