STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Concurrency::affinity_partitioner Class Reference

The affinity_partitioner class is similar to the static_partitioner class, but it improves cache affinity by its choice of mapping subranges to worker threads. It can improve performance significantly when a loop is re-executed over the same data set, and the data fits in cache. Note that the same affinity_partitioner object must be used with subsequent iterations of a parallel loop that is executed over a particular data set, to benefit from data locality. More...

#include <ppl.h>

Public Member Functions

 affinity_partitioner ()
 Constructs an affinity_partitioner object. More...
 
 ~affinity_partitioner ()
 Destroys an affinity_partitioner object. More...
 
location_Get_chunk_location (unsigned int _ChunkIndex)
 
template<class _Type >
_Type _Get_num_chunks (_Type)
 

Private Member Functions

void _Initialize_locations (unsigned int _Num_chunks)
 

Private Attributes

unsigned int _M_num_chunks
 
location_M_pChunk_locations
 

Detailed Description

The affinity_partitioner class is similar to the static_partitioner class, but it improves cache affinity by its choice of mapping subranges to worker threads. It can improve performance significantly when a loop is re-executed over the same data set, and the data fits in cache. Note that the same affinity_partitioner object must be used with subsequent iterations of a parallel loop that is executed over a particular data set, to benefit from data locality.

Constructor & Destructor Documentation

Concurrency::affinity_partitioner::affinity_partitioner ( )
inline

Constructs an affinity_partitioner object.

1731  {
1732  }
location * _M_pChunk_locations
Definition: ppl.h:1764
#define NULL
Definition: crtdbg.h:30
unsigned int _M_num_chunks
Definition: ppl.h:1761
Concurrency::affinity_partitioner::~affinity_partitioner ( )
inline

Destroys an affinity_partitioner object.

1739  {
1740  delete [] _M_pChunk_locations;
1741  }
location * _M_pChunk_locations
Definition: ppl.h:1764

Member Function Documentation

location& Concurrency::affinity_partitioner::_Get_chunk_location ( unsigned int  _ChunkIndex)
inline
1744  {
1745  return _M_pChunk_locations[_ChunkIndex];
1746  }
location * _M_pChunk_locations
Definition: ppl.h:1764
template<class _Type >
_Type Concurrency::affinity_partitioner::_Get_num_chunks ( _Type  )
inline
1750  {
1751  if (_M_num_chunks == 0)
1752  {
1754  }
1755 
1756  return static_cast<_Type>(_M_num_chunks);
1757  }
void _Initialize_locations(unsigned int _Num_chunks)
Definition: ppl.h:1766
_In_ wctype_t _Type
Definition: ctype.h:205
unsigned int _M_num_chunks
Definition: ppl.h:1761
static _CRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
void Concurrency::affinity_partitioner::_Initialize_locations ( unsigned int  _Num_chunks)
inlineprivate
1767  {
1768  _M_num_chunks = _Num_chunks;
1769  _M_pChunk_locations = new location[_Num_chunks];
1770  }
location * _M_pChunk_locations
Definition: ppl.h:1764
unsigned int _M_num_chunks
Definition: ppl.h:1761

Member Data Documentation

unsigned int Concurrency::affinity_partitioner::_M_num_chunks
private
location* Concurrency::affinity_partitioner::_M_pChunk_locations
private

The documentation for this class was generated from the following file: