|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include "serial_gs_pagerank_functions.h"
|
|
|
|
#include "sparse_matrix.h"
|
|
|
|
|
|
|
|
struct timeval startwtime, endwtime;
|
|
|
|
double seq_time;
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
SparseMatrix transitionMatrix;
|
|
|
|
double *pagerankVector;
|
|
|
|
Parameters parameters;
|
|
|
|
|
|
|
|
transitionMatrix = createSparseMatrix();
|
|
|
|
|
|
|
|
parseArguments(argc, argv, ¶meters);
|
|
|
|
|
|
|
|
initialize(&transitionMatrix, &pagerankVector, ¶meters);
|
|
|
|
|
|
|
|
// Starts wall-clock timer
|
|
|
|
gettimeofday (&startwtime, NULL);
|
|
|
|
|
|
|
|
int iterations = pagerank(&transitionMatrix, &pagerankVector, parameters);
|
|
|
|
if (parameters.verbose) {
|
|
|
|
printf("\n----- Results -----\
|
|
|
|
\nTotal iterations = %d\n", iterations);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stops wall-clock timer
|
|
|
|
gettimeofday (&endwtime, NULL);
|
|
|
|
double seq_time = (double)((endwtime.tv_usec - startwtime.tv_usec)/1.0e6 +
|
|
|
|
endwtime.tv_sec - startwtime.tv_sec);
|
|
|
|
printf("%s wall clock time = %f\n","Pagerank (Gauss-Seidel method), serial implementation",
|
|
|
|
seq_time);
|
|
|
|
}
|