irlba
A C++ library for IRLBA
|
Restrict the number of available threads for Eigen. More...
#include <parallel.hpp>
Public Member Functions | |
EigenThreadScope (int num_threads) | |
Restrict the number of available threads for Eigen.
Creating an instance of this class will call Eigen::setNbThreads()
to control the number of available OpenMP threads in Eigen operations. Destruction will then reset the number of available threads to its prior value.
If the parallelization scheme is not OpenMP, num_threads
is ignored and the number of Eigen threads is always set to 1 when an instance of this class is created. This is done to avoid unintended parallelization via OpenMP when another scheme has already been specified. We assume that OpenMP is not the parallelization scheme if:
IRLBA_CUSTOM_PARALLEL
is defined (see parallelize()
) and the IRLBA_CUSTOM_PARALLEL_USES_OPENMP
macro is not defined.IRLBA_CUSTOM_PARALLEL
is not defined and OpenMP was not chosen by subpar::parallelize_simple()
.If OpenMP is not available, the creation/destruction of a class instance has no effect.