Extracting merge of sorted vector partitions into separate function

This may be useful if a user wants to get the sorted result to host
anyway. In this case, doing manual detail::sort() for all vector
partitions followed by detail::merge() will save two trips over PCI bus.