优化Keras以使用所有可用的CPU资源 [英] Optimizing Keras to use all available CPU resources

查看:455
本文介绍了优化Keras以使用所有可用的CPU资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我真的不知道我在这里说什么,所以请多多包涵.

Ok, I don't really know what I'm talking about here so bear with me.

我正在运行带有Theano后端的Keras,以便在MNIST图像上运行基本的神经网络(目前仅设置了一个教程).过去,我一直使用旧的HP笔记本电脑,因为我使用Windows和Ubuntu 16.06进行了双启动设置.我正在尝试更换这台笔记本电脑,以便我可以退役并使用我的新Sony Sony笔记本电脑.我在Ubuntu 16.06和Windows 10上设置了相同的双重启动.这是问题所在:

I am running Keras with Theano backend to run a basic neural net (just a tutorial set up for now) on MNIST images. In the past, I have been using my old HP laptop because I have a dual boot setup with Windows and Ubuntu 16.06. I am trying to replace this laptop so I can retire it and use my new(er) Sony laptop. I set up the same dual boot with Ubuntu 16.06 and Windows 10. Here is the issue:

当我在旧HP(Ubuntu)上运行它时,我得到了明显更好的性能(在时间方面).我同时在两台计算机上运行相同的程序,并且使用Ubuntu系统监视器,发现旧的HP计算机使用所有4个内核,因此使用了100%的可用CPU.较新的Sony仅使用1核,并且CPU上限约为26%.

When I run it on my old HP (Ubuntu), I get significantly better performance (in terms of time). I ran the same program on both machines at the same time and, using the Ubuntu system monitor, found that the old HP machine uses all 4 cores and, thus, 100% of available CPU. The newer Sony only uses 1 core and caps out at ~26% CPU.

如果可能的话,我宁愿避免不得不手动处理多线程.我尝试使用openmp无济于事,而HP仍然使用所有4个核心,而没有使用它.

I would prefer to avoid having to deal with manually multi-threading if at all possible. I have tried using openmp to no avail, and the HP uses all 4 cores without it anyway.

我非常确定我在两台计算机上都遵循相同的设置,但是自从前一阵子这样做以来,我可能已经在HP上安装了额外的软件包,并且可能忘记了我安装的内容.我也尝试过使用Python(2.7)和python3,它们都具有相同的设置.

I'm pretty sure that I followed the same setup on both machines but I may have installed extra packages on the HP since I did that a while ago and may have forgotten what I installed. I have also tried using Python (2.7) and python3, each with the same setup.

我不知道我在寻找什么,但是任何想法或建议都将不胜感激.很高兴提供更多信息,因为我不确定在这种情况下有什么意义.并先谢谢您.

I don't know what I'm looking for, but any ideas or input would be greatly appreciated. I'm happy to provide any more information as I'm not sure what is relevant in this case. And thank you in advance.

推荐答案

好吧,我当然是在发布问题后才知道的.对不起,如果我浪费任何人的时间.

Ok of course I figured it out right after I posted the question. Sorry if I wasted anyone's time.

我只是使用apt-get而不是pip重新安装了所有内容,并且一切正常.不知道为什么,也许我第一次错过了一些东西.无论如何

I just reinstalled everything using apt-get instead of pip and that worked. Not sure why, maybe I missed something the first time. Anyway,

sudo apt-get install python-numpy python-scipy python-dev python-nose g++ libblas-dev git

修复了它.不知道哪个包.我想我只是第一次使用sudo apt-get install theano.

fixed it. Not sure which package. I think I just used sudo apt-get install theano the the first time.

这篇关于优化Keras以使用所有可用的CPU资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆