Browse Source

remove denominator from host

master
anapt 7 years ago
parent
commit
bcdbd2913e
  1. 56
      mean_shift_cuda/meanshift_gpu_utils.cu

56
mean_shift_cuda/meanshift_gpu_utils.cu

@ -104,19 +104,19 @@ int meanshift(double **original_points, double ***shifted_points, int deviation
// calculates denominator // calculates denominator
calculate_denominator(d_kernel_matrix, d_denominator, &denominator); calculate_denominator(d_kernel_matrix, d_denominator, &denominator);
size = NUMBER_OF_POINTS * sizeof(double); // size = NUMBER_OF_POINTS * sizeof(double);
// tic // // tic
gettimeofday (&start, NULL); // gettimeofday (&start, NULL);
gpuErrchk( cudaMemcpy(d_denominator.elements, &(denominator[0]) // gpuErrchk( cudaMemcpy(d_denominator.elements, &(denominator[0])
, size, cudaMemcpyHostToDevice) ); // , size, cudaMemcpyHostToDevice) );
// toc // // toc
gettimeofday (&end, NULL); // gettimeofday (&end, NULL);
seq = (double)((end.tv_usec - start.tv_usec)/1.0e6 + end.tv_sec - start.tv_sec); // seq = (double)((end.tv_usec - start.tv_usec)/1.0e6 + end.tv_sec - start.tv_sec);
//
//
// printf("%s wall clock time = %f\n","Device memory allocation", seq); //// printf("%s wall clock time = %f\n","Device memory allocation", seq);
// to create output data file // // to create output data file
printf("%f ", seq); // printf("%f ", seq);
// creates new y vector // creates new y vector
@ -289,21 +289,21 @@ void calculate_denominator(Matrix d_kernel_matrix, Matrix d_denominator, double
first_iter = false; first_iter = false;
} }
size = NUMBER_OF_POINTS * sizeof(double); // size = NUMBER_OF_POINTS * sizeof(double);
// tic // // tic
gettimeofday (&start, NULL); // gettimeofday (&start, NULL);
//
gpuErrchk( cudaMemcpy(&((*denominator)[0]), d_denominator.elements // gpuErrchk( cudaMemcpy(&((*denominator)[0]), d_denominator.elements
, size, cudaMemcpyDeviceToHost) ); // , size, cudaMemcpyDeviceToHost) );
//
// toc // // toc
gettimeofday (&end, NULL); // gettimeofday (&end, NULL);
seq = (double)((end.tv_usec - start.tv_usec)/1.0e6 + end.tv_sec - start.tv_sec); // seq = (double)((end.tv_usec - start.tv_usec)/1.0e6 + end.tv_sec - start.tv_sec);
//
//
// printf("%s wall clock time = %f\n","Copying from device to host", seq); //// printf("%s wall clock time = %f\n","Copying from device to host", seq);
// to create output data file // // to create output data file
printf("%f ", seq); // printf("%f ", seq);
} }
void shift_points(Matrix d_kernel_matrix, Matrix d_original_points, Matrix d_shifted_points, void shift_points(Matrix d_kernel_matrix, Matrix d_original_points, Matrix d_shifted_points,

Loading…
Cancel
Save