@@ -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 ) );
@@ -195,18 +197,29 @@ int main(int argc, char* argv[])
195197 DenseParMat<int , double > bcu (1.0 , AT.getcommgrid (), fringe.getlocalrows (), fringe.getlocalcols () );
196198
197199 SpParHelper::Print (" Tallying...\n " );
198- // BC update for all vertices except the sources
199- for (int j = bfs.size ()-1 ; j > 0 ; --j)
200- {
201- Dist<double >::MPI_DCCols w = EWiseMult ( *bfs[j], nspInv, false );
202- w.EWiseScale (bcu);
203-
204- Dist<double >::MPI_DCCols product = PSpGEMM<PTBOOLDOUBLE>(A,w);
205- product = EWiseMult (product, *bfs[j-1 ], false );
206- product = EWiseMult (product, nsp, false );
200+ // BC update for all vertices except the sources
201+ iter = 0 ;
202+ for (int j = bfs.size ()-1 ; j > 0 ; --j)
203+ {
204+ Dist<double >::MPI_DCCols w = EWiseMult ( *bfs[j], nspInv, false );
205+ w.EWiseScale (bcu);
206+
207+ if (iter < 10 ) {
208+ string frontier_filename =
209+ frontier_dir + " /" + string (" batch_" ) + std::to_string (i) + string (" _backwarditer_" ) +
210+ std::to_string (iter) + string (" .mtx" );
211+ w.ParallelWriteMM (frontier_filename, true );
212+ iter++;
213+ }
214+ else {
215+ exit (-1 );
216+ }
217+ Dist<double >::MPI_DCCols product = PSpGEMM<PTBOOLDOUBLE>(A,w);
218+ product = EWiseMult (product, *bfs[j-1 ], false );
219+ product = EWiseMult (product, nsp, false );
207220
208- bcu += product;
209- }
221+ bcu += product;
222+ }
210223 for (int j=0 ; j < bfs.size (); ++j)
211224 {
212225 delete bfs[j];
@@ -226,7 +239,7 @@ int main(int argc, char* argv[])
226239 fprintf (stdout, " %.6lf seconds elapsed for %d starting vertices\n " , t2-t1, nPasses);
227240 fprintf (stdout, " TEPS score is: %.6lf\n " , TEPS);
228241 }
229- ofstream output (argv[4 ]);
242+ ofstream output (argv[5 ]);
230243 bc.SaveGathered (output, 0 );
231244 output.close ();
232245 }
0 commit comments