-
Notifications
You must be signed in to change notification settings - Fork 7.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
fix omp flag #871
fix omp flag #871
Conversation
@wojtuss Please help review, Thanks |
@luotao1 Can you help review this? |
Solve issue #429 |
deploy/cpp_infer/src/main.cpp
Outdated
#ifdef USE_MKL | ||
#pragma omp parallel | ||
for (auto i = 0; i < 10; i++) { | ||
assert(config.cpu_math_library_num_threads == omp_get_num_threads()); | ||
} | ||
#endif | ||
|
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.
What is the purpose of that code?
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.
I think it is better to keep this asset. Because before, MKL was not linked properly, but it does not report any error. Developers and users don't know if it is linked properly. In the code where MKL is used, it is only running on 1 thread, omp_get_num_threads()=1, even config.cpu_math_library_num_threads is set to 8.
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.
I have doubts about whether this check should be an assert here. In my opinion a user should be informed with a warning rather than prevented from running Paddle when the number of threads is not appropriate. It would be good to have this assert in a test, not in this file.
@luotao1 , what do you think about it?
Other than that LGTM.
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.
I agree with @wojtuss
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.
Done. How is now?
@OliverLPH Please help test it! |
1b02139
to
2a7b74d
Compare
@lidanqing-intel mkldnn 0 mkldnn 0
|
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.
LGTM
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.
LGTM
machine:Linux i9
Compile option: WITH_MKL ON
mkldnn 0
cpu_math_library_num_threads 1
花费了17.8732秒
mkldnn 0
cpu_math_library_num_threads 8
花费了14.1399秒
Windiws machine Please help verify on i7 performance @OliverLPH