Skip to content
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

Merged
merged 12 commits into from Apr 12, 2018

Conversation

kmaehashi
Copy link
Member

@kmaehashi kmaehashi commented Apr 2, 2018

Implements interface to print runtime information. Took over #4298.
Requires cupy/cupy#1067.

TODO: add test. (done)

@kmaehashi kmaehashi added cat:feature Implementation that introduces new interfaces. to-be-backported Pull request that should be backported. st:blocked-by-another-pr State indicating that another ticket is preventing this ticket from being closed/merged. labels Apr 2, 2018
@kmaehashi kmaehashi mentioned this pull request Apr 2, 2018
@kmaehashi kmaehashi changed the title [WIP] Implement interface to print runtime information Implement interface to print runtime information Apr 9, 2018
@kmaehashi
Copy link
Member Author

Added tests.

Output examples

When CuPy is unavailable:

>>> import chainer
>>> chainer.print_runtime_info()
Chainer: 4.0.0rc1
NumPy: 1.14.2
CuPy: Not Available

When CuPy is available:

>>> import chainer
>>> chainer.print_runtime_info()
Chainer: 4.0.0rc1
NumPy: 1.14.2
CuPy:
  CuPy Version          : 4.0.0rc1
  CUDA Root             : /usr/local/cuda
  CUDA Build Version    : 9000
  CUDA Driver Version   : 9000
  CUDA Runtime Version  : 9000
  cuDNN Build Version   : 7100
  cuDNN Version         : 7100
  NCCL Build Version    : 2102

@kmaehashi kmaehashi added this to the v5.0.0a1 milestone Apr 9, 2018
Copy link
Member

@niboshi niboshi left a 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.

if out is None:
out = sys.stdout
out.write(str(get_runtime_info()))
out.flush()
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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.)

Copy link
Member

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.

@niboshi
Copy link
Member

niboshi commented Apr 10, 2018

Please add testing.run_module(__name__, __file__).

@kmaehashi
Copy link
Member Author

Thanks, fixed.

@niboshi niboshi removed the st:blocked-by-another-pr State indicating that another ticket is preventing this ticket from being closed/merged. label Apr 10, 2018
@niboshi
Copy link
Member

niboshi commented Apr 12, 2018

LGTM!

@niboshi niboshi merged commit b538528 into chainer:master Apr 12, 2018
niboshi added a commit to niboshi/chainer that referenced this pull request Apr 12, 2018
Implement interface to print runtime information
@kmaehashi kmaehashi deleted the add-runtime-info branch April 12, 2018 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:feature Implementation that introduces new interfaces. to-be-backported Pull request that should be backported.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants