Repository navigation
Report OpenMP blocktime in milliseconds - #302
Open
Aschenbath wants to merge 1 commit into
Open
Aschenbath wants to merge 1 commit into
Aschenbath wants to merge 1 commit into
Conversation
ogrisel
reviewed
Nov 10, 2026
ogrisel
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR. Here is a first pass of feedback.
| from ``kmp_get_blocktime`` (LLVM/Intel OpenMP), or None when unavailable. | ||
| Its units are milliseconds by default, or microseconds when configured | ||
| through ``KMP_BLOCKTIME`` on runtimes supporting that unit. This value is | ||
| queried on every call, including when reusing a controller. |
Contributor
There was a problem hiding this comment.
I would rather always report "ms" to avoid any ambiguity on how to correctly leverage this value. Is it possible to programmatically inspect the runtime and do the conversion in get_blocktime itself so that it always returns ms values?
| 'user_api': 'blas', | ||
| 'version': '2019.0.4'}, | ||
| {'filepath': '/home/ogrisel/miniconda3/envs/tmp/lib/libiomp5.so', | ||
| {'blocktime': 200, |
Contributor
There was a problem hiding this comment.
We could even rename 'blocktime' to 'blocktime_ms' if we ensure that we always report this value in miliseconds.
Aschenbath
force-pushed
the
feat/openmp-blocktime-270
branch
from
November 14, 2026 09:59
6a2e9fd to
3e86126
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose
blocktime_msin OpenMP information fromthreadpool_info(), controllerinfo(), and the CLI. LLVM/Intel OpenMP values are read fromkmp_get_blocktimeon every query and converted to milliseconds, preserving fractional milliseconds. Runtimes without that symbol, including GNU OpenMP, reportNone(nullin JSON).The dynamic property and
OpenMPController.get_blocktime()reflect the calling thread's current value afterkmp_set_blocktime, including when a controller is reused. The unit is cached per loaded runtime so later environment changes do not change the conversion.Unit-detection limitation: the common LLVM/Intel kmp API does not export a unit getter. Conversion therefore uses a valid
KMP_BLOCKTIMEstartup setting, which must remain available until the runtime is first inspected. Microsecond settings require a runtime that supports them. Changing units throughkmp_set_defaultsis unsupported. These conditions are documented in the README and API docstrings; this implementation does not provide unconditional native unit introspection.Validation on this revision:
OMP_DISPLAY_ENV=VERBOSEandKMP_SETTINGS=1, parse the effective runtime setting, and compare it withthreadpool_info(). Cases cover the default,37,37ms,35001us, and35 us, then change the environment and callkmp_set_blocktimeto check cached units with a fresh value. The two microsecond cases failed before conversion on Intel OpenMP.test_get_original_num_threadswarning expectations with this NumPy/SciPy setup, and both also fail against unchanged master13b1a129901f353ee4820a3fb7e9a6f7d5fcf4f4in the same environment.PYTHON_CPU_COUNT=4. The initial unrestricted run reached 82 passed and 35 skipped but timed out in the existing 10-second controller concurrency stress test, which creates four threads per reported CPU. No Linux baseline run is claimed.git diff --checkpassed.macOS and hosted CI results are not claimed here. AI assistance was used for investigation, implementation, testing, and this description.
Closes #270.