Skip to content

Commit

Permalink
passing numthreads to all p.. functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPernet committed Jun 7, 2019
1 parent 2ac1a02 commit 2731e92
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 59 deletions.
21 changes: 21 additions & 0 deletions fflas-ffpack/fflas/fflas_level3.inl
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,27 @@ namespace FFLAS {
typename Field::Element_ptr C, const size_t ldc,
const ParSeqHelper::Parallel<Cut,Param> par);

template<typename Field>
typename Field::Element_ptr
pfgemm (const Field& F,
const FFLAS_TRANSPOSE ta,
const FFLAS_TRANSPOSE tb,
const size_t m,
const size_t n,
const size_t k,
const typename Field::Element alpha,
typename Field::ConstElement_ptr A, const size_t lda,
typename Field::ConstElement_ptr B, const size_t ldb,
const typename Field::Element beta,
typename Field::Element_ptr C, const size_t ldc,
size_t numthreads = 0){
PAR_BLOCK{
size_t nt = numthreads ? numthreads : NUM_THREADS;
ParSeqHelper::Parallel<CuttingStrategy::Block,StrategyParameter::Threads> par(nt);
fgemm(F,ta,tb,m,n,k,alpha,A,lda,B,ldb,beta,C,ldc,par);
}
}

template<class Field>
typename Field::Element*
pfgemm_1D_rec( const Field& F,
Expand Down
43 changes: 22 additions & 21 deletions fflas-ffpack/ffpack/ffpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ namespace FFPACK { /* echelon */
template <class Field>
size_t
pColumnEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, bool transform=false,
const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, bool transform=false,
size_t numthreads = 0, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t
Expand Down Expand Up @@ -786,9 +786,9 @@ namespace FFPACK { /* echelon */
template <class Field>
size_t
pRowEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform=false,
const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform=false,
size_t numthreads = 0, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t
Expand Down Expand Up @@ -827,9 +827,9 @@ namespace FFPACK { /* echelon */
template <class Field>
size_t
pReducedColumnEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform = false,
const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform = false,
size_t numthreads = 0, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t
Expand Down Expand Up @@ -870,7 +870,7 @@ namespace FFPACK { /* echelon */
pReducedRowEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform = false,
const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
size_t numthreads = 0, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t
Expand Down Expand Up @@ -1230,8 +1230,8 @@ namespace FFPACK { /* Solutions */

template <class Field>
size_t
pRank( const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda);
pRank (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda, size_t numthreads = 0);

template <class Field, class PSHelper>
size_t
Expand Down Expand Up @@ -1285,8 +1285,8 @@ namespace FFPACK { /* Solutions */
template <class Field>
typename Field::Element&
pDet (const Field& F, typename Field::Element& det, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t * P = NULL, size_t * Q = NULL);
typename Field::Element_ptr A, const size_t lda,
size_t numthreads = 0, size_t * P = NULL, size_t * Q = NULL);

template <class Field, class PSHelper>
typename Field::Element&
Expand Down Expand Up @@ -1326,10 +1326,10 @@ namespace FFPACK { /* Solutions */

template <class Field>
typename Field::Element_ptr
pSolve( const Field& F, const size_t M,
typename Field::Element_ptr A, const size_t lda,
typename Field::Element_ptr x, const int incx,
typename Field::ConstElement_ptr b, const int incb );
pSolve (const Field& F, const size_t M,
typename Field::Element_ptr A, const size_t lda,
typename Field::Element_ptr x, const int incx,
typename Field::ConstElement_ptr b, const int incb, size_t numthreads = 0);

//! Solve L X = B or X L = B in place.
//! L is M*M if Side == FFLAS::FflasLeft and N*N if Side == FFLAS::FflasRight, B is M*N.
Expand Down Expand Up @@ -1425,7 +1425,7 @@ namespace FFPACK { /* Solutions */
template <class Field>
size_t pRowRankProfile (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* &rkprofile, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
size_t* &rkprofile, size_t numthreads = 0, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t RowRankProfile (const Field& F, const size_t M, const size_t N,
Expand Down Expand Up @@ -1453,8 +1453,9 @@ namespace FFPACK { /* Solutions */

template <class Field>
size_t pColumnRankProfile (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* &rkprofile, const FFPACK_LU_TAG LuTag=FfpackTileRecursive);
typename Field::Element_ptr A, const size_t lda,
size_t* &rkprofile, size_t numthreads = 0,
const FFPACK_LU_TAG LuTag=FfpackTileRecursive);

template <class Field, class PSHelper>
size_t ColumnRankProfile (const Field& F, const size_t M, const size_t N,
Expand Down
30 changes: 15 additions & 15 deletions fflas-ffpack/ffpack/ffpack.inl
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ namespace FFPACK {
template <class Field>
size_t
pRank (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda)
typename Field::Element_ptr A, const size_t lda, size_t numthreads)
{
size_t R;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
R = Rank (F, M, N, A, lda, parH);
}
return R;
Expand Down Expand Up @@ -100,12 +100,12 @@ namespace FFPACK {
template <class Field>
inline typename Field::Element&
pDet (const Field& F, typename Field::Element& det, const size_t N,
typename Field::Element_ptr A, const size_t lda, size_t * P, size_t * Q)
typename Field::Element_ptr A, const size_t lda, size_t numthreads, size_t * P, size_t * Q)
{
//return FFPACK::Det (F, det, N, A, lda, FFLAS::ParSeqHelper::Sequential(), P, Q);
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
FFPACK::Det (F, det, N, A, lda, parH, P, Q);
}
return det;
Expand Down Expand Up @@ -195,15 +195,15 @@ namespace FFPACK {
template <class Field>
inline typename Field::Element_ptr
pSolve (const Field& F, const size_t M,
typename Field::Element_ptr A, const size_t lda,
typename Field::Element_ptr x, const int incx,
typename Field::ConstElement_ptr b, const int incb) {
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
FFPACK::Solve(F, M, A, lda, x, incx, b, incb, parH);
}
return x;
typename Field::Element_ptr A, const size_t lda,
typename Field::Element_ptr x, const int incx,
typename Field::ConstElement_ptr b, const int incb, size_t numthreads) {
PAR_BLOCK{
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
FFPACK::Solve(F, M, A, lda, x, incx, b, incb, parH);
}
return x;
}

template <class Field>
Expand Down
35 changes: 18 additions & 17 deletions fflas-ffpack/ffpack/ffpack_echelonforms.inl
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ inline size_t FFPACK::ColumnEchelonForm (const Field& F, const size_t M, const s
template <class Field>
inline size_t FFPACK::pColumnEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform,
size_t* P, size_t* Qt, const bool transform, size_t numthreads,
const FFPACK_LU_TAG LuTag)
{
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = FFPACK::ColumnEchelonForm (F, M, N, A, lda, P, Qt, transform, LuTag, parH);
}
return r;
Expand Down Expand Up @@ -90,14 +91,14 @@ inline size_t FFPACK::RowEchelonForm (const Field& F, const size_t M, const size

template <class Field>
inline size_t FFPACK::pRowEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform,
const FFPACK_LU_TAG LuTag)
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform, size_t numthreads,
const FFPACK_LU_TAG LuTag)
{
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = FFPACK::RowEchelonForm (F, M, N, A, lda, P, Qt, transform, LuTag, parH);
}
return r;
Expand Down Expand Up @@ -139,14 +140,14 @@ FFPACK::ReducedColumnEchelonForm (const Field& F, const size_t M, const size_t N
template <class Field>
inline size_t
FFPACK::pReducedColumnEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform,
const FFPACK_LU_TAG LuTag)
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform, size_t numthreads,
const FFPACK_LU_TAG LuTag)
{
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = ReducedColumnEchelonForm (F, M, N, A, lda, P, Qt, transform, LuTag, parH);
}
return r;
Expand Down Expand Up @@ -198,14 +199,14 @@ FFPACK::ReducedRowEchelonForm (const Field& F, const size_t M, const size_t N,
template <class Field>
inline size_t
FFPACK::pReducedRowEchelonForm (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform,
const FFPACK_LU_TAG LuTag)
typename Field::Element_ptr A, const size_t lda,
size_t* P, size_t* Qt, const bool transform, size_t numthreads,
const FFPACK_LU_TAG LuTag)
{
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = ReducedRowEchelonForm (F, M, N, A, lda, P, Qt, transform, LuTag, parH);
}
return r;
Expand Down
12 changes: 6 additions & 6 deletions fflas-ffpack/ffpack/ffpack_rankprofiles.inl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ namespace FFPACK{
template <class Field>
inline size_t pRowRankProfile (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* &rkprofile, const FFPACK_LU_TAG LuTag){
size_t* &rkprofile, size_t numthreads, const FFPACK_LU_TAG LuTag){
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = FFPACK::RowRankProfile (F, M, N, A, lda, rkprofile, LuTag, parH);
}
return r;
Expand Down Expand Up @@ -84,11 +84,11 @@ namespace FFPACK{
template <class Field>
inline size_t pColumnRankProfile (const Field& F, const size_t M, const size_t N,
typename Field::Element_ptr A, const size_t lda,
size_t* &rkprofile, const FFPACK_LU_TAG LuTag){
size_t* &rkprofile, size_t numthreads, const FFPACK_LU_TAG LuTag){
size_t r;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH;
PAR_BLOCK{
parH.set_numthreads(NUM_THREADS);
size_t nt = numthreads ? numthreads : NUM_THREADS;
FFLAS::ParSeqHelper::Parallel<FFLAS::CuttingStrategy::Recursive,FFLAS::StrategyParameter::Threads> parH(nt);
r = FFPACK::ColumnRankProfile (F, M, N, A, lda, rkprofile, LuTag, parH);
}
return r;
Expand Down

0 comments on commit 2731e92

Please sign in to comment.