Squeezenet
测试对象:Squeezenet - 256 - cifar10
测试种类:改变线程1 4 10;添加数据增强选项
1 GPU使用率


GPU占用最高的为10cpu线程情况,最低为线程1的情况。
时间来说,线程1训练最慢,线程4其次,线程4+五增强其次,线程10最快。
总结来说,CPU线程多,数据准备更充分,训练快。
2 GPU内存分配

3 CPU利用率

4 GPU读写操作所占比例


AlexNet
测试对象:Alexnet - ImageNet
测试种类:改变batchsize 64 512 1024

1 GPU使用率

2 GPU内存占用量

3 GPU运行过程中read/write的占比

该指标为:在Sample时间内,GPU读or写的占比。我们会希望值越低越好,越低说明大部分的操作是用在计算。

根据红框的内容,两个值相减基本能得到在AlexNet模型下也就25%左右的操作是放在计算上。
4 CPU使用率

VGG16 - ImageNet
测试对象:Vgg - ImageNet
测试种类:改变batchsize 16 32 64

1 GPU利用率

VGG16这个模型基本利用率跑满了,向下突出的为一个epoch结束,释放显存。(这个里面我设置64的batchsize的case跑5轮,其他是三轮。时间太长)
其实也能够看出来,Batch size越大其实训练速度是越快的。
2 GPU显存分配

显存分配从batch size 64 -> 16,分别由95%下降到48%。其实这里有很有趣的地方:batch size 16的时候,GPU利用率已经是满的了,那我增加batch size,反而会加快训练。说明,核数没有跑满。这里GPU的利用率100%,就是因为这个GPU利用率定义导致的如下图(https://stackoverflow.com/questions/40937894/nvidia-smi-volatile-gpu-utilization-explanation):GPU利用率其实与核数没有关系,只要有一个及以上的核在使用,那就会定义此时GPU在被用。而这个百分比是因为在一个Sample时间内,每次探测都会算一个记录点,只要记录点GPU在使用,分子就++。结合上面的分析,得出结论:GPU在训练过程中并不一定会把核全部使用掉,里面有可进一步优化的空间。


3 GPU运行过程中read/write的占比

这个依旧很高,依旧只有25%的操作是计算。但是这里有个很有趣的发现,vgg16占比75%,而其他只有66%。说明batch size小的话有利于提高计算效率,不用频繁的去取数据。
VGG16 - Cifar10

测试对象:Vgg - Cifar10
测试种类:改变batchsize 64 512 1024 2048
这里同样,64这个case训练了5轮。其他是3轮
1 GPU利用率

训练时间比较短,所以周期变化不明显,当batch比较小的时候GPU使用率较低,之后增大bs到达93%。
2 GPU内存分配

3 GPU运行过程中read/write的占比

VGG16 - Cifar10 与 ImageNet对比

使用了相同的内存分配,即Cifar512 与 Cifar16.
1 GPU利用率
Cifar512利用率要小于ImageNet16

ResNet18 - Cifar10

1 GPU利用率

MobileNet- Cifar10

多个模型- Cifar10 - 64

网友评论