jinzishuai / learn2deeplearn

A repository of codes in learning deep learning
GNU General Public License v3.0
13 stars 1 forks source link

Speedup TensorFlow with GPU #31

Closed jinzishuai closed 6 years ago

jinzishuai commented 6 years ago

Examples

Course 4, Week 2 HW

https://github.com/jinzishuai/learn2deeplearn/blob/master/deeplearning.ai/C4.CNN/week2_DeepModelCaseStudy/hw/ResNets/ResidualNetworks.py

It takes about 5 minutes to finish only 1 epochs on Coursera.

image

On Ubuntu-16 Virtualbox VM on PC

image

jinzishuai commented 6 years ago

Mac OS X without GPU

Much faster (at least 3 times) image

jinzishuai commented 6 years ago

Ubuntu laptop without GPU

jinzishuai commented 6 years ago

Windows with GPU but out of memory on the same laptop

image

We have 2GB of GPU Memory

C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi.exe
Sat Nov 18 19:08:12 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 376.51                 Driver Version: 376.51                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro K1100M      WDDM  | 0000:02:00.0     Off |                  N/A |
| N/A   46C    P8    N/A /  N/A |     28MiB /  2048MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

C:\Program Files\NVIDIA Corporation\NVSMI>
jinzishuai commented 6 years ago

EC2 GPU Instance

image http://docs.aws.amazon.com/dlami/latest/devguide/tutorial-conda.html#tutorial-conda-switch-tf

First Run

image

jinzishuai commented 6 years ago

Second EC2 GPU Run

image

It seems that with GPU, the first run takes longer time to initialize while the following runs are much faster.

also notice that there is 11GB of GPU memory.

jinzishuai commented 6 years ago

More information about p2 instances

https://aws.amazon.com/ec2/instance-types/p2/ image

jinzishuai commented 6 years ago

https://aws.amazon.com/ec2/instance-types/#p2

image

Use Cases: Machine learning, high performance databases, computational fluid dynamics, computational finance, seismic analysis, molecular modeling, genomics, rendering, and other server-side GPU compute workloads.

jinzishuai commented 6 years ago

Conclusion

The Linux tf-1.5 build does not support my GPU but the Windows build does.

So I would always run my tensorflow code on Windows.