35 #ifndef _BLAZE_MATH_SMP_THREADMAPPING_H_
36 #define _BLAZE_MATH_SMP_THREADMAPPING_H_
61 using ThreadMapping = std::pair<size_t,size_t>;
81 ThreadMapping createThreadMapping(
size_t threads,
const Matrix<MT,SO>& A )
83 const size_t M( (~A).
rows() );
84 const size_t N( (~A).
columns() );
86 if( M > N || ( M == N && !SO ) )
88 const double ratio(
double(M)/
double(N) );
89 size_t m = min<size_t>( threads, max<size_t>( 1UL, round(
sqrt( threads*ratio ) ) ) );
90 size_t n = threads / m;
92 while( m * n != threads ) {
97 return ThreadMapping( m, n );
101 const double ratio(
double(N)/
double(M) );
102 size_t n = min<size_t>( threads, max<size_t>( 1UL, round(
sqrt( threads*ratio ) ) ) );
103 size_t m = threads / n;
105 while( m * n != threads ) {
110 return ThreadMapping( m, n );
Header file for mathematical functions.
Header file for basic type definitions.
Header file for the sqrt shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
const DMatForEachExpr< MT, Sqrt, SO > sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1282
Header file for the Matrix base class.
Header file for the round shim.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314