QMCPACK
BlasThreadingEnv Class Reference

service class for explicitly managing the threading of BLAS/LAPACK calls from OpenMP parallel region More...

+ Collaboration diagram for BlasThreadingEnv:

Public Member Functions

 BlasThreadingEnv (int num_threads)
 Constructor, obtains the number of threads at the next level. More...
 
 ~BlasThreadingEnv ()
 

Static Public Member Functions

static bool NestedThreadingSupported ()
 

Private Attributes

int old_state_
 

Detailed Description

service class for explicitly managing the threading of BLAS/LAPACK calls from OpenMP parallel region

intended to use only locally around heavy calls.

Definition at line 22 of file BlasThreadingEnv.h.

Constructor & Destructor Documentation

◆ BlasThreadingEnv()

BlasThreadingEnv ( int  num_threads)

Constructor, obtains the number of threads at the next level.

Definition at line 22 of file BlasThreadingEnv.cpp.

References BlasThreadingEnv::old_state_.

23 {
24 #ifdef HAVE_MKL
25  old_state_ = mkl_set_num_threads_local(num_threads);
26 #else
27  old_state_ = 0;
28 #endif
29 }

◆ ~BlasThreadingEnv()

Definition at line 31 of file BlasThreadingEnv.cpp.

References BlasThreadingEnv::old_state_.

32 {
33 #ifdef HAVE_MKL
34  mkl_set_num_threads_local(old_state_);
35 #endif
36 }

Member Function Documentation

◆ NestedThreadingSupported()

bool NestedThreadingSupported ( )
static

Definition at line 38 of file BlasThreadingEnv.cpp.

Referenced by DelayedUpdate< T, T_FP >::updateInvMat().

39 {
40 #ifdef HAVE_MKL
41  return true;
42 #else
43  return false;
44 #endif
45 }

Member Data Documentation

◆ old_state_

int old_state_
private

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