-
Notifications
You must be signed in to change notification settings - Fork 24
Add requirements.txt, missing patch to ASV benchmarks #331
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
Open
vchamarthi
wants to merge
2
commits into
IntelPython:master
Choose a base branch
from
vchamarthi:asv-bench-pr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,6 @@ | |
| "build_cache_size": 2, | ||
| "default_benchmark_timeout": 500, | ||
| "regressions_thresholds": { | ||
| ".*": 0.3 | ||
| ".*": 0.2 | ||
| } | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """MKL patch setup — executed once per ASV worker process at import time. | ||
|
|
||
| Patches NumPy FFT with the Intel MKL FFT implementation. | ||
| Hard-fails with a descriptive RuntimeError if mkl_fft is missing or the | ||
| patch does not take effect, so benchmarks never silently run on stock NumPy. | ||
| """ | ||
|
|
||
| _PATCH_MAP = [ | ||
| ("mkl_fft", "patch_numpy_fft"), | ||
| ] | ||
|
|
||
|
|
||
| def _apply_patches(): | ||
| import importlib | ||
|
|
||
| import numpy as np | ||
|
|
||
| patched = {} | ||
|
|
||
| for mod_name, patch_fn_name in _PATCH_MAP: | ||
| try: | ||
| mod = importlib.import_module(mod_name) | ||
| except ImportError as exc: | ||
| raise RuntimeError( | ||
| f"[mkl-patch] Cannot import {mod_name}: {exc}\n" | ||
| f" Ensure the conda env contains {mod_name} " | ||
| f"from the Intel channel.\n" | ||
| " Required channels: " | ||
| "https://software.repos.intel.com/python/conda" | ||
| ) from exc | ||
|
|
||
| patch_fn = getattr(mod, patch_fn_name, None) | ||
| if patch_fn is None: | ||
| raise RuntimeError( | ||
| f"[mkl-patch] {mod_name} has no {patch_fn_name}(). " | ||
| f"Upgrade {mod_name} to a version that exposes " | ||
| "the stock-numpy patch API." | ||
| ) | ||
|
|
||
| try: | ||
| patch_fn() | ||
| except Exception as exc: | ||
| raise RuntimeError( | ||
| f"[mkl-patch] {mod_name}.{patch_fn_name}() raised: {exc!r}" | ||
| ) from exc | ||
|
|
||
| is_patched_fn = getattr(mod, "is_patched", None) | ||
| if callable(is_patched_fn) and not is_patched_fn(): | ||
| raise RuntimeError( | ||
| f"[mkl-patch] {mod_name}.is_patched() returned False " | ||
| "after patching. NumPy may have been imported before " | ||
| "patching in a conflicting state." | ||
| ) | ||
|
|
||
| patched[mod_name] = mod | ||
|
|
||
| _attr_checks = { | ||
| "mkl_fft": lambda: np.fft.fft.__module__, | ||
| } | ||
| for mod_name in patched: | ||
| try: | ||
| attr = _attr_checks[mod_name]() | ||
| except Exception: | ||
| attr = "unknown" | ||
| print(f"[mkl-patch] {mod_name}: numpy.fft dispatch -> {attr}") | ||
|
|
||
| print("[mkl-patch] ALL OK -- mkl_fft active") | ||
|
vchamarthi marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| psutil | ||
| scipy | ||
|
vchamarthi marked this conversation as resolved.
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.