-
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
Add multi-thread inference example which shares the inference_program and parameters #9302
Add multi-thread inference example which shares the inference_program and parameters #9302
Conversation
a728656
to
d089deb
Compare
d089deb
to
27f553b
Compare
8de6563
to
208fcf5
Compare
@@ -55,6 +56,9 @@ class ProgramDesc { | |||
const std::vector<std::string> GetFeedTargetNames(); | |||
const std::vector<std::string> GetFetchTargetNames(); | |||
|
|||
void SetFeedHolderName(const std::string &feed_holder_name); |
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.
Is feed/fetch holder a new concept? add some comments will be better.
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.
} | ||
|
||
template <typename Place> | ||
void TestMultiThreadInference( |
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.
请问TestMultiThreadInference
为什么没和 TestInference
一样,放在paddle/fluid/inference/tests/test_helper.h
里呢?
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.
多线程作为一种特殊的应用场景,放在一个单独的文件里面,方便索引和引用吧。
TestInference<paddle::platform::CUDAPlace>(dirname, cpu_feeds, cpu_fetchs2); | ||
LOG(INFO) << output2.dims(); | ||
|
||
CheckError<float>(output1, output2); | ||
#endif | ||
} | ||
|
||
TEST(multi_thread_inference, fit_a_line) { |
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.
TEST(inference, fit_a_line)
和 TEST(multi_thread_inference, fit_a_line)
的代码非常类似,前者能否作为后者的一个特例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.
Done.
649e9ed
to
720f619
Compare
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!
Fix #9650