From 9aceeaf8ab36d839e4e2f382af5294ed1e191e0f Mon Sep 17 00:00:00 2001 From: anapt Date: Fri, 26 Jan 2018 19:34:05 +0200 Subject: [PATCH] device mem allocation timer --- mean_shift_cuda/meanshift_gpu_utils.cu | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mean_shift_cuda/meanshift_gpu_utils.cu b/mean_shift_cuda/meanshift_gpu_utils.cu index 0c5c95e..7c444bd 100644 --- a/mean_shift_cuda/meanshift_gpu_utils.cu +++ b/mean_shift_cuda/meanshift_gpu_utils.cu @@ -76,9 +76,19 @@ int meanshift(double **original_points, double ***shifted_points, int deviation kernel_matrix = alloc_double(NUMBER_OF_POINTS, NUMBER_OF_POINTS); denominator = (double *)malloc(NUMBER_OF_POINTS * sizeof(double)); + // tic + gettimeofday (&startwtime, NULL); + // allocates corresponding memory in device init_device_memory(original_points, *shifted_points, &d_original_points, &d_shifted_points, &d_kernel_matrix, &d_denominator, &d_mean_shift_vector); + // toc + gettimeofday (&endwtime, NULL); + seq_time = (double)((endwtime.tv_usec - startwtime.tv_usec)/1.0e6 + endwtime.tv_sec - startwtime.tv_sec); + + if (params.verbose){ + printf("%s wall clock time = %f\n","Device memory allocation", seq_time); + } } // finds pairwise distance matrix (inside radius)