-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keras use only single thread #1245
Comments
Try switching the backend to Tensorflow |
This enables multithreading in theano: |
@dandxy89 I switched backend to Tensoflow by modifying ~/.keras/keras.json, but it didn't work, thank for your reply anyway, any other idea? |
@Sebubu I add "import theano theano.config.openmp = True" in the keras example "mnist_mlp.py", but it didn't work, thanks anyway. Any other idea? |
@Jallet do any of the examples work for you, after you had switched the backend to "Tensorflow"? |
@dandxy89 Yes, the example works, although still with one thread, I added "{"epsilon": 1e-07, "floatx": "float32", "backend": "tensorflow"}" in ~/.keras/keras.json according to the keras document. |
@dandxy89 By the way, when I run "OMP_NUM_THREADS=2 python theano/misc/check_blas.py -q", the cpu usage of python is still at most 100%, never more than 100, and found only one core is being in use by command "htop", does this mean there is something wrong with my blas or openmp? |
if check_blas.py only use one cores, it mean your BLAS is an single core On Fri, Dec 11, 2015 at 8:52 AM, Liang Jiang notifications@github.com
|
Try OpenBlas. |
import theano then after that write OMP_NUM_THREADS=4 python script_name.py and u re good to go |
I have installed keras on a redhat 6 server, it is really a attractive framework cause it is really easy to build a deep neural network. However, I found my keras use only single thread(or single core). I ran examples given in the source code package, such as "mnist_mlp.py", and used "top" command, found the usage of CPU is 100%, never more than CPU, I have 6 cores, each with four threads, no GPU, so hope keras can make efficient use of all cores, however, it use only one thread.
I don't know whether this is caused by my theano or blas.
Below is some information about my keras:
System: redhat 6
Theano: 0.7.0
numpy: 1.10.1
scipy: 0.16.1
BLAS: atlas 3.8.4-1.el6
keras: 0.2.0
Does anyone know how to fix this? I will appreciate any suggestion. Thanks very much.
ps: I can not make keras run with multithreads on Ubuntu 15.10 either.
The text was updated successfully, but these errors were encountered: