10 #ifndef EIGEN_PARALLELIZER_H 11 #define EIGEN_PARALLELIZER_H 13 #if EIGEN_HAS_CXX11_ATOMIC 24 static int m_maxThreads = -1;
35 #ifdef EIGEN_HAS_OPENMP 87 #if EIGEN_HAS_CXX11_ATOMIC 88 std::atomic<Index> sync;
89 std::atomic<int> users;
99 template<
bool Condition,
typename Functor,
typename Index>
107 #if (! defined(EIGEN_HAS_OPENMP)) || defined(EIGEN_USE_BLAS) || ((!EIGEN_HAS_CXX11_ATOMIC) && !(EIGEN_ARCH_i386_OR_x86_64)) 114 func(0,rows, 0,cols);
126 Index pb_max_threads = std::max<Index>(1,size / Functor::Traits::nr);
129 double work =
static_cast<double>(
rows) * static_cast<double>(cols) *
130 static_cast<double>(
depth);
131 double kMinTaskSize = 50000;
132 pb_max_threads = std::max<Index>(1, std::min<Index>(pb_max_threads,
static_cast<Index>( work / kMinTaskSize ) ));
141 return func(0,rows, 0,cols);
144 func.initParallelSession(threads);
151 #pragma omp parallel num_threads(threads) 157 Index blockCols = (cols / actual_threads) & ~
Index(0
x3);
158 Index blockRows = (rows / actual_threads);
159 blockRows = (blockRows/Functor::Traits::mr)*Functor::Traits::mr;
161 Index r0 = i*blockRows;
162 Index actualBlockRows = (i+1==actual_threads) ? rows-r0 : blockRows;
164 Index c0 = i*blockCols;
165 Index actualBlockCols = (i+1==actual_threads) ? cols-c0 : blockCols;
167 info[
i].lhs_start = r0;
168 info[
i].lhs_length = actualBlockRows;
170 if(transpose)
func(c0, actualBlockCols, 0, rows,
info);
171 else func(0, rows, c0, actualBlockCols,
info);
180 #endif // EIGEN_PARALLELIZER_H
Namespace containing all symbols from the Eigen library.
void manage_caching_sizes(Action action, std::ptrdiff_t *l1, std::ptrdiff_t *l2, std::ptrdiff_t *l3)
int omp_get_num_threads(void)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Array< int, Dynamic, 1 > v
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
EIGEN_CONSTEXPR Index size(const T &x)
int omp_get_max_threads(void)
#define eigen_internal_assert(x)
void parallelize_gemm(const Functor &func, Index rows, Index cols, Index depth, bool transpose)
void manage_multi_threading(Action action, int *v)
int omp_get_thread_num(void)
#define EIGEN_UNUSED_VARIABLE(var)