You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm helping a downstream project adapt to NumPy changes, and noticed this:
fromthreadpoolctlimportthreadpool_info, threadpool_limitsimportnumpyasnpforentryinthreadpool_info():
print(entry["num_threads"])
# 2.1.0.dev0 built from source locally on x86_64 Linux prints: 1 # 2.0.0rc1 from PyPI doesn't print anything# 1.26.4 from PyPI prints: 32withthreadpool_limits(2):
forentryinthreadpool_info():
print(entry["num_threads"])
# 2 with NumPy 1.26.4 on PyPI# 2.0.0rc1 from PyPI doesn't print anything# 2.1.0.dev0 built from source locally on x86_64 Linux prints: 1
I think what is happening is that the downstream library is using the latest stable release of threadpoolctl and assuming that threadpool_limits(2) (or similar) will genuinely provide threading control at the level of the provided integer number of threads, which I might naively guess would be reasonable. Is this something still being worked on related to nogil/free-threading business, or some simpler explanation of what is going on here?
Should the advice be not to rely on that integer value of the threadpool limit being hard-enforced moving forward?
The text was updated successfully, but these errors were encountered:
Should the advice be not to rely on that integer value of the threadpool limit being hard-enforced moving forward?
It should be made reliably, that's the whole point of threadpoolctl. And the PR linked above is already approved, so it should be ready before the final numpy 2.0 release.
It looks like this is under control. If it turns out to be necessary, we should add some info that is more reliable to query. In the end this is a practical problem for numpy users, and our official response is "use threadpoolctl for this".
I'm helping a downstream project adapt to NumPy changes, and noticed this:
I think what is happening is that the downstream library is using the latest stable release of
threadpoolctl
and assuming thatthreadpool_limits(2)
(or similar) will genuinely provide threading control at the level of the provided integer number of threads, which I might naively guess would be reasonable. Is this something still being worked on related to nogil/free-threading business, or some simpler explanation of what is going on here?Should the advice be not to rely on that integer value of the threadpool limit being hard-enforced moving forward?
The text was updated successfully, but these errors were encountered: