1 #ifndef _GEN_RMAT_DIST_H_ 2 #define _GEN_RMAT_DIST_H_ 15 #ifndef __STDC_CONSTANT_MACROS 16 #define __STDC_CONSTANT_MACROS 18 #ifndef __STDC_LIMIT_MACROS 19 #define __STDC_LIMIT_MACROS 28 template<
typename IT,
typename NT>
31 double t01 = MPI_Wtime();
37 int nprocs = DEL->
commGrid->GetSize();
38 minfo <<
"Started Generation of scale "<< scale << endl;
39 minfo <<
"Using " << nprocs <<
" MPI processes" << endl;
48 tinfo <<
"Generation took " << t02-t01 <<
" seconds" << endl;
56 float balance = A->LoadImbalance();
58 outs <<
"Load balance: " << balance << endl;
67 template <
typename IT,
typename NT>
70 std::vector<IT> vecEss;
71 std::vector< SpDCCols<IT, NT> > partsmat;
77 double trans_beg = MPI_Wtime();
81 double split_beg = MPI_Wtime();
82 localmat->
ColSplit(nparts, partsmat);
84 for(
int i=0; i< nparts; ++i)
86 std::vector<IT> ess = partsmat[i].GetEssentials();
87 for(
auto itr = ess.begin(); itr != ess.end(); ++itr)
89 vecEss.push_back(*itr);
95 double scatter_beg = MPI_Wtime();
98 std::vector<IT> myess(esscnt);
99 MPI_Scatter(vecEss.data(), esscnt, MPIType<IT>(), myess.data(), esscnt, MPIType<IT>(), 0, CMG.
fiberWorld);
103 splitmat = partsmat[0];
104 for(
int recipient=1; recipient< nparts; ++recipient)
107 Arr<IT,NT> arrinfo = partsmat[recipient].GetArrays();
108 for(
unsigned int i=0; i< arrinfo.
indarrs.size(); ++i)
113 for(
unsigned int i=0; i< arrinfo.
numarrs.size(); ++i)
125 for(
unsigned int i=0; i< arrinfo.
indarrs.size(); ++i)
127 MPI_Recv(arrinfo.
indarrs[i].addr, arrinfo.
indarrs[i].count, MPIType<IT>(), 0, tag++, CMG.
fiberWorld, MPI_STATUS_IGNORE);
129 for(
unsigned int i=0; i< arrinfo.
numarrs.size(); ++i)
131 MPI_Recv(arrinfo.
numarrs[i].addr, arrinfo.
numarrs[i].count, MPIType<NT>(), 0, tag++, CMG.
fiberWorld, MPI_STATUS_IGNORE);
void GenGraph500Data(double initiator[4], int log_numverts, int edgefactor, bool scramble=false, bool packed=false)
std::vector< LocArr< NT, IT > > numarrs
std::vector< LocArr< IT, IT > > indarrs
void Generator(unsigned scale, unsigned EDGEFACTOR, double initiator[4], CCGrid &CMG, SpDCCols< IT, NT > &splitmat, bool trans, bool scramble)
void ColSplit(int parts, std::vector< SpDCCols< IT, NT > > &matrices)
void Create(const std::vector< IT > &essentials)
static void Print(const std::string &s)
SpDCCols< IT, NT > * GenRMat(unsigned scale, unsigned EDGEFACTOR, double initiator[4], MPI_Comm &layerworld, bool scramble)
Arr< IT, NT > GetArrays() const
std::shared_ptr< CommGrid > commGrid
void Transpose()
Mutator version, replaces the calling object.