Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
Loading...
Searching...
No Matches
tbb::internal::allowed_parallelism_control Class Reference
Inheritance diagram for tbb::internal::allowed_parallelism_control:
Collaboration diagram for tbb::internal::allowed_parallelism_control:

Public Member Functions

size_t active_value_if_present () const
 

Private Member Functions

virtual size_t default_value () const __TBB_override
 
virtual bool is_first_arg_preferred (size_t a, size_t b) const __TBB_override
 
virtual void apply_active () const __TBB_override
 
virtual size_t active_value () const __TBB_override
 

Additional Inherited Members

- Public Attributes inherited from tbb::internal::padded_base< T, S, R >
char pad [S - R]
 

Detailed Description

Definition at line 466 of file tbb_main.cpp.

Member Function Documentation

◆ active_value()

virtual size_t tbb::internal::allowed_parallelism_control::active_value ( ) const
inlineprivatevirtual

Definition at line 478 of file tbb_main.cpp.

478 {
479/* Reading of my_active_value is not synchronized with possible updating
480 of my_head by other thread. It's ok, as value of my_active_value became
481 not invalid, just obsolete. */
482 if (!my_head)
483 return default_value();
484 // non-zero, if market is active
485 const size_t workers = market::max_num_workers();
486 // We can't exceed market's maximal number of workers.
487 // +1 to take master into account
488 return workers? min(workers+1, my_active_value): my_active_value;
489 }
T min(const T &val1, const T &val2)
Utility template function returning lesser of the two values.
Definition tbb_misc.h:110
static unsigned max_num_workers()
Definition market.h:377
virtual size_t default_value() const __TBB_override
Definition tbb_main.cpp:467

References default_value(), tbb::internal::market::max_num_workers(), and tbb::internal::min().

Here is the call graph for this function:

◆ active_value_if_present()

size_t tbb::internal::allowed_parallelism_control::active_value_if_present ( ) const
inline

Definition at line 491 of file tbb_main.cpp.

491 {
492 return my_head? my_active_value : 0;
493 }

Referenced by tbb::internal::market::app_parallelism_limit().

Here is the caller graph for this function:

◆ apply_active()

virtual void tbb::internal::allowed_parallelism_control::apply_active ( ) const
inlineprivatevirtual

Definition at line 473 of file tbb_main.cpp.

473 {
474 __TBB_ASSERT( my_active_value>=1, NULL );
475 // -1 to take master into account
476 market::set_active_num_workers( my_active_value-1 );
477 }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition tbb_stddef.h:165
static void set_active_num_workers(unsigned w)
Set number of active workers.
Definition market.cpp:235

References __TBB_ASSERT, and tbb::internal::market::set_active_num_workers().

Here is the call graph for this function:

◆ default_value()

virtual size_t tbb::internal::allowed_parallelism_control::default_value ( ) const
inlineprivatevirtual

Definition at line 467 of file tbb_main.cpp.

467 {
469 }
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
Definition tbb_misc.h:119
static unsigned default_num_threads()
Definition governor.h:84

References tbb::internal::governor::default_num_threads(), and tbb::internal::max().

Referenced by active_value().

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

◆ is_first_arg_preferred()

virtual bool tbb::internal::allowed_parallelism_control::is_first_arg_preferred ( size_t  a,
size_t  b 
) const
inlineprivatevirtual

Definition at line 470 of file tbb_main.cpp.

470 {
471 return a<b; // prefer min allowed parallelism
472 }

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

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.