Where GPU Offload Stops Paying Off
A 90-configuration sorting benchmark across CPU, OpenMP, and CUDA
Merge sort and quick sort measured across sequential CPU, OpenMP, and CUDA, over sorted, random, and reverse-sorted inputs at 2, 4, and 8 million elements, on both Windows and macOS. The GPU lost every single run. That negative result is the useful part, because it marks the boundary where transfer cost and irregular memory access beat raw thread count.
Results
01The question
The AES key search had CUDA winning by 32x. Sorting is the counter-case on the same hardware with a different workload shape. This benchmark sweeps two algorithms, three processor targets, three data distributions, three input sizes, and two operating systems to find where the offload stops being worth it.
02Findings
Parallel CPU won everywhere, beating sequential by 2 to 5 times depending on data shape and platform. The GPU lost every configuration. At 8 million elements the host-to-device transfer plus the irregular access pattern of comparison sorting cost more than the parallelism gave back. macOS with OpenMP was unusually efficient, especially on quick sort over already-sorted input.
Put next to the key-search result, this is the other half of the lesson. GPUs pay off on arithmetic-heavy work with predictable memory access. Sorting has neither property, and adding threads does not fix that.