gpuqsort2
This code is a scalar implementation of a quick sort algorithm that had been ported to
GPUs.
Code Snippet
//All variables in this code region are integers.
for(int bx =0; bx < blocks; bx++){ start = params[bx].from; end = params[bx].end; int coal = (start&0xf); start = start-coal; pivot = params[bx].pivot; for(int tx = 0; tx < threads; tx++){ int x = lengths->left[bx] + hist->left[bx*(threads)+tx]-1; int y = lengths->right[bx] - hist->right[bx*(threads)+tx]; if(tx+start<end){ unsigned int d = data[tx+start]; if(!(tx<coal)){ if(d<pivot) data2[x--]=d; else if(d>pivot) data2[y++]=d; } } for(unsigned int i=start+tx+threads; i<end; i+=threads){ unsigned int d = data[i]; if(d<pivot){ data2[x--]=d; }else if(d>pivot) data2[y++]=d; } } }