Skip to content

Commit 639ff67

Browse files
committed
Save first 10 frontier matrices in mtx format.
1 parent 2381a1f commit 639ff67

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

Applications/BetwCent.cpp

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ int main(int argc, char* argv[])
8686
int K4Approx = atoi(argv[2]);
8787
int batchSize = atoi(argv[3]);
8888

89-
string directory(argv[1]);
90-
string ifilename = "input.mtx";
91-
ifilename = directory+"/"+ifilename;
89+
// string directory(argv[1]);
90+
string ifilename(argv[1]);
91+
string frontier_dir(argv[4]);
92+
// string ifilename = "input.mtx";
93+
// ifilename = directory+"/"+ifilename;
9294

9395
shared_ptr<CommGrid> fullWorld;
9496
fullWorld.reset( new CommGrid(MPI_COMM_WORLD, 0, 0) );
@@ -175,16 +177,26 @@ int main(int argc, char* argv[])
175177
Dist<int>::MPI_DCCols nsp(nsploc, AT.getcommgrid());
176178
vector < Dist<bool>::MPI_DCCols * > bfs; // internally keeps track of depth
177179

178-
SpParHelper::Print("Exploring via BFS...\n");
179-
while( fringe.getnnz() > 0 )
180-
{
181-
nsp += fringe;
182-
Dist<bool>::MPI_DCCols * level = new Dist<bool>::MPI_DCCols( fringe );
183-
bfs.push_back(level);
180+
SpParHelper::Print("Exploring via BFS...\n");
181+
int iter = 0;
182+
while( fringe.getnnz() > 0 )
183+
{
184+
nsp += fringe;
185+
Dist<bool>::MPI_DCCols * level = new Dist<bool>::MPI_DCCols( fringe );
186+
bfs.push_back(level);
187+
188+
if(iter < 10) {
189+
string frontier_filename = frontier_dir + "/" + string("batch_") + std::to_string(i) + string("_forwarditer_") + std::to_string(iter)+string(".mtx");
190+
fringe.ParallelWriteMM(frontier_filename, true);
191+
iter++;
192+
}
193+
else {
194+
exit(-1);
195+
}
184196

185-
fringe = PSpGEMM<PTBOOLINT>(AT, fringe);
186-
fringe = EWiseMult(fringe, nsp, true);
187-
}
197+
fringe = PSpGEMM<PTBOOLINT>(AT, fringe);
198+
fringe = EWiseMult(fringe, nsp, true);
199+
}
188200

189201
// Apply the unary function 1/x to every element in the matrix
190202
// 1/x works because no explicit zeros are stored in the sparse matrix nsp
@@ -226,7 +238,7 @@ int main(int argc, char* argv[])
226238
fprintf(stdout, "%.6lf seconds elapsed for %d starting vertices\n", t2-t1, nPasses);
227239
fprintf(stdout, "TEPS score is: %.6lf\n", TEPS);
228240
}
229-
ofstream output(argv[4]);
241+
ofstream output(argv[5]);
230242
bc.SaveGathered(output, 0);
231243
output.close();
232244
}

0 commit comments

Comments
 (0)