Optimizing Keras to use all available CPU resources

余生长醉 提交于 2019-12-23 15:44:40

问题


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

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:

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.

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.

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.


回答1:


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

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

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



来源:https://stackoverflow.com/questions/39432170/optimizing-keras-to-use-all-available-cpu-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!