1 #include "../CombBLAS.h"
21 template <
typename PARMAT>
43 secondMaxProfit = smp;
48 friend ostream&
operator<<(ostream& os,
const VertexType & vertex ){os <<
"(" << vertex.objID <<
", " << vertex.price <<
", " << vertex.secondMaxProfit <<
")";
return os;};
60 struct max2 :
public std::binary_function<VertexType, VertexType, VertexType>
68 if(x.secondMaxProfit < y.price) ret.secondMaxProfit = y.price;
73 if(y.secondMaxProfit < x.price) ret.secondMaxProfit = x.price;
93 return max2()(arg1, arg2);
101 return VertexType(arg2.objID, arg1 - arg2.price, arg2.secondMaxProfit);
120 template <
class IT,
class NT>
134 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
135 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
144 A.Reduce(*ColSums,
Column, plus<int64_t>(),
static_cast<int64_t>(0));
145 A.Reduce(*RowSums,
Row, plus<int64_t>(),
static_cast<int64_t>(0));
156 nonisoColV = ColSums->
FindInds(bind2nd(greater<int64_t>(), 0));
157 nonisoRowV = RowSums->
FindInds(bind2nd(greater<int64_t>(), 0));
168 int64_t nrows1=
A.getnrow(), ncols1=
A.getncol(), nnz1 =
A.getnnz();
169 double avgDeg1 = (double) nnz1/(nrows1+ncols1);
172 A.operator()(nonisoRowV, nonisoColV,
true);
174 int64_t nrows2=
A.getnrow(), ncols2=
A.getncol(), nnz2 =
A.getnnz();
175 double avgDeg2 = (double) nnz2/(nrows2+ncols2);
180 cout <<
"ncol nrows nedges deg \n";
181 cout << nrows1 <<
" " << ncols1 <<
" " << nnz1 <<
" " << avgDeg1 <<
" \n";
182 cout << nrows2 <<
" " << ncols2 <<
" " << nnz2 <<
" " << avgDeg2 <<
" \n";
185 MPI_Barrier(MPI_COMM_WORLD);
194 int main(
int argc,
char* argv[])
199 MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &provided);
200 if (provided < MPI_THREAD_SERIALIZED)
202 printf(
"ERROR: The MPI library does not have MPI_THREAD_SERIALIZED support\n");
203 MPI_Abort(MPI_COMM_WORLD, 1);
206 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
207 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
223 if(
string(argv[1]) ==
string(
"input"))
227 string filename(argv[2]);
229 tinfo <<
"**** Reading input matrix: " << filename <<
" ******* " << endl;
230 SpParHelper::Print(tinfo.str());
236 tinfo <<
"Reader took " << t02-t01 <<
" seconds" << endl;
237 SpParHelper::Print(tinfo.str());
249 unsigned scale = (unsigned) atoi(argv[2]);
250 unsigned EDGEFACTOR = (unsigned) atoi(argv[3]);
252 if(
string(argv[1]) == string(
"er"))
258 cout <<
"ER ******** \n";
260 else if(
string(argv[1]) == string(
"g500"))
266 cout <<
"g500 ******** \n";
268 else if(
string(argv[1]) == string(
"ssca"))
274 cout <<
"ER ******** \n";
279 printf(
"The input type - %s - is not recognized.\n", argv[2]);
280 MPI_Abort(MPI_COMM_WORLD, 1);
283 SpParHelper::Print(
"Generating input matrix....\n");
292 tinfo <<
"Generator took " << t02-t01 <<
" seconds" << endl;
293 SpParHelper::Print(tinfo.str());
297 SpParHelper::Print(
"Generated matrix symmetricized....\n");
306 SpParHelper::Print(
"Performing random permutation of matrix.\n");
313 (*ABool)(prow, pcol,
true);
314 SpParHelper::Print(
"Performed random permutation of matrix.\n");
323 auction(
A, mateRow2Col, mateCol2Row);
343 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
344 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
352 vector<vector<double> > timing;
354 vector<int64_t> phaseMatched;
355 double t1, time_search, time_augment, time_phase;
370 bidders = SpMV<SubMaxSR>(
A, objects);
381 activeBidders = EWiseApply<VertexType>(activeBidders, mateRow2Col,
395 activeBidders.
Invert(ncol,
418 mateCol2Row.
Set(successfullBids);
433 mateRow2Col.
Set(successfullBidders);