-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Infer multi-threads API Demo and UT #11247
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
Conversation
|
[Step 1/1] make[2]: *** [paddle/fluid/inference/analysis/test_dfg_graphviz_draw_pass] Error 1 |
| for (int tid = 0; tid < num_threads; ++tid) { | ||
| threads.emplace_back([&, tid]() { | ||
| // 1. clone a predictor which shares the same parameters | ||
| auto predictor = main_predictor->Clone(); |
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.
The clone should be outside the thread:
for (int tid = 0; tid < num_threads; ++tid) {
auto predictor = main_predictor->Clone();
std::thread t([&]{
predictor->xxx
});
}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 am afraid it's better to be inside thread.
| } | ||
| } | ||
|
|
||
| void MainThreads(int num_threads) { |
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.
need a config use_gpu to ensure GPU can also be called with multi-threads.
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.
Sure~
Superjomn
left a comment
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
Uh oh!
There was an error while loading. Please reload this page.