8#include "CombBLAS/CombBLAS.h"
16bool from_string(T & t,
const string& s, std::ios_base& (*f)(std::ios_base&))
19 return !(iss >> f >> t).fail();
22int main(
int argc,
char* argv[])
25 MPI_Init(&argc, &argv);
26 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
27 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
33 cout <<
"Usage: ./IndexingTiming Input/Force/Binary <Inputfile>/<Scale>/<BinaryFile>" << endl;
39 typedef SpParMat <int, double, SpDCCols<int,double> > PARDBMAT;
41 if(
string(argv[1]) ==
string(
"Input"))
43 A->ReadDistribute(argv[2], 0);
45 else if(
string(argv[1]) ==
string(
"Binary"))
52 outs <<
"Reading " << argv[2] <<
" with " << n <<
" vertices and " << m <<
" edges" << endl;
63 A =
new PARDBMAT(*DEL,
false);
67 else if(
string(argv[1]) ==
string(
"Force"))
69 double initiator[4] = {.6, .4/3, .4/3, .4/3};
72 int scale =
static_cast<unsigned>(atoi(argv[2]));
74 outs <<
"Forcing scale to : " << scale << endl;
86 A =
new PARDBMAT(*DEL,
false);
94 p.
iota(
A->getnrow(), 0);
97 PARDBMAT
B = (*A)(p,p);
100 float oldbalance =
A->LoadImbalance();
101 float newbalance =
B.LoadImbalance();
103 outs <<
"Running on " << nprocs <<
" cores" << endl;
104 outs <<
"Old balance: " << oldbalance << endl;
105 outs <<
"New balance: " << newbalance << endl;
108 MPI_Barrier(MPI_COMM_WORLD);
109 double t1 = MPI_Wtime();
116 MPI_Barrier(MPI_COMM_WORLD);
117 double t2 = MPI_Wtime();
121 cout<<
"Indexing Iterations finished"<<endl;
122 printf(
"%.6lf seconds elapsed per iteration\n", (t2-t1)/(
double)
ITERATIONS);
127 vector< FullyDistVec<int,int> > clusters(nclust);
128 int nperclus =
A->getnrow() / nclust;
130 for(
int i = 0; i< nclust; i++)
132 int k = std::min(nperclus,
A->getnrow() - nperclus * i);
133 clusters[i].iota(k, nperclus * i);
134 clusters[i] = p(clusters[i]);
137 for(
int i=0; i< nclust; i++)
139 B = (*A)(clusters[i], clusters[i]);
143 MPI_Barrier(MPI_COMM_WORLD);
145 for(
int i=0; i< nclust; i++)
148 B = (*
A)(clusters[i], clusters[i]);
151 MPI_Barrier(MPI_COMM_WORLD);
156 cout<<
"Indexing Iterations finished"<<endl;
157 printf(
"%.6lf seconds elapsed per iteration\n", (t2-t1)/(
double)
ITERATIONS);
161 for(
int i=0; i< nclust; i++)
164 C.Prune(clusters[i], clusters[i]);
167 B = (*A)(clusters[i], clusters[i]);
168 C.SpAsgn(clusters[i], clusters[i],
B);
int main(int argc, char *argv[])
bool from_string(T &t, const string &s, std::ios_base &(*f)(std::ios_base &))
void GenGraph500Data(double initiator[4], int log_numverts, int edgefactor, bool scramble=false, bool packed=false)
void iota(IT globalsize, NT first)
static void Print(const std::string &s)
void PermEdges(DistEdgeList< IT > &DEL)
void RenameVertices(DistEdgeList< IU > &DEL)
unsigned __int64 uint64_t