10 #ifndef EIGEN_PARALLELIZER_H 11 #define EIGEN_PARALLELIZER_H 30 #ifdef EIGEN_HAS_OPENMP 34 *v = omp_get_max_threads();
52 std::ptrdiff_t l1, l2;
85 template<
bool Condition,
typename Functor,
typename Index>
90 #if !(defined (EIGEN_HAS_OPENMP)) || defined (EIGEN_USE_BLAS) 107 if((!Condition) || (omp_get_num_threads()>1))
108 return func(0,rows, 0,cols);
110 Index size = transpose ? cols : rows;
114 Index max_threads = std::max<Index>(1,size / 32);
117 Index threads = std::min<Index>(
nbThreads(), max_threads);
120 return func(0,rows, 0,cols);
123 func.initParallelSession();
126 std::swap(rows,cols);
128 Index blockCols = (cols / threads) & ~Index(0x3);
129 Index blockRows = (rows / threads) & ~Index(0x7);
133 #pragma omp parallel for schedule(static,1) num_threads(threads) 134 for(Index i=0; i<threads; ++i)
136 Index r0 = i*blockRows;
137 Index actualBlockRows = (i+1==threads) ? rows-r0 : blockRows;
139 Index c0 = i*blockCols;
140 Index actualBlockCols = (i+1==threads) ? cols-c0 : blockCols;
146 func(0, cols, r0, actualBlockRows, info);
148 func(r0, actualBlockRows, 0,cols, info);
159 #endif // EIGEN_PARALLELIZER_H
#define EIGEN_UNUSED_VARIABLE(var)
iterative scaling algorithm to equilibrate rows and column norms in matrices
void manage_caching_sizes(Action action, std::ptrdiff_t *l1=0, std::ptrdiff_t *l2=0)
#define eigen_internal_assert(x)
void parallelize_gemm(const Functor &func, Index rows, Index cols, bool transpose)
void manage_multi_threading(Action action, int *v)