You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
6 years ago
|
#include <stdio.h>
|
||
|
#include <sys/time.h>
|
||
|
|
||
|
#include "knnSerialDeclarations.h"
|
||
|
|
||
|
/* Structs */
|
||
|
struct timeval startwtime, endwtime;
|
||
|
double seq_time;
|
||
|
|
||
|
/* Global variable */
|
||
|
int numberOfPoints = 0, numberOfDimensions = 0, numberOfNeighbors = 0, direction = 0;
|
||
|
char *pointsFilename, *testFilename;
|
||
|
|
||
|
/* Main */
|
||
|
int main(int argc, char **argv){
|
||
|
double **pointsArray;
|
||
|
neighbor **sortedNeighborsArray;
|
||
|
|
||
|
getArguments(argc, argv);
|
||
|
init(&pointsArray, &sortedNeighborsArray);
|
||
|
|
||
|
gettimeofday(&startwtime, NULL);
|
||
|
|
||
|
calculateDistances(&pointsArray, &pointsArray, &sortedNeighborsArray);
|
||
|
|
||
|
gettimeofday(&endwtime, NULL);
|
||
|
seq_time = (double)((endwtime.tv_usec - startwtime.tv_usec)/1.0e6
|
||
|
+ endwtime.tv_sec - startwtime.tv_sec);
|
||
|
printf("Wall clock time = %f\n\n", seq_time);
|
||
|
|
||
|
if (test(&sortedNeighborsArray, testFilename)){
|
||
|
printf("Validity check failed!\n");
|
||
|
} else {
|
||
|
printf("Validity check success!\n");
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Uncomment to print the results
|
||
|
*/
|
||
|
/*for (int x=0; x<numberOfPoints; ++x){
|
||
|
for (int y=0; y<numberOfNeighbors; ++y){
|
||
|
printf("%d to %d = %f\n", x, sortedNeighborsArray[x][y].neighborId, sortedNeighborsArray[x][y].distance);
|
||
|
}
|
||
|
printf("\n");
|
||
|
}*/
|
||
|
|
||
|
cleanUp(&pointsArray, &sortedNeighborsArray);
|
||
|
}
|