mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-10 23:09:06 +08:00
fix bug with openmp
This commit is contained in:
parent
d6791e8f3d
commit
b4ef323e90
@ -228,12 +228,16 @@ struct ei_gemm_functor
|
|||||||
: m_lhs(lhs), m_rhs(rhs), m_dest(dest), m_actualAlpha(actualAlpha), m_blocking(blocking)
|
: m_lhs(lhs), m_rhs(rhs), m_dest(dest), m_actualAlpha(actualAlpha), m_blocking(blocking)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void initParallelSession() const
|
||||||
|
{
|
||||||
|
m_blocking.allocateB();
|
||||||
|
}
|
||||||
|
|
||||||
void operator() (Index row, Index rows, Index col=0, Index cols=-1, GemmParallelInfo<Index>* info=0) const
|
void operator() (Index row, Index rows, Index col=0, Index cols=-1, GemmParallelInfo<Index>* info=0) const
|
||||||
{
|
{
|
||||||
if(cols==-1)
|
if(cols==-1)
|
||||||
cols = m_rhs.cols();
|
cols = m_rhs.cols();
|
||||||
if(info)
|
|
||||||
m_blocking.allocateB();
|
|
||||||
Gemm::run(rows, cols, m_lhs.cols(),
|
Gemm::run(rows, cols, m_lhs.cols(),
|
||||||
(const Scalar*)&(m_lhs.const_cast_derived().coeffRef(row,0)), m_lhs.outerStride(),
|
(const Scalar*)&(m_lhs.const_cast_derived().coeffRef(row,0)), m_lhs.outerStride(),
|
||||||
(const Scalar*)&(m_rhs.const_cast_derived().coeffRef(0,col)), m_rhs.outerStride(),
|
(const Scalar*)&(m_rhs.const_cast_derived().coeffRef(0,col)), m_rhs.outerStride(),
|
||||||
|
@ -108,6 +108,8 @@ void ei_parallelize_gemm(const Functor& func, Index rows, Index cols)
|
|||||||
if(threads==1)
|
if(threads==1)
|
||||||
return func(0,rows, 0,cols);
|
return func(0,rows, 0,cols);
|
||||||
|
|
||||||
|
func.initParallelSession();
|
||||||
|
|
||||||
Index blockCols = (cols / threads) & ~Index(0x3);
|
Index blockCols = (cols / threads) & ~Index(0x3);
|
||||||
Index blockRows = (rows / threads) & ~Index(0x7);
|
Index blockRows = (rows / threads) & ~Index(0x7);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user