-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Fluid bytecode c++ executor. #10220
Fluid bytecode c++ executor. #10220
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.
This change seems to add a binary to run a programdesc once. Should this be put in a directory called "tools"?
bool read_from_file(const std::string& file, char** buf, int64_t* buf_len) { | ||
FILE* f = fopen(file.c_str(), "rb"); | ||
if (NULL == f) { | ||
printf("open %s error\n", file.c_str()); |
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.
fprintf(stderr? or LOG(ERROR)?
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.
change to fprintf(stderr
.
Thanks.
|
||
using namespace paddle; // NOLINT | ||
|
||
framework::ProgramDesc* load_desc(const std::string& file) { |
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.
return unique_ptr?
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.
return (new framework::ProgramDesc(proto)); | ||
} | ||
|
||
DEFINE_string(start_up_proto, "", "start up proto file"); |
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.
put at the file top?
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.
Thanks.Done.
std::transform(place_str.begin(), place_str.end(), place_str.begin(), | ||
[](unsigned char ch) { return toupper(ch); }); | ||
|
||
framework::Executor* exe = nullptr; |
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.
unique_ptr>
@@ -0,0 +1,126 @@ | |||
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. |
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.
should this file by call execute_program_desc?
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.
@@ -333,6 +335,12 @@ def run(self, | |||
fetch_var_name=fetch_var_name) | |||
|
|||
self._feed_data(program, feed, feed_var_name, scope) | |||
|
|||
# TODO(gongwb): does a program should be saved in run function? | |||
if len(save_program_to_file) > 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.
I'm not sure we should do the save here...
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 programdesc is modified in run function.And sometimes a user can't get chance to save it.
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.
Maybe run() shouldn't modify the programdesc? Or we should save after run is called?
Agree to put this to |
@@ -277,7 +277,8 @@ def run(self, | |||
fetch_var_name='fetch', | |||
scope=None, | |||
return_numpy=True, | |||
use_program_cache=False): | |||
use_program_cache=False, | |||
save_program_to_file=""): |
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 still don't want to put "save_program_to_file" as a argument to Executor. Saving program should be in a separate API, such as "save_inference_model".
I build debug-version Python and so close this PR. |
Fix #10221