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
Implement interface to print runtime information #4559
Conversation
Added tests. Output examplesWhen CuPy is unavailable:
When CuPy is available:
|
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 except one comment.
chainer/_runtime_info.py
Outdated
if out is None: | ||
out = sys.stdout | ||
out.write(str(get_runtime_info())) | ||
out.flush() |
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.
flush
method may not exist.
It's better to either avoid it or test its existence first.
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.
Are there any known file-like class that does not implement flush
?
I thought it was a requirement for file-like.
https://docs.python.org/2/library/stdtypes.html#file-objects
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.
There's no official specification of file-like objects.
You can define an object with only write
method and call it a file-like.
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.
OK, I fixed to first check existence of the flush method.
(It seems other features (CupyMemoryProfileHook
, ProgressBar
, etc...) also assumes flush
.)
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 see. It's better to fix them as well.
Please add |
Thanks, fixed. |
LGTM! |
Implement interface to print runtime information
Implements interface to print runtime information. Took over #4298.
Requires cupy/cupy#1067.
TODO: add test.(done)