by p1esk · 9y ago · 0 comments
A well written C code should run about 20-50 times slower than a well written CUDA code on the latest GPUs, and that's for a single CPU core. This was true with my hand-written implementations, as well as when using libraries (Numpy vs CuDNN).
Which is still pretty major, but nowhere near the wild claims that used to be common in academic papers. It's outdated, but [1] is still pretty good reading.
[1] http://sbel.wisc.edu/Courses/ME964/Literature/LeeDebunkGPU20...
Two conv layers (6 and 12 feature maps, 5x5 filters), one fully connected layer (120 neurons), activation=Tanh, pooltype: average (excluding padding), cost=Negative Log Likelihood.
Learning rate=0.20, minibatch size=100, dropout = 0.0, L2 lambda=0.0, momentum=0.0, initialization: normal
Training for 10 epochs:
CPU: 172 sec, GPU: 14 sec.
When decreasing batch size to 20 images, the numbers are: CPU: 318 sec, GPU: 38 sec.
So yeah, the CPU code your professors wrote was really crappy.
I'd be betting that someone with low level optimization expertise (comparable to what you appear to have done with the GPU) could get at least another 10x out of the CPU version. You are completely right that GPU's have the potential for great increases over the current normal, but there's also (typically) room for large improvement on modern CPU's as well.
Lets see it then. Most cpu programs have enormous amounts of fat left in them from cache misses and poor or no use of SIMD.