-
Notifications
You must be signed in to change notification settings - Fork 38
Add AGENTS.md documentation structure #151
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # AGENTS.md — .github/ | ||
|
|
||
| CI/CD workflows, automation, security scanning, and package distribution. | ||
|
|
||
| ## Workflows | ||
| - **conda-package.yml** — main build/test pipeline (Linux/Windows/macOS, Python 3.10-3.14) | ||
| - **build-with-clang.yml** — Clang compiler compatibility validation | ||
| - **pre-commit.yml** — code quality checks (flake8, etc.) | ||
| - **openssf-scorecard.yml** — security posture scanning | ||
|
|
||
| ## CI/CD policy | ||
| - Keep build matrix (Python versions, platforms) in workflow files only | ||
| - Required checks: conda build + test on all supported Python versions | ||
| - Artifact naming: `$PACKAGE_NAME $OS Python $VERSION` | ||
| - Channels: `conda-forge`, `conda-forge/label/python_rc`, Intel channel | ||
|
|
||
| ## Security | ||
| - OpenSSF Scorecard runs automatically | ||
| - CODEOWNERS enforces review policy | ||
| - Dependabot monitors dependencies (`.github/dependabot.yml`) | ||
|
|
||
| ## Platform specifics | ||
| - **Linux:** RTLD_GLOBAL handling for MKL library loading | ||
| - **Windows:** DLL search path configuration | ||
| - **macOS:** dylib loading and rpath setup | ||
|
|
||
| ## Notes | ||
| - Workflow/job renames are breaking for downstream tooling | ||
| - Cache key includes `meta.yaml` hash for conda packages | ||
| - Python 3.14 uses `conda-forge/label/python_rc` for pre-release support | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,87 @@ | ||||||
| # AGENTS.md | ||||||
|
|
||||||
| Entry point for agent context in this repo. | ||||||
|
|
||||||
| ## What this repository is | ||||||
| `mkl-service` provides Python API for runtime control of Intel® OneMKL (Math Kernel Library). It exposes support functions for: | ||||||
| - Threading control (set/get number of threads, domain-specific threading) | ||||||
| - Version information (MKL version, build info) | ||||||
| - Memory management (peak memory usage, memory statistics) | ||||||
| - Conditional Numerical Reproducibility (CNR) | ||||||
| - Timing functions (get CPU/wall clock time) | ||||||
| - Miscellaneous utilities (MKL_VERBOSE control, etc.) | ||||||
|
|
||||||
| Originally part of Intel® Distribution for Python*, now standalone package available via conda-forge and Intel channels. | ||||||
|
|
||||||
| ## Key components | ||||||
| - **Python interface:** `mkl/__init__.py` — public API surface | ||||||
| - **Cython wrapper:** `mkl/_mkl_service.pyx` — wraps MKL support functions | ||||||
| - **C init module:** `mkl/_mklinitmodule.c` — MKL library initialization | ||||||
| - **Helper:** `mkl/_init_helper.py` — loading and RTLD_GLOBAL handling | ||||||
| - **Build system:** setuptools + Cython | ||||||
|
|
||||||
| ## Build dependencies | ||||||
| **Required:** | ||||||
| - Intel® OneMKL | ||||||
| - Cython | ||||||
| - Python 3.10+ | ||||||
|
|
||||||
| **Conda environment:** | ||||||
| ```bash | ||||||
| conda install -c conda-forge mkl-devel cython | ||||||
| python setup.py install | ||||||
| ``` | ||||||
|
|
||||||
| ## CI/CD | ||||||
| - **Platforms:** Linux, Windows, macOS | ||||||
|
||||||
| - **Platforms:** Linux, Windows, macOS | |
| - **Platforms:** Linux, Windows |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
| # AGENTS.md — conda-recipe/ | ||||||
|
|
||||||
| Conda package build recipe for conda-forge and Intel channel distribution. | ||||||
|
|
||||||
| ## Files | ||||||
| - **meta.yaml** — package metadata, dependencies, build requirements | ||||||
| - **build.sh** — Linux/macOS build script | ||||||
| - **bld.bat** — Windows build script | ||||||
| - **conda_build_config.yaml** — build matrix (Python versions, platforms) | ||||||
|
|
||||||
|
Comment on lines
+8
to
+10
|
||||||
| ## Build configuration | ||||||
| - **Channels:** `conda-forge`, `conda-forge/label/python_rc`, Intel channel | ||||||
| - **Python versions:** 3.10, 3.11, 3.12, 3.13, 3.14 | ||||||
| - **Compilers:** system default (GCC/Clang/MSVC) | ||||||
|
||||||
| - **Compilers:** system default (GCC/Clang/MSVC) | |
| - **Compilers:** pinned via `conda_build_config.yaml` (GCC, Clang, MSVC toolchains) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # AGENTS.md — examples/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Usage examples for mkl-service runtime control API. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **example.py** — basic usage: threading control, version info, timing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Examples cover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Setting global thread count with `mkl.set_num_threads()` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Domain-specific threading (FFT, BLAS, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Querying MKL version and build info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Memory usage statistics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Timing functions for benchmarking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+14
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **example.py** — basic usage: threading control, version info, timing | |
| ## Examples cover | |
| - Setting global thread count with `mkl.set_num_threads()` | |
| - Domain-specific threading (FFT, BLAS, etc.) | |
| - Querying MKL version and build info | |
| - Memory usage statistics | |
| - Timing functions for benchmarking | |
| - **example.py** — basic usage: version info, instruction control, and timing | |
| ## Examples cover | |
| - Querying MKL version and build info | |
| - Controlling instruction dispatch with `enable_instructions()` | |
| - Using `dsecnd()` for simple timing and benchmarking |
Copilot
AI
Feb 20, 2026
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.
These bullets list threading control (global + domain) and memory-usage statistics, but examples/example.py currently doesn’t call set_num_threads, domain_set_num_threads, peak_mem_usage, or mem_stat. Please align the list with the example, or extend the example to cover the APIs mentioned here.
| - **example.py** — basic usage: threading control, version info, timing | |
| ## Examples cover | |
| - Setting global thread count with `mkl.set_num_threads()` | |
| - Domain-specific threading (FFT, BLAS, etc.) | |
| - Querying MKL version and build info | |
| - Memory usage statistics | |
| - Timing functions for benchmarking | |
| - **example.py** — basic usage: version info and timing | |
| ## Examples cover | |
| - Querying MKL version and build info | |
| - Basic mkl-service runtime usage | |
| - Timing functions for benchmarking |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||
| # AGENTS.md — mkl/ | ||||||
|
|
||||||
| Core Python/Cython implementation: MKL support function wrappers and runtime control. | ||||||
|
|
||||||
| ## Structure | ||||||
| - `__init__.py` — public API, RTLD_GLOBAL context manager, module initialization | ||||||
| - `_mkl_service.pyx` — Cython wrappers for MKL support functions | ||||||
| - `_mkl_service.pxd` — Cython declarations (C function signatures) | ||||||
| - `_mklinitmodule.c` — C extension for MKL library initialization | ||||||
| - `_init_helper.py` — loading helpers and diagnostics | ||||||
| - `_version.py` — version string (dynamic via setuptools) | ||||||
| - `tests/` — unit tests for API functionality | ||||||
|
|
||||||
| ## API categories | ||||||
| ### Threading control | ||||||
| - `set_num_threads(n)` — global thread count | ||||||
| - `get_max_threads()` — max threads available | ||||||
| - `domain_set_num_threads(n, domain)` — per-domain threading (FFT, VML, etc.) | ||||||
| - `domain_get_max_threads(domain)` — domain-specific max threads | ||||||
|
|
||||||
| ### Version information | ||||||
| - `get_version()` — MKL version dict | ||||||
| - `get_version_string()` — formatted version string | ||||||
|
|
||||||
| ### Memory management | ||||||
| - `peak_mem_usage(memtype)` — peak memory usage stats | ||||||
| - `mem_stat()` — memory allocation statistics | ||||||
|
|
||||||
| ### CNR (Conditional Numerical Reproducibility) | ||||||
| - `set_num_threads_local(n)` — thread-local thread count | ||||||
| - CNR mode control functions | ||||||
|
|
||||||
| ### Timing | ||||||
| - `second()` — wall clock time | ||||||
| - `dsecnd()` — high-precision timing | ||||||
|
|
||||||
| ## Development guardrails | ||||||
| - **Thread safety:** All threading functions must be thread-safe | ||||||
| - **API stability:** Preserve function signatures (widely used in ecosystem) | ||||||
| - **MKL dependency:** Assumes MKL is available at runtime (conda: mkl package) | ||||||
| - **RTLD_GLOBAL:** Required on Linux; handled by `RTLD_for_MKL` context manager in `__init__.py` | ||||||
|
|
||||||
| ## Cython details | ||||||
| - `_mkl_service.pyx` → generates `_py_mkl_service` extension module | ||||||
| - `.pxd` file declares external C functions from MKL headers | ||||||
| - Cython build requires MKL headers (mkl-devel) | ||||||
|
|
||||||
| ## C init module | ||||||
| - `_mklinitmodule.c` → `_mklinit` extension | ||||||
| - Ensures MKL library is loaded with correct flags before Cython extension | ||||||
| - Platform-specific: Windows uses `LoadLibrary`, Linux uses `dlopen` | ||||||
|
||||||
| - Platform-specific: Windows uses `LoadLibrary`, Linux uses `dlopen` | |
| - Platform-specific: Linux uses `dlopen(..., RTLD_GLOBAL)` preload; Windows DLL handling is in `_init_helper.py` |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| # AGENTS.md — mkl/tests/ | ||||||
|
|
||||||
| Unit tests for MKL runtime control API. | ||||||
|
|
||||||
| ## Test files | ||||||
| - **test_mkl_service.py** — API functionality, threading control, version info | ||||||
|
|
||||||
| ## Test coverage | ||||||
| - Threading: `set_num_threads`, `get_max_threads`, domain-specific threading | ||||||
| - Version: `get_version`, `get_version_string` format validation | ||||||
| - Memory: `peak_mem_usage`, `mem_stat` (if supported by MKL build) | ||||||
| - CNR: Conditional Numerical Reproducibility flags | ||||||
| - Edge cases: invalid domains, negative thread counts, thread-local settings | ||||||
|
||||||
| - Edge cases: invalid domains, negative thread counts, thread-local settings | |
| - Edge cases: thread-local settings |
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 workflow list claims
conda-package.ymlis a Linux/Windows/macOS pipeline, but the actual workflow only defines Linux and Windows jobs. Please either add a macOS job to the workflow or update this doc to reflect current CI coverage (and optionally note macOS support is only via recipe/build scripts).