2 #include "CombBLAS/CombBLAS.h"
19 template <
typename PARMAT>
37 static MPI_Op
mpi_op() {
return MPI_MIN; };
41 return std::min(arg1, arg2);
61 int main(
int argc,
char* argv[])
64 MPI_Init(&argc, &argv);
65 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
66 MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
71 cout <<
"Usage: ./md <rmat|er|input> <scale|filename>" << endl;
72 cout <<
"Example: mpirun -np 4 ./md rmat 20" << endl;
73 cout <<
"Example: mpirun -np 4 ./md er 20" << endl;
74 cout <<
"Example: mpirun -np 4 ./md input a.mtx" << endl;
83 if(
string(argv[1]) ==
string(
"input"))
85 string filename(argv[2]);
87 inf.open(filename.c_str(), ios::in);
90 bool isSymmetric = header.find(
"symmetric");
91 bool isUnweighted = header.find(
"pattern");
98 SpParHelper::Print(
"Read input\n");
100 else if(
string(argv[1]) ==
string(
"rmat"))
103 scale =
static_cast<unsigned>(atoi(argv[2]));
104 double initiator[4] = {.57, .19, .19, .05};
107 MPI_Barrier(MPI_COMM_WORLD);
113 else if(
string(argv[1]) ==
string(
"er"))
116 scale =
static_cast<unsigned>(atoi(argv[2]));
117 double initiator[4] = {.25, .25, .25, .25};
120 MPI_Barrier(MPI_COMM_WORLD);
128 SpParHelper::Print(
"Unknown input option\n");
158 SpMV<SelectMinSR>(
A, x, nx,
false);
167 reach.DelElement(source);
211 while( fringe.
getnnz() > 0 )
214 fringe = PSpGEMM<SelectMinSR>(
A, fringe);
217 fringe =
EWiseMult(fringe, visited,
true);
222 fringe = PSpGEMM<PTDD>(E, fringe);
235 visited = PSpGEMM<PTDD>(NE, visited);
269 for(
int i=0; i<nprocs; )
274 s = locvals[j++] + sources.LengthUntil();
294 A.Reduce(degrees,
Column, plus<int64_t>(),
static_cast<int64_t>(0));
302 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
303 MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
304 double time_beg = MPI_Wtime();
307 double time1=0, time2=0, time3=0;
308 for(
int64_t i=0; i<
A.getnrow(); i++)
317 time2 += MPI_Wtime()-time1;
326 time3 += MPI_Wtime()-time1;
328 degrees.
Set(updatedDeg);
338 cout << i <<
" .................. " << nnz <<
" :: " << time2 <<
" + " << time3 << endl;
339 time2 = 0; time3 = 0;
347 double time_end = MPI_Wtime();
351 cout <<
" Total time: " << time_end - time_beg << endl;
int main(int argc, char *argv[])
SpParMat< int64_t, bool, SpDCCols< int64_t, bool > > PSpMat_Bool
FullyDistSpVec< int64_t, int64_t > getReachesSPMM(FullyDistSpVec< int64_t, int64_t > &sources, PSpMat_Int64 &A, FullyDistVec< int64_t, int64_t > &enodes)
FullyDistSpVec< int64_t, int64_t > getReachesSPMV(FullyDistSpVec< int64_t, int64_t > &sources, PSpMat_Int64 &A, FullyDistVec< int64_t, int64_t > &enodes)
FullyDistSpVec< int64_t, int64_t > getReach(int64_t source, PSpMat_Int64 &A, FullyDistVec< int64_t, int64_t > &enodes)
void Symmetricize(PARMAT &A)
SpParMat< int64_t, int64_t, SpDCCols< int64_t, int64_t > > PSpMat_Int64
void GenGraph500Data(double initiator[4], int log_numverts, int edgefactor, bool scramble=false, bool packed=false)
std::shared_ptr< CommGrid > getcommgrid() const
void Select(const FullyDistVec< IT, NT1 > &denseVec, _UnaryOperation unop)
FullyDistVec< IT, IT > FindInds(_Predicate pred) const
std::vector< IT > GetLocalInd()
void SetElement(IT indx, NT numx)
Indexing is performed 0-based.
FullyDistVec< IT, IT > FindInds(_Predicate pred) const
Return the indices where pred is true.
void SetElement(IT indx, NT numx)
void iota(IT globalsize, NT first)
void Set(const FullyDistSpVec< IT, NT > &rhs)
void Apply(_UnaryOperation __unary_op)
std::pair< IT, NT > MinElement() const
FullyDistVec< IT, NT > Reduce(Dim dim, _BinaryOperation __binary_op, NT id, _UnaryOperation __unary_op) const
void ReadDistribute(const std::string &filename, int master, bool nonum, HANDLER handler, bool transpose=false, bool pario=false)
MPI_Datatype MPIType< int64_t >(void)
Dcsc< IU, typename promote_trait< NU1, NU2 >::T_promote > EWiseMult(const Dcsc< IU, NU1 > &A, const Dcsc< IU, NU2 > *B, bool exclude)
static void axpy(bool a, const T_promote &x, T_promote &y)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static T_promote multiply(const bool &arg1, const T_promote &arg2)
static bool returnedSAID()