STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public 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 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.

1732  {
1733  }
#define NULL
Definition: vcruntime.h:236
location * _M_pChunk_locations
Definition: ppl.h:1766
unsigned int _M_num_chunks
Definition: ppl.h:1763
Concurrency::affinity_partitioner::~affinity_partitioner ( )
inline

Destroys an affinity_partitioner object.

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

Member Function Documentation

location& Concurrency::affinity_partitioner::_Get_chunk_location ( unsigned int  _ChunkIndex)
inline
1745  {
1746  return _M_pChunk_locations[_ChunkIndex];
1747  }
location * _M_pChunk_locations
Definition: ppl.h:1766
template<class _Type >
_Type Concurrency::affinity_partitioner::_Get_num_chunks ( _Type  )
inline
1751  {
1752  if (_M_num_chunks == 0)
1753  {
1755  _M_pChunk_locations = new location[_M_num_chunks];
1756  }
1757 
1758  return static_cast<_Type>(_M_num_chunks);
1759  }
location * _M_pChunk_locations
Definition: ppl.h:1766
unsigned int _M_num_chunks
Definition: ppl.h:1763
static _CONCRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()

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: