diff --git a/openmp/Makefile b/openmp/Makefile index 2e297ea..a810950 100644 --- a/openmp/Makefile +++ b/openmp/Makefile @@ -7,8 +7,8 @@ CC = gcc -std=gnu99 -fopenmp RM = rm -f CFLAGS_DEBUG=-O0 -ggdb3 -Wall -I. CFLAGS=-O3 -Wall -I. -OBJ=serial_gs_pagerank.o serial_gs_pagerank_functions.o coo_sparse_matrix.o csr_sparse_matrix.o -DEPS=serial_gs_pagerank_functions.h coo_sparse_matrix.h csr_sparse_matrix.h +OBJ=openmp_gs_pagerank.o openmp_gs_pagerank_functions.o coo_sparse_matrix.o csr_sparse_matrix.o +DEPS=openmp_gs_pagerank_functions.h coo_sparse_matrix.h csr_sparse_matrix.h # ========================================== # TARGETS diff --git a/openmp/coo_sparse_matrix.c b/openmp/coo_sparse_matrix.c index 93d0ac9..689a0fe 100644 --- a/openmp/coo_sparse_matrix.c +++ b/openmp/coo_sparse_matrix.c @@ -15,9 +15,8 @@ void allocMemoryForCoo(CooSparseMatrix *sparseMatrix, int numberOfElements) { } void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column) { + // Checks if there is enough space allocated if (sparseMatrix->numberOfNonZeroElements == sparseMatrix->size) { - printf("%d == %d |||| %d, %d\n", sparseMatrix->numberOfNonZeroElements, - sparseMatrix->size, row, column); printf("Number of non zero elements exceeded size of matrix!\n"); exit(EXIT_FAILURE); } @@ -29,6 +28,7 @@ void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column newElement->rowIndex = row; newElement->columnIndex = column; + // Adds the new element to the first empty (NULL) address of the matrix sparseMatrix->elements[sparseMatrix->numberOfNonZeroElements] = newElement; sparseMatrix->numberOfNonZeroElements = sparseMatrix->numberOfNonZeroElements + 1; } @@ -42,14 +42,19 @@ void transposeSparseMatrix(CooSparseMatrix *sparseMatrix) { } } +/* + * This function is a port of the one found here: + * https://github.com/scipy/scipy/blob/3b36a57/scipy/sparse/sparsetools/coo.h#L34 +*/ void transformToCSR(CooSparseMatrix initialSparseMatrix, CsrSparseMatrix *transformedSparseMatrix) { - // Taken from here: https://github.com/scipy/scipy/blob/3b36a57/scipy/sparse/sparsetools/coo.h#L34 - if (initialSparseMatrix.numberOfNonZeroElements > transformedSparseMatrix->size) { + // Checks if the sizes of the two matrices fit + if (initialSparseMatrix.numberOfNonZeroElements > transformedSparseMatrix->numberOfElements) { printf("Transformed CSR matrix does not have enough space!\n"); exit(EXIT_FAILURE); } + // Calculates the elements per row for (int i=0; irowIndex; transformedSparseMatrix->rowCumulativeIndexes[rowIndex] = @@ -63,6 +68,7 @@ void transformToCSR(CooSparseMatrix initialSparseMatrix, sum += temp; } + // Copies the values and columns of the elements for (int i=0; irowIndex; int destinationIndex = transformedSparseMatrix->rowCumulativeIndexes[row]; @@ -73,13 +79,12 @@ void transformToCSR(CooSparseMatrix initialSparseMatrix, transformedSparseMatrix->rowCumulativeIndexes[row]++; } + // Fixes the cumulative sum for (int i=0, last=0; i<=transformedSparseMatrix->size; i++){ int temp = transformedSparseMatrix->rowCumulativeIndexes[i]; transformedSparseMatrix->rowCumulativeIndexes[i] = last; last = temp; } - - transformedSparseMatrix->numberOfNonZeroElements = initialSparseMatrix.numberOfNonZeroElements; } void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, diff --git a/openmp/coo_sparse_matrix.h b/openmp/coo_sparse_matrix.h index dd4c31d..0a34b7e 100644 --- a/openmp/coo_sparse_matrix.h +++ b/openmp/coo_sparse_matrix.h @@ -1,6 +1,8 @@ #ifndef COO_SPARSE_MATRIX_H /* Include guard */ #define COO_SPARSE_MATRIX_H +/* ===== INCLUDES ===== */ + #include #include #include @@ -8,26 +10,51 @@ #include "csr_sparse_matrix.h" +/* ===== STRUCTURES ===== */ + +// One element of the coordinate formated sparse matrix. typedef struct cooSparseMatrixElement { double value; int rowIndex, columnIndex; } CooSparseMatrixElement; +// A sparse matrix in COOrdinate format (aka triplet format). typedef struct cooSparseMatrix { int size, numberOfNonZeroElements; CooSparseMatrixElement **elements; } CooSparseMatrix; +/* ===== FUNCTION DEFINITIONS ===== */ + +// initCooSparseMatrix creates and initializes the members of a CooSparseMatrix +// structure instance. CooSparseMatrix initCooSparseMatrix(); + +//allocMemoryForCoo allocates memory for the elements of the matrix. void allocMemoryForCoo(CooSparseMatrix *sparseMatrix, int numberOfElements); + +// addElement adds an element representing the triplet passed in the arguments +// to the first empty address of the space allocated for the elements. void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column); + +// transposeSparseMatrix transposes the matrix. void transposeSparseMatrix(CooSparseMatrix *sparseMatrix); + +// transformToCSR transforms the sparse matrix representation format from COO +// to CSR. void transformToCSR(CooSparseMatrix initialSparseMatrix, CsrSparseMatrix *transformedSparseMatrix); + +// cooSparseMatrixVectorMultiplication calculates the product of a +// CooSparseMatrix and a vector. void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, double *vector, double **product, int vectorSize); + +// destroyCooSparseMatrix frees all space used by the CooSparseMatrix. void destroyCooSparseMatrix(CooSparseMatrix *sparseMatrix); + +// printCooSparseMatrix prints the values of a CooSparseMatrix. void printCooSparseMatrix(CooSparseMatrix sparseMatrix); #endif // COO_SPARSE_MATRIX_H \ No newline at end of file diff --git a/openmp/coo_sparse_matrix.o b/openmp/coo_sparse_matrix.o deleted file mode 100644 index 8b80d4e..0000000 Binary files a/openmp/coo_sparse_matrix.o and /dev/null differ diff --git a/openmp/csr_sparse_matrix.c b/openmp/csr_sparse_matrix.c index bdf8413..65e200a 100644 --- a/openmp/csr_sparse_matrix.c +++ b/openmp/csr_sparse_matrix.c @@ -3,7 +3,7 @@ CsrSparseMatrix initCsrSparseMatrix() { CsrSparseMatrix sparseMatrix; sparseMatrix.size = 0; - sparseMatrix.numberOfNonZeroElements = 0; + sparseMatrix.numberOfElements = 0; sparseMatrix.values = NULL; sparseMatrix.columnIndexes = NULL; @@ -11,21 +11,23 @@ CsrSparseMatrix initCsrSparseMatrix() { return sparseMatrix; } -void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int numberOfElements) { +void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int size, int numberOfElements) { sparseMatrix->values = (double *) malloc(numberOfElements * sizeof(double)); sparseMatrix->columnIndexes = (int *) malloc( numberOfElements * sizeof(int)); sparseMatrix->rowCumulativeIndexes = (int *) malloc( - (numberOfElements + 1) * sizeof(int)); + (size + 1) * sizeof(int)); - for (int i=0; irowCumulativeIndexes[i] = 0; } - sparseMatrix->size = numberOfElements; + + sparseMatrix->size = size; + sparseMatrix->numberOfElements = numberOfElements; } -// Row indexes start from 0! void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row) { + // Gets start and end indexes of the row's elements int startIndex = sparseMatrix->rowCumulativeIndexes[row], endIndex = sparseMatrix->rowCumulativeIndexes[row+1]; for (int i=startIndex; inumberOfNonZeroElements; ++i){ + for (int i=0; inumberOfElements; ++i){ if(sparseMatrix->columnIndexes[i] == column){ - // Zeros out this element sparseMatrix->values[i] = 0; } } diff --git a/openmp/csr_sparse_matrix.h b/openmp/csr_sparse_matrix.h index a964514..5588e9a 100644 --- a/openmp/csr_sparse_matrix.h +++ b/openmp/csr_sparse_matrix.h @@ -1,24 +1,47 @@ #ifndef CSR_SPARSE_MATRIX_H /* Include guard */ #define CSR_SPARSE_MATRIX_H +/* ===== INCLUDES ===== */ + #include #include #include #include +/* ===== STRUCTURES ===== */ + +// A sparse matrix in compressed SparseRow format. typedef struct csrSparseMatrix { - int size, numberOfNonZeroElements; + int size, numberOfElements; int *rowCumulativeIndexes, *columnIndexes; double *values; } CsrSparseMatrix; +/* ===== FUNCTION DEFINITIONS ===== */ + +// initCsrSparseMatrix creates and initializes the members of a CsrSparseMatrix +// structure instance. CsrSparseMatrix initCsrSparseMatrix(); -void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int numberOfElements); + +// allocMemoryForCsr allocates memory for the elements of the matrix. +void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int size, int numberOfElements); + +// zeroOutRow assigns a zero value to all the elements of a row in the matrix. void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row); + +// zeroOutColumn assigns a zero value to all the elements of a column in the +// matrix. void zeroOutColumn(CsrSparseMatrix *sparseMatrix, int column); + +// csrSparseMatrixVectorMultiplication calculates the product of a +// CsrSparseMatrix and a vector. void csrSparseMatrixVectorMultiplication(CsrSparseMatrix sparseMatrix, double *vector, double **product, int vectorSize); + +// destroyCsrSparseMatrix frees all space used by the CsrSparseMatrix. void destroyCsrSparseMatrix(CsrSparseMatrix *sparseMatrix); + +// printCsrSparseMatrix prints the values of a CsrSparseMatrix. void printCsrSparseMatrix(CsrSparseMatrix sparseMatrix); #endif // CSR_SPARSE_MATRIX_H \ No newline at end of file diff --git a/openmp/csr_sparse_matrix.o b/openmp/csr_sparse_matrix.o deleted file mode 100644 index c5872b4..0000000 Binary files a/openmp/csr_sparse_matrix.o and /dev/null differ diff --git a/openmp/openmp_gs_pagerank.c b/openmp/openmp_gs_pagerank.c new file mode 100644 index 0000000..17a4e66 --- /dev/null +++ b/openmp/openmp_gs_pagerank.c @@ -0,0 +1,65 @@ +#include + +#include "openmp_gs_pagerank_functions.h" + +struct timeval startwtime, endwtime; + +int main(int argc, char **argv) { + CsrSparseMatrix transitionMatrix = initCsrSparseMatrix(); + double *pagerankVector; + bool convergenceStatus; + Parameters parameters; + int maxIterationsForConvergence = 0; + + parseArguments(argc, argv, ¶meters); + + initialize(&transitionMatrix, &pagerankVector, ¶meters); + + // Saves information about the dataset to the output file + { + FILE *outputFile; + outputFile = fopen(parameters.outputFilename, "w"); + + if (outputFile == NULL) { + printf("Error while opening the output file.\n"); + exit(EXIT_FAILURE); + } + + fprintf(outputFile, "Pagerank will run for the dataset %s\n"\ + "Dataset contains %d pages with %d outlinks.\n", + parameters.graphFilename, parameters.numberOfPages, transitionMatrix.size); + + fclose(outputFile); + } + + // Starts wall-clock timer + gettimeofday (&startwtime, NULL); + int* iterations = (int *)malloc(parameters.numberOfPages*sizeof(int)); + + // Calculates pagerank + iterations = pagerank(&transitionMatrix, &pagerankVector, + &convergenceStatus, parameters, &maxIterationsForConvergence); + + // 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); + + printf(ANSI_COLOR_YELLOW "\n----- RESULTS -----\n" ANSI_COLOR_RESET); + if (convergenceStatus) { + printf(ANSI_COLOR_GREEN "Pagerank converged after %d iterations!\n" \ + ANSI_COLOR_RESET, maxIterationsForConvergence); + } else { + printf(ANSI_COLOR_RED "Pagerank did not converge after max number of" \ + " iterations (%d) was reached!\n" ANSI_COLOR_RESET, maxIterationsForConvergence); + } + + // Saves results to the output file + savePagerankToFile(parameters.outputFilename, iterations, pagerankVector, + parameters.numberOfPages, maxIterationsForConvergence); + + free(pagerankVector); + destroyCsrSparseMatrix(&transitionMatrix); +} diff --git a/openmp/serial_gs_pagerank_functions.c b/openmp/openmp_gs_pagerank_functions.c similarity index 75% rename from openmp/serial_gs_pagerank_functions.c rename to openmp/openmp_gs_pagerank_functions.c index cb406c1..4d24b17 100644 --- a/openmp/serial_gs_pagerank_functions.c +++ b/openmp/openmp_gs_pagerank_functions.c @@ -1,12 +1,13 @@ /* ===== INCLUDES ===== */ -#include "serial_gs_pagerank_functions.h" -#include +#include "openmp_gs_pagerank_functions.h" + /* ===== CONSTANTS ===== */ const char *ARGUMENT_CONVERGENCE_TOLERANCE = "-c"; const char *ARGUMENT_MAX_ITERATIONS = "-m"; const char *ARGUMENT_DAMPING_FACTOR = "-a"; +const char *ARGUMENT_THREADS_NUMBER = "-t"; const char *ARGUMENT_VERBAL_OUTPUT = "-v"; const char *ARGUMENT_OUTPUT_HISTORY = "-h"; const char *ARGUMENT_OUTPUT_FILENAME = "-o"; @@ -15,26 +16,31 @@ const int NUMERICAL_BASE = 10; char *DEFAULT_OUTPUT_FILENAME = "pagerank_output"; const int FILE_READ_BUFFER_SIZE = 4096; -const int CONVERGENCE_CHECK_ITERATION_PERIOD = 3; -const int SPARSITY_INCREASE_ITERATION_PERIOD = 3; +const int CONVERGENCE_CHECK_ITERATION_PERIOD = 2; +const int SPARSITY_INCREASE_ITERATION_PERIOD = 10; + +/* ===== GLOBAL VARIABLES ====== */ + +int numberOfThreads; /* ===== FUNCTIONS ===== */ -int pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, - bool *convergenceStatus, Parameters parameters) { +int* pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, + bool *convergenceStatus, Parameters parameters, int* maxIterationsForConvergence) { // Variables declaration - int iterations = 0, numberOfPages = parameters.numberOfPages; + int numberOfPages = parameters.numberOfPages; + int *iterations; double delta, *pagerankDifference, *previousPagerankVector, *convergedPagerankVector, *linksFromConvergedPagesPagerankVector; + CsrSparseMatrix originalTransitionMatrix = initCsrSparseMatrix(); CooSparseMatrix linksFromConvergedPages = initCooSparseMatrix(); bool *convergenceMatrix; - int P = omp_get_max_threads(); - omp_set_num_threads(P); - // Space allocation { size_t sizeofDouble = sizeof(double); + // iterations until each page converged + iterations = (int *) malloc(numberOfPages * sizeof(int)); // pagerankDifference used to calculate delta pagerankDifference = (double *) malloc(numberOfPages * sizeofDouble); // previousPagerankVector holds last iteration's pagerank vector @@ -50,12 +56,22 @@ int pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, *convergenceStatus = false; // Initialization - allocMemoryForCoo(&linksFromConvergedPages, transitionMatrix->numberOfNonZeroElements); - #pragma omp parallel for num_threads(P) + // originalTransitionMatrix used to run pagerank in phases + allocMemoryForCsr(&originalTransitionMatrix, transitionMatrix->size, transitionMatrix->numberOfElements); + memcpy(originalTransitionMatrix.rowCumulativeIndexes, transitionMatrix->rowCumulativeIndexes, + (transitionMatrix->size+1) * sizeof(int)); + memcpy(originalTransitionMatrix.columnIndexes, transitionMatrix->columnIndexes, + transitionMatrix->numberOfElements * sizeof(int)); + memcpy(originalTransitionMatrix.values, transitionMatrix->values, + transitionMatrix->numberOfElements * sizeof(double)); + + allocMemoryForCoo(&linksFromConvergedPages, transitionMatrix->numberOfElements); + #pragma omp parallel for num_threads(numberOfThreads) for (int i=0; ivalues, originalTransitionMatrix.values, + transitionMatrix->numberOfElements * sizeof(double)); + #pragma omp parallel for num_threads(numberOfThreads) + for (int i=0; i 10) { + if (argumentCount < 2 || argumentCount > 16) { validUsage(argumentVector[0]); } + numberOfThreads = omp_get_max_threads(); + (*parameters).numberOfPages = 0; (*parameters).maxIterations = 0; - (*parameters).convergenceCriterion = 1; + (*parameters).convergenceCriterion = 0.001; (*parameters).dampingFactor = 0.85; (*parameters).verbose = false; (*parameters).history = false; @@ -304,6 +336,15 @@ void parseArguments(int argumentCount, char **argumentVector, Parameters *parame exit(EXIT_FAILURE); } (*parameters).dampingFactor = alphaInput; + } else if (!strcmp(argumentVector[argumentIndex], ARGUMENT_THREADS_NUMBER)) { + argumentIndex = checkIncrement(argumentIndex, argumentCount, argumentVector[0]); + + size_t threadsInput = strtol(argumentVector[argumentIndex], &endPointer, NUMERICAL_BASE); + if (threadsInput == 0 && endPointer) { + printf("Invalid iterations argument\n"); + exit(EXIT_FAILURE); + } + numberOfThreads = threadsInput; } else if (!strcmp(argumentVector[argumentIndex], ARGUMENT_VERBAL_OUTPUT)) { (*parameters).verbose = true; } else if (!strcmp(argumentVector[argumentIndex], ARGUMENT_OUTPUT_HISTORY)) { @@ -423,33 +464,27 @@ void generateNormalizedTransitionMatrixFromFile(CsrSparseMatrix *transitionMatri // Calculates the outdegree of each page and assigns the uniform probability // of transition to the elements of the corresponding row - int* pageOutdegree = malloc((*parameters).numberOfPages*sizeof(int)); for (int i=0; i<(*parameters).numberOfPages; ++i){ pageOutdegree[i] = 0; } - for (int i=0; irowIndex; - - if (currentRow == tempMatrix.elements[i]->rowIndex) { - ++pageOutdegree[currentRow]; - } - - + ++pageOutdegree[currentRow]; } for (int i=0; ivalue = 1./pageOutdegree[tempMatrix.elements[i]->rowIndex]; } - + free(pageOutdegree); + // Transposes the temporary transition matrix (P^T). transposeSparseMatrix(&tempMatrix); - allocMemoryForCsr(transitionMatrix, numberOfEdges); + + allocMemoryForCsr(transitionMatrix, (*parameters).numberOfPages, numberOfEdges); // Transforms the temporary COO matrix to the desired CSR format transformToCSR(tempMatrix, transitionMatrix); - //printCsrSparseMatrix(*transitionMatrix); destroyCooSparseMatrix(&tempMatrix); fclose(graphFile); @@ -486,27 +521,34 @@ int checkIncrement(int previousIndex, int maxIndex, char *programName) { return ++previousIndex; } -void savePagerankToFile(char *filename, bool append, double *pagerankVector, - int vectorSize, int realIterations) { +void savePagerankToFile(char *filename, int *iterationsUntilConvergence, + double *pagerankVector, int vectorSize, int iteration) { FILE *outputFile; - if (append) { - outputFile = fopen(filename, "a"); - } else { - outputFile = fopen(filename, "w"); - } + outputFile = fopen(filename, "a"); if (outputFile == NULL) { printf("Error while opening the output file.\n"); return; } - //Save numberofPages and convergence time - + + fprintf(outputFile, "\n----- Iteration %d -----\n", iteration); + + // Saves the pagerank vector + double sum = 0; for (int i=0; i #include #include +#include #include "coo_sparse_matrix.h" @@ -27,6 +28,7 @@ extern const char *ARGUMENT_CONVERGENCE_TOLERANCE; extern const char *ARGUMENT_MAX_ITERATIONS; extern const char *ARGUMENT_DAMPING_FACTOR; +extern const char *ARGUMENT_THREADS_NUMBER; extern const char *ARGUMENT_VERBAL_OUTPUT; extern const char *ARGUMENT_OUTPUT_HISTORY; extern const char *ARGUMENT_OUTPUT_FILENAME; @@ -41,7 +43,7 @@ extern const int FILE_READ_BUFFER_SIZE; // A data structure to conveniently hold the algorithm's parameters. typedef struct parameters { - int numberOfPages, maxIterations, realIterations; + int numberOfPages, maxIterations; double convergenceCriterion, dampingFactor; bool verbose, history; char *outputFilename, *graphFilename; @@ -71,8 +73,8 @@ void generateNormalizedTransitionMatrixFromFile(CsrSparseMatrix *transitionMatri // Function savePagerankToFile appends or overwrites the pagerank vector // "pagerankVector" to the file with the filename supplied in the arguments. -void savePagerankToFile(char *filename, bool append, double *pagerankVector, - int vectorSize, int realIterations); +void savePagerankToFile(char *filename, int *iterationsUntilConvergence, + double *pagerankVector, int vectorSize, int iteration); // Function initialize allocates memory for the pagerank vector, reads the // dataset from the file and creates the transition probability distribution @@ -92,7 +94,7 @@ void calculateNextPagerank(CsrSparseMatrix *transitionMatrix, // Function pagerank iteratively calculates the pagerank of each page until // either the convergence criterion is met or the maximum number of iterations // is reached. -int pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, - bool *convergenceStatus, Parameters parameters); +int* pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, + bool *convergenceStatus, Parameters parameters, int* maxIterationsForConvergence); -#endif // SERIAL_GS_PAGERANK_FUNCTIONS_H \ No newline at end of file +#endif // OPENMP_GS_PAGERANK_FUNCTIONS_H \ No newline at end of file diff --git a/openmp/pagerank.out b/openmp/pagerank.out deleted file mode 100644 index 37ff79d..0000000 Binary files a/openmp/pagerank.out and /dev/null differ diff --git a/openmp/serial_gs_pagerank.c b/openmp/serial_gs_pagerank.c deleted file mode 100644 index 3836cf8..0000000 --- a/openmp/serial_gs_pagerank.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include "serial_gs_pagerank_functions.h" -//#include "coo_sparse_matrix.h" - -struct timeval startwtime, endwtime; -double seq_time; - -int main(int argc, char **argv) { - CsrSparseMatrix transitionMatrix = initCsrSparseMatrix(); - double *pagerankVector; - bool convergenceStatus; - Parameters parameters; - omp_set_dynamic(0); - parseArguments(argc, argv, ¶meters); - - initialize(&transitionMatrix, &pagerankVector, ¶meters); - - // Starts wall-clock timer - gettimeofday (&startwtime, NULL); - - int iterations = pagerank(&transitionMatrix, &pagerankVector, - &convergenceStatus, parameters); - if (parameters.verbose) { - printf(ANSI_COLOR_YELLOW "\n----- RESULTS -----\n" ANSI_COLOR_RESET); - if (convergenceStatus) { - printf(ANSI_COLOR_GREEN "Pagerank converged after %d iterations!\n" \ - ANSI_COLOR_RESET, iterations); - } else { - printf(ANSI_COLOR_RED "Pagerank did not converge after max number of" \ - " iterations (%d) was reached!\n" ANSI_COLOR_RESET, 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); - - free(pagerankVector); - destroyCsrSparseMatrix(&transitionMatrix); -} diff --git a/openmp/serial_gs_pagerank.o b/openmp/serial_gs_pagerank.o deleted file mode 100644 index 366656b..0000000 Binary files a/openmp/serial_gs_pagerank.o and /dev/null differ diff --git a/openmp/serial_gs_pagerank_functions.o b/openmp/serial_gs_pagerank_functions.o deleted file mode 100644 index 6e91ac7..0000000 Binary files a/openmp/serial_gs_pagerank_functions.o and /dev/null differ