Exercise 3 for the course "Parallel and distributed systems" of THMMY in AUTH university.
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.
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include "meanshift_utils.h"
|
|
|
|
#include "meanshift_gpu_utils.h"
|
|
|
|
|
|
|
|
int DEVIATION = 20;
|
|
|
|
int NUMBER_OF_POINTS = 1024;
|
|
|
|
int DIMENSIONS = 32;
|
|
|
|
const char *POINTS_FILENAME = "../data/32";
|
|
|
|
parameters params;
|
|
|
|
|
|
|
|
struct timeval startwtime, endwtime;
|
|
|
|
double seq_time;
|
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
|
|
|
int recursions = 0;
|
|
|
|
double **vectors, **shifted_points;
|
|
|
|
|
|
|
|
//inits parameters
|
|
|
|
params.epsilon = 0.0001;
|
|
|
|
params.verbose = true;
|
|
|
|
params.display = true;
|
|
|
|
|
|
|
|
get_args(argc, argv, ¶ms);
|
|
|
|
init(&vectors);
|
|
|
|
|
|
|
|
// tic
|
|
|
|
gettimeofday (&startwtime, NULL);
|
|
|
|
recursions = meanshift(vectors, &shifted_points, DEVIATION);
|
|
|
|
|
|
|
|
// toc
|
|
|
|
gettimeofday (&endwtime, NULL);
|
|
|
|
seq_time = (double)((endwtime.tv_usec - startwtime.tv_usec)/1.0e6 + endwtime.tv_sec - startwtime.tv_sec);
|
|
|
|
|
|
|
|
printf("\nTotal number of recursions = %d\n", recursions);
|
|
|
|
printf("%s wall clock time = %f\n","Mean Shift", seq_time);
|
|
|
|
|
|
|
|
free(vectors[0]);
|
|
|
|
free(vectors);
|
|
|
|
free(shifted_points[0]);
|
|
|
|
free(shifted_points);
|
|
|
|
}
|