Hello,
I’m trying to sort an array. I’ve made this kernel.
global void sort_table(fileChar *chars, fileChar *charsOut){
int index = (blockIdx.x * blockDim.x) + threadIdx.x;
int i, rank = 0;
shared fileChar table[256];
table[index] = chars[index];
for (i = 0; i < blockDim.x * blockDim.y; ++i) {
if (index == i)
continue;
if(table[i].prob < table[index].prob) rank++;
else if(table[i].prob == table[index].prob && i < index) rank++;
}
charsOut[rank] = table[index];
__syncthreads();
}
Can anyone tell what is going wrong on this?
Thanks