radix-sort

How to sort with less precision on keys with Thrust library

删除回忆录丶 提交于 2019-12-24 13:03:07
问题 I have a set of integer values and I want to sort them using Thrust. Is there a possiblity for using only some high bits/low bits in this sorting. If possible I do not want to use user defined comparator, because it changes the used algorithm from radix-sort to merge-sort and increases elapsed time quite much. I think when all the numbers have the same value on a bit, the bit is skipped while sorting, so is it feasible to use the lowest possible bit number and hope it will be sufficient. (ie:

Does C++ Algorithm/Boost Lib have Radix Sort?

旧时模样 提交于 2019-12-22 06:31:25
问题 I want to sort integers and I know radix sort is supposed to be awesome for it. Any library implementation for this sort? 回答1: Depends on how strictly you define radix sort , since Boost 1.58.0 includes Spreadsort, which is a hybrid sorting algorithm that heuristically mixes bucket and comparison sorting. For sorting integers and with no requirement for worst-case Θ(n) efficiency, Spreadsort should satisfy you. For argument's sake, you can also take a look at my implementation of LSD radix

Does C++ Algorithm/Boost Lib have Radix Sort?

限于喜欢 提交于 2019-12-22 06:31:20
问题 I want to sort integers and I know radix sort is supposed to be awesome for it. Any library implementation for this sort? 回答1: Depends on how strictly you define radix sort , since Boost 1.58.0 includes Spreadsort, which is a hybrid sorting algorithm that heuristically mixes bucket and comparison sorting. For sorting integers and with no requirement for worst-case Θ(n) efficiency, Spreadsort should satisfy you. For argument's sake, you can also take a look at my implementation of LSD radix

Why bother with comparison sorts?

为君一笑 提交于 2019-12-21 10:16:32
问题 Algorithms like Timsort, Quicksort & Mergesort dominate the " real world " sorting methods. The case for these comparison sorts is quite practical — they've been shown to be the most performant, stable, multipurpose sorting algorithms in a wide variety of environments. However, it seems like nearly everything that we would sort on a computer are countable / partially ordered. Numbers, characters, strings, even functions are amenable to some meaningful non-comparison sorting method. A

How does Radix Sort work?

ぃ、小莉子 提交于 2019-12-20 08:37:34
问题 I don't know why this is so hard for me to wrap my head around. I've looked through the wiki pages, and pseudo code (as well as actual code) trying to understand how radix sort algorithms work (with respect to buckets). Am I looking into the wrong thing here? Should I be looking into bucket sort maybe? Can someone give me a dumbed down version of how it works? For reference, here is a codeblock that supposedly performs a radix sort: // Sort 'size' number of integers starting at 'input'

error: asm operand type size(1) does not match type/size implied by constraint 'r'. On Duane Merrill's GPU radix sort

安稳与你 提交于 2019-12-20 07:22:40
问题 I have an error when I am trying to compile Merrill's radix sort under win-XP + VS2005. error: asm operand type size(1) does not match type/size implied by constraint 'r'. it occurs in the following code #define B40C_DEFINE_GLOBAL_LOAD(base_type, dest_type, short_type, ptx_type, reg_mod)\ asm("ld.global.cg."#ptx_type" %0, [%1];" : "="#reg_mod(dest) : _B40C_ASM_PTR_(d_ptr + offset));\ ... B40C_DEFINE_GLOBAL_LOAD(char, signed char, char, s8, r) Thanks 回答1: This would appear to be caused by

american flag sort optimization

假装没事ソ 提交于 2019-12-20 03:46:15
问题 I am trying to implement American Bucket Sort. Wiki says "first to count the number of objects that will fall in each bin, and second to place each object in its bucket." In second phase, when placing objects in proper buckets, Do I need to use auxiliary array? Is there a way to do this by swapping array elements in linear time? 回答1: Assuming you mean http://en.wikipedia.org/wiki/American_flag_sort, then as the article points out at the top, you can run this in-place (although then this is

Making CUB blockradixsort on-chip entirely?

◇◆丶佛笑我妖孽 提交于 2019-12-18 07:20:43
问题 I am reading the CUB documentations and examples: #include <cub/cub.cuh> // or equivalently <cub/block/block_radix_sort.cuh> __global__ void ExampleKernel(...) { // Specialize BlockRadixSort for 128 threads owning 4 integer items each typedef cub::BlockRadixSort<int, 128, 4> BlockRadixSort; // Allocate shared memory for BlockRadixSort __shared__ typename BlockRadixSort::TempStorage temp_storage; // Obtain a segment of consecutive items that are blocked across threads int thread_keys[4]; ... /

Making CUB blockradixsort on-chip entirely?

。_饼干妹妹 提交于 2019-12-18 07:20:03
问题 I am reading the CUB documentations and examples: #include <cub/cub.cuh> // or equivalently <cub/block/block_radix_sort.cuh> __global__ void ExampleKernel(...) { // Specialize BlockRadixSort for 128 threads owning 4 integer items each typedef cub::BlockRadixSort<int, 128, 4> BlockRadixSort; // Allocate shared memory for BlockRadixSort __shared__ typename BlockRadixSort::TempStorage temp_storage; // Obtain a segment of consecutive items that are blocked across threads int thread_keys[4]; ... /

Radix Sort Optimization

社会主义新天地 提交于 2019-12-18 05:17:07
问题 I was trying to optimize the Radix Sort code, because I felt there was room for it as traditional codes in books and on web seem a direct copy of one another and also they work very slow as they take an arbitrary number such as 10 for modulo operation. I have optimized the code as far as I could go, maybe I might have missed some optimization techniques. In that case please enlighten me. Motivation for optimization: http://codercorner.com/RadixSortRevisited.htm http://stereopsis.com/radix