-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
ENH: Use threadpoolctl
in show_runtime
(a new function)
#21468
ENH: Use threadpoolctl
in show_runtime
(a new function)
#21468
Conversation
Thanks for working on this @ganesh-k13! Note that gh-14492 is also very much related. I think we'd like |
threadpoolctl
threadpoolctl
in show_config
@rgommers Out of curiosity, can the build time information be obtained from meson? |
There's always a way:) It has sane configure-time output, which may make sense to store in full:
It contains |
I would be fine with fixing |
Hey @mattip, I see two enhancements based on various discussions,
Which do you think is apt for this PR, I can work on that. |
numpy/distutils/misc_util.py
Outdated
directories, include directories, etc.) in the system on which | ||
NumPy was built. | ||
Print information about various resources in the system | ||
on which NumPy was built. |
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 information presented no longer is the build-time information.
on which NumPy was built. | |
including available intrinsic support and BLAS/LAPACK library | |
in use |
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 via 77198c9
numpy/distutils/misc_util.py
Outdated
'threading_layer': 'pthreads', | ||
'user_api': 'blas', | ||
'version': '0.3.20'}] | ||
|
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.
Where is the example of the SIMD information?
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.
Didn't want to clutter the docstring, but yeah makes sense to add it as it'll always be displayed
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 via 77198c9
I think this change would be more appropriate as a new |
Oh yeah that's a good point, we can make |
02043a2
to
49ed995
Compare
threadpoolctl
in show_config
threadpoolctl
in show_runtime
(a new function)
49ed995
to
77198c9
Compare
I see you updated the PR description to show the new function output. It looks good to me. This is failing since it adds a new function to the namespace. It should probably hit the mailing list in parallel with fixing the test to allow the addition. When you post, please add the output. |
Thanks Matti, fixing the tests now. I've posted to the mailing list today: https://mail.python.org/archives/list/numpy-discussion@python.org/thread/A3Q2WXBRFK3MKHOSEX3RUVRJRKCFGWKX/ |
I don't think this needs to be part of the generated |
99e25bc
to
4da4044
Compare
Thanks for the review Matti! I have moved it to lib/utils.py and also added a release note. |
4da4044
to
73e2245
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. Just some documentation tweaks.
A new function ``np.show_runtime`` has been added to display the runtime | ||
information of the machine in addition to ``np.show_config`` which displays | ||
the build-related information. | ||
This function returns a list of dictionaries as follows:: |
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 think everything from here down should be removed. show_runtime
should be added to the documentation here
show_config |
numpy.show_runtime
, and numpy.show_config
(with single back-ticks), and they would be turned into links.
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.
numpy/lib/utils.py
Outdated
in use | ||
See Also |
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.
Blank line needed
in use | |
See Also | |
in use | |
See Also |
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.
Added in fe63699
numpy/lib/utils.py
Outdated
show_config : Show libraries in the system on which | ||
NumPy was built. | ||
Notes |
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.
Blank line, reformat
show_config : Show libraries in the system on which | |
NumPy was built. | |
Notes | |
show_config : Show libraries in the system on which NumPy was built. | |
Notes |
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.
Added in fe63699
numpy/lib/utils.py
Outdated
`__cpu_baseline__` and `__cpu_dispatch__` | ||
Examples |
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.
Blank line needed
`__cpu_baseline__` and `__cpu_dispatch__` | |
Examples | |
`__cpu_baseline__` and `__cpu_dispatch__` | |
Examples |
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.
Added in fe63699
numpy/lib/utils.py
Outdated
2. In case `threadpoolctl` is not installed, a message is | ||
displayed with help on how to install 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.
Not sure this is really needed
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.
Removed in fe63699
1. Information is derived with the help of `threadpoolctl` library. 2. In case `threadpoolctl` is not installed, a message is displayed with help on how to install it. 3. SIMD related information is derived from `__cpu_features__`, `__cpu_baseline__` and `__cpu_dispatch__`
73e2245
to
c806a0a
Compare
New function `np.show_runtime` | ||
------------------------------ | ||
|
||
A new function `np.show_runtime` has been added to display the runtime | ||
information of the machine in addition to `np.show_config` which displays | ||
the build-related information. |
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.
Double back-ticks for np.*
to format as code. If you want a link, you need to use numpy.*
with single back-ticks. We tried telling sphinx that np
is an alias for numpy
, but couldn't get the links to work.
New function `np.show_runtime` | |
------------------------------ | |
A new function `np.show_runtime` has been added to display the runtime | |
information of the machine in addition to `np.show_config` which displays | |
the build-related information. | |
New function ``np.show_runtime`` | |
-------------------------------- | |
A new function `numpy.show_runtime` has been added to display the runtime | |
information of the machine in addition to `numpy.show_config` which displays | |
the build-related information. |
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 for the info! Learning Sphinx on the way :). Fixed via 3d2fe4e
numpy/lib/utils.py
Outdated
2. SIMD related information is derived from `__cpu_features__`, | ||
`__cpu_baseline__` and `__cpu_dispatch__` |
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.
Double back-ticks to format as code. Single back-ticks for links. I don't think we have links for those attributes.
2. SIMD related information is derived from `__cpu_features__`, | |
`__cpu_baseline__` and `__cpu_dispatch__` | |
2. SIMD related information is derived from ``__cpu_features__``, | |
``__cpu_baseline__`` and ``__cpu_dispatch__`` |
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.
Fixed via 3d2fe4e
numpy/lib/utils.py
Outdated
|
||
Notes | ||
----- | ||
1. Information is derived with the help of `threadpoolctl` |
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.
If you want this to be a link, you have to provide the url. Otherwise use double back-ticks.
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 yeah it renders now: https://output.circle-artifacts.com/output/job/79c7902f-6c77-4b35-8f43-d55ceaee6ff5/artifacts/0/doc/build/html/reference/generated/numpy.show_runtime.html, all though it will give flake8 errors, I'm not sure why adding new line like this did not work:
Lines 1846 to 1847 in 17d730a
.. [1] NumPy User Guide, section `I/O with NumPy | |
<https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_. |
b5d1e93
to
ab63e3f
Compare
ab63e3f
to
c8ed74e
Compare
c8ed74e
to
3d2fe4e
Compare
Thanks @ganesh-k13 this will be helpful going forward |
ENH: Use
threadpoolctl
threadpoolctl
atnp.show_config
np.show_runtime
Sample output
or
resolves: #21340
related: #20939