30#ifndef _PAR_FRIENDS_EXT_H_
31#define _PAR_FRIENDS_EXT_H_
42template <
class IT,
class NT,
class DER>
57template <
typename SR,
typename IU,
typename NU1,
typename NU2,
typename UDERA,
typename UDERB>
65 if(
A.getncol() !=
B.getnrow())
67 std::cout<<
"Can not multiply, dimensions does not match"<<std::endl;
74 IU C_m =
A.spSeq->getnrow();
75 IU C_n =
B.spSeq->getncol();
81 const_cast< UDERB*
>(
B.spSeq)->Transpose();
113 std::vector< SpTuples<IU,N_promote> *>
tomerge;
120 int Bself = (
B.commGrid)->GetRankInProcCol();
127 oput <<
"A1seq: " <<
A1seq.getnrow() <<
" " <<
A1seq.getncol() <<
" " <<
A1seq.getnnz() << std::endl;
128 oput <<
"A2seq: " <<
A2seq.getnrow() <<
" " <<
A2seq.getncol() <<
" " <<
A2seq.getnnz() << std::endl;
129 oput <<
"B1seq: " <<
B1seq.getnrow() <<
" " <<
B1seq.getncol() <<
" " <<
B1seq.getnnz() << std::endl;
130 oput <<
"B2seq: " <<
B2seq.getnrow() <<
" " <<
B2seq.getncol() <<
" " <<
B2seq.getnnz() << std::endl;
158 for(
int i = 1; i <
stages; ++i)
259 for(
int i=0; i<
tomerge.size(); ++i)
275 const_cast< UDERB*
>(
B.spSeq)->Transpose();
290template <
typename SR,
typename IU,
typename NU1,
typename NU2,
typename UDERA,
typename UDERB>
298 if(
A.getncol() !=
B.getnrow())
300 std::cout<<
"Can not multiply, dimensions does not match"<<std::endl;
307 IU C_m =
A.spSeq->getnrow();
308 IU C_n =
B.spSeq->getncol();
314 const_cast< UDERB*
>(
B.spSeq)->Transpose();
339 std::vector< SpTuples<IU,N_promote> *>
tomerge;
346 int Bself = (
B.commGrid)->GetRankInProcCol();
360 for(
int i = 1; i <
stages; ++i)
423 for(
int i=0; i<
tomerge.size(); ++i)
438 const_cast< UDERB*
>(
B.spSeq)->Transpose();
447template <
typename SR,
typename IU,
typename NU1,
typename NU2,
typename UDERA,
typename UDERB>
454 if(
A.getncol() !=
B.getnrow())
456 std::cout<<
"Can not multiply, dimensions does not match"<<std::endl;
466 const_cast< UDERB*
>(
B.spSeq)->Transpose();
484 std::vector< SpTuples<IU,N_promote> *>
tomerge;
506 std::vector<IU>
ess1(UDERA::esscount);
507 for(
int j=0;
j< UDERA::esscount; ++
j)
513 oput <<
"For A (out), Fetching " << (
void*)
rowwindows[0] << std::endl;
516 if(
Bownind == (
B.commGrid)->GetRankInProcCol())
522 std::vector<IU>
ess2(UDERB::esscount);
523 for(
int j=0;
j< UDERB::esscount; ++
j)
529 oput <<
"For B (out), Fetching " << (
void*)
colwindows[0] << std::endl;
536 for(
int i = 1; i <
stages; ++i)
549 std::vector<IU>
ess1(UDERA::esscount);
550 for(
int j=0;
j< UDERA::esscount; ++
j)
560 if(
Bownind == (
B.commGrid)->GetRankInProcCol())
566 std::vector<IU>
ess2(UDERB::esscount);
567 for(
int j=0;
j< UDERB::esscount; ++
j)
604 std::vector<IU>
ess1(UDERA::esscount);
605 for(
int j=0;
j< UDERA::esscount; ++
j)
615 if(
Bownind == (
B.commGrid)->GetRankInProcCol())
621 std::vector<IU>
ess2(UDERB::esscount);
622 for(
int j=0;
j< UDERB::esscount; ++
j)
700 IU C_m =
A.spSeq->getnrow();
701 IU C_n =
B.spSeq->getncol();
703 for(
int i=0; i<
tomerge.size(); ++i)
710 const_cast< UDERB*
>(
B.spSeq)->Transpose();
std::shared_ptr< CommGrid > commGrid
static void deallocate2D(T **array, I m)
static void FreeWindows(std::vector< MPI_Win > &arrwin)
static void GetSetSizes(const SpMat< IT, NT, DER > &Matrix, IT **&sizes, MPI_Comm &comm1d)
static void UnlockWindows(int ownind, std::vector< MPI_Win > &arrwin)
static void SetWindows(MPI_Comm &comm1d, const SpMat< IT, NT, DER > &Matrix, std::vector< MPI_Win > &arrwin)
static void PostExposureEpoch(int self, std::vector< MPI_Win > &arrwin, MPI_Group &group)
static void Print(const std::string &s)
static void WaitNFree(std::vector< MPI_Win > &arrwin)
static void FetchMatrix(SpMat< IT, NT, DER > &MRecv, const std::vector< IT > &essentials, std::vector< MPI_Win > &arrwin, int ownind)
static void LockNFetch(DER *&Matrix, int owner, std::vector< MPI_Win > &arrwin, MPI_Group &group, IT **sizes)
static void AccessNFetch(DER *&Matrix, int owner, std::vector< MPI_Win > &arrwin, MPI_Group &group, IT **sizes)
SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDERA, UDERB >::T_promote > Mult_AnXBn_Fence(const SpParMat< IU, NU1, UDERA > &A, const SpParMat< IU, NU2, UDERB > &B)
SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDERA, UDERB >::T_promote > Mult_AnXBn_PassiveTarget(const SpParMat< IU, NU1, UDERA > &A, const SpParMat< IU, NU2, UDERB > &B)
SpParMat< IU, typename promote_trait< NU1, NU2 >::T_promote, typename promote_trait< UDERA, UDERB >::T_promote > Mult_AnXBn_ActiveTarget(const SpParMat< IU, NU1, UDERA > &A, const SpParMat< IU, NU2, UDERB > &B)
shared_ptr< CommGrid > ProductGrid(CommGrid *gridA, CommGrid *gridB, int &innerdim, int &Aoffset, int &Boffset)