Skip to content
Snippets Groups Projects
Commit c1721b90 authored by Zenovore's avatar Zenovore
Browse files

Change spacing

parent 5603b3a4
No related merge requests found
......@@ -107,9 +107,11 @@ __global__ void mergeSort(int* output, int *temporary_array, int index, int widt
int x = blockIdx.x * blockDim.x + threadIdx.x;
int left = width*x*arrayPerThread;
int mid,right;
for(int i = 0; i < arrayPerThread; i++){
if(left >= index) break;
mid = fminf(left+(width/2), index); // ini min nya emang defined? @nyamnyam, nggak tau, tpi blm merge sort aja di TC 4 ada segfault, jdi mau solve itu dlu
mid = fminf(left+(width/2), index);
right = fminf(left+width, index);
mergeArray(output, temporary_array, left, mid, right);
left += width;
......@@ -164,7 +166,7 @@ void convolutionWithCUDA(int* output, int* kernel, int* target, int rowKernel, i
long nThreads = thread_num;
for(int width = 2; width < index*2; width*=2){
int arrayPerThread = index/(nThreads*width) + 1;
mergeSort<<<1, dim3(thread_num, 1, 1)>>>(output_datarange, temporary_array, index, width, arrayPerThread);
mergeSort<<<1, thread_num>>>(output_datarange,temporary_array, index, width, arrayPerThread);
temp_swap = output_datarange;
output_datarange = temporary_array;
temporary_array = temp_swap;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment