Parallel Merge Sort
Josh via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 8 10:53:12 PDT 2015
http://pastebin.com/4TyP7Gjj
I feel like there's some sort of optimization that I can do
instead of the nWayUnion at the end I think that's a lot of
processing on a single core for the final step.
I was also trying to use
copy(array[lbound..uperbound].mergeSort, array[lbound..ubound])
instead of:
result ~= array[lbound..ubound].mergeSort
but I'm stuck as to how I can then sort the array now that it
contained runs
example:
after copy
array would be (thread amount = 3) runs
if threads is = 3 and N = 9
array: [33, 67, 92, 12, 16, 67, 43, 46, 49]
I'm having trouble formulating how I would now sort the runs.
-Or if the copy is a lot of overhead for a large amount of
numbers.
Thank you,
Josh
More information about the Digitalmars-d
mailing list