1 #include "../CombBLAS.h"
31 template <
typename PARMAT>
53 friend ostream&
operator<<(ostream& os,
const VertexType & vertex ){os <<
"(" << vertex.
parent <<
"," << vertex.root <<
")";
return os;};
73 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
74 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
83 A.Reduce(*ColSums,
Column, plus<int64_t>(),
static_cast<int64_t>(0));
84 A.Reduce(*RowSums,
Row, plus<int64_t>(),
static_cast<int64_t>(0));
95 nonisoColV = ColSums->
FindInds(bind2nd(greater<int64_t>(), 0));
96 nonisoRowV = RowSums->
FindInds(bind2nd(greater<int64_t>(), 0));
107 int64_t nrows1=
A.getnrow(), ncols1=
A.getncol(), nnz1 =
A.getnnz();
108 double avgDeg1 = (double) nnz1/(nrows1+ncols1);
111 A.operator()(nonisoRowV, nonisoColV,
true);
113 int64_t nrows2=
A.getnrow(), ncols2=
A.getncol(), nnz2 =
A.getnnz();
114 double avgDeg2 = (double) nnz2/(nrows2+ncols2);
119 cout <<
"ncol nrows nedges deg \n";
120 cout << nrows1 <<
" " << ncols1 <<
" " << nnz1 <<
" " << avgDeg1 <<
" \n";
121 cout << nrows2 <<
" " << ncols2 <<
" " << nnz2 <<
" " << avgDeg2 <<
" \n";
124 MPI_Barrier(MPI_COMM_WORLD);
138 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
141 cout <<
"\n-------------- usage --------------\n";
142 cout <<
"Usage (random matrix): ./maximal <er|g500|ssca> <Scale> <EDGEFACTOR> <algo><rand><moreSplit>\n";
143 cout <<
"Usage (input matrix): ./maximal <input> <matrix> <algo><rand><moreSplit>\n\n";
145 cout <<
" \n-------------- meaning of arguments ----------\n";
146 cout <<
"** er: Erdos-Renyi, g500: Graph500 benchmark, ssca: SSCA benchmark\n";
147 cout <<
"** scale: matrix dimention is 2^scale\n";
148 cout <<
"** edgefactor: average degree of vertices\n";
149 cout <<
"** algo : maximal matching algorithm used to initialize\n ";
150 cout <<
" greedy: greedy init , ks: Karp-Sipser, dmd: dynamic mindegree\n";
151 cout <<
" default: dynamic mindegree\n";
152 cout <<
"** (optional) rand: random parent selection in greedy/Karp-Sipser\n" ;
153 cout <<
"** (optional) moreSplit: more splitting of Matrix.\n" ;
154 cout <<
"(order of optional arguments does not matter)\n";
156 cout <<
" \n-------------- examples ----------\n";
157 cout <<
"Example: mpirun -np 4 ./maximal g500 18 16 ks rand" << endl;
158 cout <<
"Example: mpirun -np 4 ./maximal input cage12.mtx dmd\n" << endl;
165 for(
int i=0; i<argc; i++)
167 allArg += string(argv[i]);
170 if(allArg.find(
"moreSplit")!=string::npos)
172 if(allArg.find(
"randMaximal")!=string::npos)
174 if(allArg.find(
"greedy")!=string::npos)
176 else if(allArg.find(
"ks")!=string::npos)
178 else if(allArg.find(
"dmd")!=string::npos)
189 tinfo <<
"\n---------------------------------\n";
190 tinfo <<
" Maximal matching algorithm options: ";
192 if(
init ==
DMD) tinfo <<
" dynamic mindegree, ";
194 if(
randMaximal) tinfo <<
" random parent selection in greedy/Karp-Sipser, ";
196 tinfo <<
"\n---------------------------------\n\n";