Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos
MIT License
9.27k stars 4.19k forks source link

GPU versus CPU #63

Closed roestigraben closed 6 years ago

roestigraben commented 6 years ago

Hello first many thanks for your tremendous tutorials

I have seen a train time in tutorial #3 for 10000 step which was 26s

My time was 406s on a CPU based MAC, hence about 15x faster.

Can I ask you what type of GPU configuration you were using (GTX 1080TI or ....)? Is the factor 15X for acceleration about realistic or can it be much higher? of course, the factor depends heavily on the configs. But just to have another data point.

Thanks a lot Peter

Hvass-Labs commented 6 years ago

I'm glad you liked the tutorials!

It has been almost 2 years since I did those early tutorials so I can't remember the details.

But I think the first 15 tutorials were made on a Quad Core 2 GHz laptop PC without a GPU (it had one, but it was too old and slow for TensorFlow). From tutorial 16 onwards I used a new gaming laptop with a Quad Core 2.6 GHz CPU and a GTX 1070 GPU.

It is hard to say in general what kind of speed-up you will see with a GPU because it depends on many factors. You should also look at the system-usage and try and adjust the batch-size to take full advantage of the CPU or GPU, while staying within memory limits. It takes a bit of tweaking.

You can try and run some of the early tutorials on Google Colab to get an idea of the GPU speedup you may get. My GTX 1070 is about twice as fast as the Colab GPU's.

roestigraben commented 6 years ago

Thanks lot for the details, really appreciated!

BTW, I tried to run a few things on Colab, but the GPU stuff is not really reliable. It's a pitty for Google with those enormous resources to do something "less than 100%". But for small tests it is definitely a great site. I am using the cloud to run the GPU stuff before I will invest maybe in a Linux machine (>>1000$)