Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::affinity_partitioner_base_v3 Class Reference

Defines entry point for affinity partitioner into TBB run-time library. More...

#include <partitioner.h>

Inheritance diagram for tbb::internal::affinity_partitioner_base_v3:
Collaboration diagram for tbb::internal::affinity_partitioner_base_v3:

Private Member Functions

 affinity_partitioner_base_v3 ()
 Zeros the fields. More...
 
 ~affinity_partitioner_base_v3 ()
 Deallocates my_array. More...
 
void __TBB_EXPORTED_METHOD resize (unsigned factor)
 Resize my_array. More...
 
- Private Member Functions inherited from tbb::internal::no_copy
 no_copy (const no_copy &)=delete
 
 no_copy ()=default
 

Private Attributes

affinity_idmy_array
 Array that remembers affinities of tree positions to affinity_id. More...
 
size_t my_size
 Number of elements in my_array. More...
 

Friends

class tbb::affinity_partitioner
 
class tbb::interface9::internal::affinity_partition_type
 

Detailed Description

Defines entry point for affinity partitioner into TBB run-time library.

Definition at line 80 of file partitioner.h.

Constructor & Destructor Documentation

◆ affinity_partitioner_base_v3()

tbb::internal::affinity_partitioner_base_v3::affinity_partitioner_base_v3 ( )
inlineprivate

Zeros the fields.

Definition at line 89 of file partitioner.h.

89 : my_array(NULL), my_size(0) {}
size_t my_size
Number of elements in my_array.
Definition: partitioner.h:87
affinity_id * my_array
Array that remembers affinities of tree positions to affinity_id.
Definition: partitioner.h:85

◆ ~affinity_partitioner_base_v3()

tbb::internal::affinity_partitioner_base_v3::~affinity_partitioner_base_v3 ( )
inlineprivate

Deallocates my_array.

Definition at line 91 of file partitioner.h.

91 {resize(0);}
void __TBB_EXPORTED_METHOD resize(unsigned factor)
Resize my_array.
Definition: task.cpp:157

References resize().

Here is the call graph for this function:

Member Function Documentation

◆ resize()

void tbb::internal::affinity_partitioner_base_v3::resize ( unsigned  factor)
private

Resize my_array.

Retains values if resulting size is the same.

Definition at line 157 of file task.cpp.

157  {
158  // Check factor to avoid asking for number of workers while there might be no arena.
159  size_t new_size = factor ? factor*governor::local_scheduler()->max_threads_in_arena() : 0;
160  if( new_size!=my_size ) {
161  if( my_array ) {
162  NFS_Free( my_array );
163  // Following two assignments must be done here for sake of exception safety.
164  my_array = NULL;
165  my_size = 0;
166  }
167  if( new_size ) {
168  my_array = static_cast<affinity_id*>(NFS_Allocate(new_size,sizeof(affinity_id), NULL ));
169  memset( my_array, 0, sizeof(affinity_id)*new_size );
170  my_size = new_size;
171  }
172  }
173 }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t new_size
void *__TBB_EXPORTED_FUNC NFS_Allocate(size_t n_element, size_t element_size, void *hint)
Allocate memory on cache/sector line boundary.
size_t my_size
Number of elements in my_array.
Definition: partitioner.h:87
affinity_id * my_array
Array that remembers affinities of tree positions to affinity_id.
Definition: partitioner.h:85
static generic_scheduler * local_scheduler()
Obtain the thread-local instance of the TBB scheduler.
Definition: governor.h:129
unsigned short affinity_id
An id as used for specifying affinity.
Definition: task.h:139
void __TBB_EXPORTED_FUNC NFS_Free(void *)
Free memory allocated by NFS_Allocate.
unsigned max_threads_in_arena()
Returns the concurrency limit of the current arena.
Definition: scheduler.h:677

References tbb::internal::governor::local_scheduler(), tbb::internal::generic_scheduler::max_threads_in_arena(), my_array, my_size, new_size, tbb::internal::NFS_Allocate(), and tbb::internal::NFS_Free().

Referenced by tbb::interface9::internal::affinity_partition_type::affinity_partition_type(), and ~affinity_partitioner_base_v3().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ tbb::affinity_partitioner

friend class tbb::affinity_partitioner
friend

Definition at line 81 of file partitioner.h.

◆ tbb::interface9::internal::affinity_partition_type

Definition at line 82 of file partitioner.h.

Member Data Documentation

◆ my_array

affinity_id* tbb::internal::affinity_partitioner_base_v3::my_array
private

Array that remembers affinities of tree positions to affinity_id.

NULL if my_size==0.

Definition at line 85 of file partitioner.h.

Referenced by tbb::interface9::internal::affinity_partition_type::affinity_partition_type(), and resize().

◆ my_size

size_t tbb::internal::affinity_partitioner_base_v3::my_size
private

Number of elements in my_array.

Definition at line 87 of file partitioner.h.

Referenced by resize().


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.