Ginan
Loading...
Searching...
No Matches
BlasThreading::ScopedOpenBlasThreadLimit Class Reference

Temporarily limits OpenBLAS worker threads. More...

Detailed Description

Temporarily limits OpenBLAS worker threads.

OpenBLAS builds that use pthreads warn, and can hang, if they are called from an active OpenMP parallel region:

OpenBLAS Warning : Detect OpenMP Loop and this application may hang.

Ginan keeps some high-level chunk loops parallel with OpenMP. For those loops we want each chunk's BLAS/LAPACK calls to run single-threaded instead of nesting another thread pool inside every OpenMP worker. This RAII guard sets OpenBLAS to the requested thread count for the current scope and restores the previous OpenBLAS setting when it leaves the scope.

Passing numThreads <= 0 disables the guard. If the target is linked against a non-OpenBLAS BLAS/LAPACK library, the guard is compiled as a no-op.

Collaboration diagram for BlasThreading::ScopedOpenBlasThreadLimit:

Public Member Functions

 ScopedOpenBlasThreadLimit (int numThreads)
 
 ~ScopedOpenBlasThreadLimit ()
 
 ScopedOpenBlasThreadLimit (const ScopedOpenBlasThreadLimit &)=delete
 
ScopedOpenBlasThreadLimitoperator= (const ScopedOpenBlasThreadLimit &)=delete
 

Constructor & Destructor Documentation

◆ ScopedOpenBlasThreadLimit() [1/2]

BlasThreading::ScopedOpenBlasThreadLimit::ScopedOpenBlasThreadLimit ( int numThreads)
inlineexplicit
Here is the call graph for this function:

◆ ~ScopedOpenBlasThreadLimit()

BlasThreading::ScopedOpenBlasThreadLimit::~ScopedOpenBlasThreadLimit ( )
inline
Here is the call graph for this function:

◆ ScopedOpenBlasThreadLimit() [2/2]

BlasThreading::ScopedOpenBlasThreadLimit::ScopedOpenBlasThreadLimit ( const ScopedOpenBlasThreadLimit & )
delete

Member Function Documentation

◆ operator=()

ScopedOpenBlasThreadLimit & BlasThreading::ScopedOpenBlasThreadLimit::operator= ( const ScopedOpenBlasThreadLimit & )
delete

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