-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Default use one thread in fluid #7208
Default use one thread in fluid #7208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
'speed will not be optimized if you use data parallel. It will ' | ||
'fail if this PaddlePaddle binary is compiled with OpenBlas since' | ||
' OpenBlas does not support multi-threads.'.format(num_threads), | ||
file=sys.stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段注释没太看明白。openblas的时候可以用OPENBLAS_NUM_THREADS
来设置,不知道和这个PR有没有关系。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个PR非常简单,就是要把OMP_NUM_THREADS默认设置成1。因为确实在数据并行下,这个环境变量设置成其他的值并不合适。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当cpu核数大于trainer_count时,如果设成1,会导致cpu核数没用满。
OMP_NUM_THREADS = cpu核数/trainer_count
Paddle/python/paddle/v2/__init__.py
Lines 112 to 115 in 7508d52
threads = num_processors / trainer_count | |
threads = '1' if threads < 1 else str(threads) | |
set_env("OMP_NUM_THREADS", threads) | |
set_env("MKL_NUM_THREADS", threads) |
Could you add an issue to describe the problem? |
Two concern I should point out :
|
I see. Change |
No description provided.