Merging sorted lists

Hi all.

I have a question.

Is it possible to merge sorted lists like this:

list1 = [1, 2, 3, 4, 5, 6]
list2 = [0.1, 0.2, 0.6, 1.3, 1.7, 3.3]
list3 = [3, 6, 9, 12]

to a sorted list like this:

merged = [0.1, 0.2, 0.6, 1, 1.3, 1.7, 2, 3, 3, 3.3, 4, 5, 6, 6, 9, 12]

but in parallel in a kernel?

Yes, this is possible using a parallel merge sort, although it’s tricky. See the “Parallel Prefix Sum (Scan) with CUDA” chapter in GPU Gems 3.

Ok thank you very much. I’m already using the CUDPP (lovely kernel btw) I will look into it.

This is a shameless plug, but it might also help you. We wrote a paper that deals with mergesort which is available here:

Because I’m not the proud owner of the GPU Gems 3 book but only the Gems 2, is it possible to get only this chapter somewhere about the merging or sorting? Because giving the src files from CUDPP a good look I don’t get it. there is the possibility to merge a list with the CUDPP but thats only by 1 input?

Do i only need to use the sort and merge the 3 list by hand first?

I am the proud owner of the GEMS 3 book (or my employer) but you do not need it, as it is published :)…an/doc/scan.pdf

Hmm… I looked for it but i could not find anything about it… But thank you so much just what i needed.

(Mijn dank is groot ;-))

No prob, I knew I saw it before. And I just finished a modified version myself and I know you need the book :D