首页 » 信息技术 »

神经网络训练在Linux虚拟机的速度快过Windows

2019年1月16日 / 86次阅读

  • 打开支付宝,搜索“ 529018372 ”,领取专属红包!每日支付每日领。

无意中发现了这一现象,同样的一个测试不同浮点数类型对神经网络训练效率的影响的测试用例,在外层的Windows系统运行速度反而慢于内部的Linux虚拟机(CentOS7)。

以下数据来自Linux虚拟机:

>> import tools
>>> tools.float_performance()
==> float type : float64
Dataset is loaded...train 60000 and test 10000
Epoch 1:4735/10000,Cost(on train):2.045113558076133,round time(s):16.78
Epoch 2:6835/10000,Cost(on train):1.3440208946202985,round time(s):16.92
Epoch 3:7979/10000,Cost(on train):0.8994160143859858,round time(s):19.17
check weight : float64
check bias : float64
check data : float64
==> float type : float32
Dataset is loaded...train 60000 and test 10000
Epoch 1:4086/10000,Cost(on train):2.013053024162849,round time(s):14.91
Epoch 2:6956/10000,Cost(on train):1.2507166862820585,round time(s):15.39
Epoch 3:8024/10000,Cost(on train):0.8596655107242366,round time(s):13.69
check weight : float32
check bias : float32
check data : float32
==> float type : dataset in float16, nn in float32
Dataset is loaded...train 60000 and test 10000
Epoch 1:4553/10000,Cost(on train):2.0350805271883807,round time(s):15.79
Epoch 2:7021/10000,Cost(on train):1.266741799214979,round time(s):15.24
Epoch 3:8112/10000,Cost(on train):0.8470830519178262,round time(s):16.28
check weight : float32
check bias : float32
check data : float16
==> float type : float16
Dataset is loaded...train 60000 and test 10000
Epoch 1:5418/10000,Cost(on train):2.020624169921875,round time(s):138.88
Epoch 2:7058/10000,Cost(on train):1.2629052408854167,round time(s):139.84
Epoch 3:8086/10000,Cost(on train):0.9054074086507161,round time(s):141.48
check weight : float16
check bias : float16
check data : float16

以下数据来自外层的Windwos系统:

>> import tools
>>> tools.float_performance()
==> float type : float64
Dataset is loaded...train 60000 and test 10000
Epoch 1:4131/10000,Cost(on train):1.976069012858489,round time(s):27.29
Epoch 2:6981/10000,Cost(on train):1.2734770169398337,round time(s):27.15
Epoch 3:8059/10000,Cost(on train):0.863751833232319,round time(s):26.75
check weight : float64
check bias : float64
check data : float64
==> float type : float32
Dataset is loaded...train 60000 and test 10000
Epoch 1:5542/10000,Cost(on train):1.9846122093061607,round time(s):20.16
Epoch 2:7300/10000,Cost(on train):1.2205352244853973,round time(s):20.58
Epoch 3:8176/10000,Cost(on train):0.8342689389915516,round time(s):20.24
check weight : float32
check bias : float32
check data : float32
==> float type : dataset in float16, nn in float32
Dataset is loaded...train 60000 and test 10000
Epoch 1:4480/10000,Cost(on train):2.0938571048120656,round time(s):22.39
Epoch 2:6940/10000,Cost(on train):1.3261136438975731,round time(s):22.14
Epoch 3:8118/10000,Cost(on train):0.8644946610357612,round time(s):22.46
check weight : float32
check bias : float32
check data : float16
==> float type : float16
Dataset is loaded...train 60000 and test 10000
Epoch 1:3810/10000,Cost(on train):2.0293811360677085,round time(s):133.39
Epoch 2:7130/10000,Cost(on train):1.3160956583658854,round time(s):133.8
Epoch 3:8092/10000,Cost(on train):0.9138703043619791,round time(s):135.69
check weight : float16
check bias : float16
check data : float16

两组数据对比可以发现:

(1)在Linux虚拟机中,全float64/32,以及数据float16,神经网络float32,这几组数据都是领先的;

(2)只有全float16这一组数据,windowns系统略微领先,而全float16整体慢到不可能去使用;

(3)使用数据float16,神经网络float32这个组合,是一个即节约内存,由保证了效率的好方法!

本文链接:http://www.maixj.net/ict/nn-linux-windows-19925

相关文章

留言区

《神经网络训练在Linux虚拟机的速度快过Windows》有1条留言

电子邮件地址不会被公开。 必填项已用*标注

  • 麦新杰

    补充一点此测试的环境:(1)python实现的mlp模型,纯numpy方式;(2)Win7里面通过VMware装CentOS7. [回复]


前一篇:
后一篇:
推一篇:可靠正规,长期稳定,网络兼职项目!!

栏目精选

云上小悟,麦新杰的独立博客

Ctrl+D 收藏本页

栏目


©Copyright 麦新杰 Since 2014 云上小悟独立博客版权所有 备案号:苏ICP备14045477号-1。云上小悟网站部分内容来源于网络,转载目的是为了整合信息,收藏学习,服务大家,有些转载内容也难以判断是否有侵权问题,如果侵犯了您的权益,请及时联系站长,我会立即删除。

网站二维码
go to top