From 26869bc13af82e38858f6730968454271eb66c05 Mon Sep 17 00:00:00 2001 From: anapt Date: Tue, 23 Jan 2018 12:03:12 +0200 Subject: [PATCH] 2D memory alloc, norm refactored as __device__ function --- meanshift.c | 113 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 17 deletions(-) diff --git a/meanshift.c b/meanshift.c index 51e4b4f..6c168b3 100644 --- a/meanshift.c +++ b/meanshift.c @@ -1,8 +1,11 @@ #include #include #include +#include +#include #include "serial_declarations.h" +#define N 512 int NUMBER_OF_POINTS = 600; int DIMENSIONS = 2; @@ -15,6 +18,19 @@ double seq_time; int meanshift(double **original_points, double ***shifted_points, int h , parameters *opt, int iteration); +__device__ double norm(double **matrix, int rows, int cols){ + + double sum=0, temp_mul=0; + for (int i=0; i