1

I'm developing a computational fluid dynamics (CFD) code using CUDA. As I am doing some speedup tests on a single Tesla K40 GPU (comparing to Intel Xeon E5 v2 CPU) for different problem sizes, the GPU shows higher speedup by increasing the problem size. For instance, I get a speedup by a factor of ~1.5x for ~1 million elements while it improves to ~11x for 10 million elements.

I don't have any idea that theoretically what causes the higher performance for larger problems? Actually, this is also the case which I have seen in many scientific (especially fluid mechanics) applications running on GPU. (I was wondering if something such as kernel overhead, latency, etc. are affected?)

Thanks for any answer or comment!

PS: By speedup, I mean the ratio of the execution time of GPU code to the execution time of CPU version. Actually, I increase the problem size in both versions (and of course apply same problem size for both in each comparison test) and recalculate the speedup for the corresponding problem size.

3
  • 1
    Speedup relative to what?
    – Drop
    Commented Jul 7, 2016 at 10:23
  • As I have mentioned; the speedup comparing to CPU.
    – Siamak
    Commented Jul 7, 2016 at 10:26
  • 3
    You should provide more details. How is the speed per element? Do you get the relative performance increase because the GPU becomes faster per element (likely due to hiding latencies) or because the CPU becomes slower (maybe cache size).
    – havogt
    Commented Jul 7, 2016 at 11:52

1 Answer 1

1

The reason is running a GPU kernel usually comes with an overhead of constant time (may not be constant but we can consider the constant case), such as kernel launching overhead, PCIe data transfer, etc.

Suppose this constant GPU overhead costs t second, GPU speed is g million elements per second, CPU speed is c million elements per second. Both speeds are constant (may not be true as indicated by @havogt). There's no overhead on CPU. You have the equations

(t + 1 / g) * 1.5 = 1 / c
(t + 10 / g) * 11 = 10 / c

You could then get

g / c = 37.125
t = 0.640 / c

which means

  1. for large enough data element (>100M), GPU speed is close to 37.125x of CPU speed;
  2. the constant overhead time equals to the time of processing 0.640M elements on CPU.
1
  • Seems reasonable. Thanks!
    – Siamak
    Commented Jul 7, 2016 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.