35#ifndef _BLAZE_MATH_SMP_THREADMAPPING_H_
36#define _BLAZE_MATH_SMP_THREADMAPPING_H_
62using ThreadMapping = std::pair<size_t,size_t>;
82ThreadMapping createThreadMapping(
size_t threads,
const Matrix<MT,SO>& A )
84 const size_t M( (*A).rows() );
85 const size_t N( (*A).columns() );
87 if( M > N || ( M == N && !SO ) )
89 const double ratio(
double(M)/
double(N) );
90 size_t m =
min( threads,
max( 1UL,
static_cast<size_t>(
round(
sqrt( threads*ratio ) ) ) ) );
91 size_t n = threads / m;
93 while( m * n != threads ) {
98 return ThreadMapping( m, n );
102 const double ratio(
double(N)/
double(M) );
103 size_t n =
min( threads,
max( 1UL,
static_cast<size_t>(
round(
sqrt( threads*ratio ) ) ) ) );
104 size_t m = threads / n;
106 while( m * n != threads ) {
111 return ThreadMapping( m, n );
Header file for the Matrix base class.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1436
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1616
Header file for the round shim.
Header file for the sqrt shim.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.