Browse Source

compile error fixex

master
anapt 7 years ago
parent
commit
7ac2d6c61b
  1. 3
      mean_shift_cuda/meanshift_kernels.cu
  2. 2
      mean_shift_cuda/meanshift_kernels.h
  3. 4
      mean_shift_cuda/meanshift_utils.cu
  4. 2
      mean_shift_cuda/meanshift_utils.h

3
mean_shift_cuda/meanshift_kernels.cu

@ -54,8 +54,9 @@ __global__ void denominator_kernel<<<dimGrid, dimBlock>>>(Matrix denominator, Ma
int col = blockIdx.y * blockDim.y + threadIdx.y;
if (row>=total || col>=total)
if (row * denominator.width + col > denominator.width * denominator.height){
return;
}
denominator[col]=0;
denominator[row] += kernel_matrix[row*denominator.width + col];

2
mean_shift_cuda/meanshift_kernels.h

@ -13,6 +13,6 @@ __global__ void multiply_kernel(Matrix matrix1, Matrix matrix2, Matrix output);
__global__ void calculate_kernel_matrix_kernel(Matrix shifted_points, Matrix original_points
, double deviation, Matrix kernel_matrix);
__global__ void denominator_kernel(Matrix denominator, Matrix kernel_matrix, int T);
__global__ void denominator_kernel(Matrix denominator, Matrix kernel_matrix);
#endif //SERIAL_KERNELS_H

4
mean_shift_cuda/meanshift_utils.cu

@ -197,7 +197,7 @@ int meanshift(double **original_points, double ***shifted_points, int deviation
// }
// denominator[i] = sum;
// }
calculate_denominator(kernel_matrix);
denominator = calculate_denominator(kernel_matrix);
// creates new y vector
double **new_shift = alloc_2d_double(NUMBER_OF_POINTS, DIMENSIONS);
@ -469,7 +469,7 @@ double * calculate_denominator(double **kernel_matrix){
first_iter = false;
}
denominator_kernel<<<dimGrid, dimBlock>>>(d_denominator_matrix, d_kernel_matrix, T);
denominator_kernel<<<dimGrid, dimBlock>>>(d_denominator_matrix, d_kernel_matrix);
gpuErrchk( cudaPeekAtLastError() );
gpuErrchk( cudaDeviceSynchronize() );

2
mean_shift_cuda/meanshift_utils.h

@ -73,6 +73,6 @@ void save_matrix(double **matrix
//Function calculate_denominator allocates memory in GPU, sends the data and calls the
//denominator kernel function.
void calculate_denominator(double **kernel_matrix);
double * calculate_denominator(double **kernel_matrix);
#endif //SERIAL_UTILS_H
Loading…
Cancel
Save