Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8f9de4d
move mkl_umath build system to meson
ndgrigorian Mar 1, 2026
e1ce0ee
add tests to module
ndgrigorian Mar 4, 2026
c1b5c43
exclude process_src_template from linting
ndgrigorian Mar 4, 2026
01af689
add python-build to meta.yamls
ndgrigorian Mar 4, 2026
c90f88f
fix syntax in build shell scripts
ndgrigorian Mar 4, 2026
e734712
update build_pip workflow
ndgrigorian Mar 4, 2026
075b296
update clang workflow
ndgrigorian Mar 5, 2026
2ec1201
fix import error in builds
ndgrigorian Mar 5, 2026
0ae4685
update Windows build scripts
ndgrigorian Mar 5, 2026
c4a4038
fix linting
ndgrigorian Mar 5, 2026
ab07fd1
fix flags on windows builds
ndgrigorian Mar 5, 2026
903cf97
add wheel to conda-forge meta.yaml
ndgrigorian Mar 5, 2026
8b58419
fix typo in bld.bat
ndgrigorian Mar 5, 2026
d745054
add pip to meta.yamls
ndgrigorian Mar 5, 2026
64c1881
ignore git blame of previous commit fixing linting
ndgrigorian Mar 5, 2026
d10f0d0
fix race condition in meson build
ndgrigorian Mar 6, 2026
2bd6b7a
require MKL in meson build
ndgrigorian Apr 7, 2026
f4d0b02
drop 'cpp' from meson.build
ndgrigorian Apr 7, 2026
cb7f656
add cmake to build system dependencies
ndgrigorian Apr 8, 2026
8e3cd1d
remove jq from pip build
ndgrigorian Apr 9, 2026
9a03cfe
add meson option for setting MKL_THREADING
ndgrigorian Apr 26, 2026
6dc291f
simplify mkl_umath conda-forge build scripts
ndgrigorian May 29, 2026
f7e5989
Merge branch 'main' into build-with-meson
ndgrigorian Jul 8, 2026
ff65831
add CLI sources to meson.build
ndgrigorian Jul 9, 2026
1166ac3
Use link_args for RPATH and improve portability
vlad-perevezentsev Jul 22, 2026
c66efbb
Remove redundant meson dependency
vlad-perevezentsev Jul 22, 2026
2c06350
Apply remarks from mkl-service PR
vlad-perevezentsev Jul 22, 2026
7e4cbb6
Update AGENT.md and copilot files
vlad-perevezentsev Jul 22, 2026
c8f87b4
Update README
vlad-perevezentsev Jul 22, 2026
d56a482
fix RPATH and remove duplicate vectorization flags
vlad-perevezentsev Jul 22, 2026
97273ce
Merge remote-tracking branch 'origin/main' into build-with-meson
vlad-perevezentsev Jul 22, 2026
2142b86
Merge main into build-with-meson
vlad-perevezentsev Jul 27, 2026
3144a1e
Remove macOS RPATH support
vlad-perevezentsev Jul 27, 2026
2792ce6
Add numpy to ignore_run_exports
vlad-perevezentsev Jul 27, 2026
36fb2fd
Add wheels upload to conda-package workflow
vlad-perevezentsev Jul 27, 2026
d3058d7
Use -ex flags in build.sh
vlad-perevezentsev Jul 27, 2026
da30b1a
Fix --platform-tag flag in conda-recipe build.sh
vlad-perevezentsev Jul 27, 2026
0a5872d
Remove explicit CC/CXX from conda-recipe-cf build.sh
vlad-perevezentsev Jul 27, 2026
b0128c9
Remove explicit CC/CXX in conda-recipe build.sh
vlad-perevezentsev Jul 27, 2026
3200edd
Switch to editable install in workflows
vlad-perevezentsev Jul 28, 2026
6dbc649
Add intel-openmp dependency and numpy to ignore_run_exports
vlad-perevezentsev Jul 28, 2026
af4e9c1
Add gen_umath_c to _ufuncs sources in meson.build
vlad-perevezentsev Jul 28, 2026
8e50ba1
Use main instead of master in GH workflows
vlad-perevezentsev Jul 28, 2026
26b26ec
Rename build_pip.yaml to build_pip.yml
vlad-perevezentsev Jul 28, 2026
3225694
Update the license name in pyproject.toml
vlad-perevezentsev Jul 28, 2026
59e88b8
Remove dead branch from generate_umath.py and make -o required
vlad-perevezentsev Jul 28, 2026
f50938c
Update changelog
vlad-perevezentsev Jul 28, 2026
3ffb970
Update README and AGENTS docs for meson build system
vlad-perevezentsev Jul 28, 2026
0dc17a7
Update changelog
vlad-perevezentsev Jul 28, 2026
e1c0a63
Merge remote-tracking branch 'origin/main' into build-with-meson
vlad-perevezentsev Jul 28, 2026
7973a93
Mention mkl_threading arg in changelog
vlad-perevezentsev Jul 29, 2026
cb9ed81
Fix opt-report flag and Windows export macro
vlad-perevezentsev Jul 29, 2026
b61cff8
Require meson-python >=0.16.0 for PEP 639
vlad-perevezentsev Jul 29, 2026
46442a3
Update AI files
vlad-perevezentsev Jul 29, 2026
9cb241e
Add Windows intel-openmp and intel-cmplr-lib-rt deps
vlad-perevezentsev Jul 29, 2026
487fbf8
Restore warning flags on MSVC
vlad-perevezentsev Jul 29, 2026
4e5183a
Remove dangling entry from .git-blame-ignore-revs
vlad-perevezentsev Jul 29, 2026
da6a925
Remove redundant pylint disable in test_basic.py
vlad-perevezentsev Jul 29, 2026
1291b05
Enable verbose build in conda-recipe-cf build.sh
vlad-perevezentsev Jul 29, 2026
283d50e
Remove redundant CFLAGS/CXXFLAGS from conda_build_config.yaml
vlad-perevezentsev Jul 29, 2026
27c8f8a
Restore CC=icx in conda build scripts to build with icx
vlad-perevezentsev Jul 29, 2026
f065e8a
Add mkl-devel to build-system requires
vlad-perevezentsev Jul 29, 2026
7657322
Update README
vlad-perevezentsev Jul 29, 2026
1a7e2c3
Merge remote-tracking branch 'origin/main' into build-with-meson
vlad-perevezentsev Jul 29, 2026
cb77d95
Merge remote-tracking branch 'origin/main' into build-with-meson
vlad-perevezentsev Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ per-file-ignores =
mkl_umath/ufunc_docstrings_numpy1.py: E501
mkl_umath/ufunc_docstrings_numpy2.py: E501

exclude = _vendored/conv_template.py
exclude =
_vendored/conv_template.py
_vendored/process_src_template.py

filename = *.py, *.pyx, *.pxi, *.pxd
max_line_length = 80
Expand Down
33 changes: 12 additions & 21 deletions .github/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
# AGENTS.md — .github/

CI/CD workflows, automation, security scanning, and package distribution.
CI/CD workflows and repo automation.

## Workflows
- **conda-package.yml** — main build/test pipeline (Linux/Windows, Python 3.10-3.14)
- **build_pip.yaml** — PyPI wheel builds for Intel channel
- **build-with-clang.yml** — Clang compatibility validation
- **openssf-scorecard.yml** — security posture scanning
## Workflows (source of truth)
- `conda-package.yml` — Intel channel conda build/test pipeline
- `conda-package-cf.yml` — conda-forge-oriented build/test pipeline
- `build-with-clang.yml` — Intel clang compatibility checks
- `build-with-standard-clang.yml` — standard clang compatibility checks
- `build_pip.yml` — pip build pipeline with pre-release NumPy
- `pre-commit.yml` — lint/format checks
- `openssf-scorecard.yml` — security 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`
- Conda channel: `https://software.repos.intel.com/python/conda`

## Security
- OpenSSF Scorecard runs automatically
- CODEOWNERS enforces review policy
- Dependabot monitors dependencies (`.github/dependabot.yml`)

## Notes
- Workflow/job renames are breaking for downstream tooling
- Cache key includes `meta.yaml` hash for conda packages
- Artifacts uploaded per-Python-version for parallel testing
## Policy
- Treat workflow YAML as canonical for platform/Python matrices.
- Avoid doc claims about CI coverage unless present in workflow config.
8 changes: 4 additions & 4 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Higher-precedence rules override lower-precedence context.
- Never include secrets or credentials in code/docs.

## Source-of-truth files
- Build: `CMakeLists.txt`, `pyproject.toml`, `setup.py`
- Dependencies/packaging: `conda-recipe*/meta.yaml`
- CI: `.github/workflows/*.{yml,yaml}`
- API: `mkl_umath/__init__.py`, `mkl_umath/src/_patch.pyx`
- Build/config: `pyproject.toml`, `meson.build`
- Dependencies/packaging: `pyproject.toml`, `conda-recipe*/meta.yaml`
- CI: `.github/workflows/*.yml`
- API: `mkl_umath/__init__.py`, `mkl_umath/src/_patch_numpy.pyx`
- Core implementation: `mkl_umath/src/*.{c,c.src,pyx}`
- Tests: `mkl_umath/tests/`

Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/build-with-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name: Build project with IntelLLVM clang compiler
on:
pull_request:
push:
branches: [master]
branches: [main]

permissions: read-all

jobs:
build-with-clang:
build-with-intel-clang:
runs-on: ubuntu-latest

strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
numpy_version: ["numpy'>=2'"]
numpy_version: ["'numpy>=2'"]

env:
ONEAPI_ROOT: /opt/intel/oneapi
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Install mkl_umath dependencies
run: |
pip install scikit-build cmake ninja cython setuptools">=77"
pip install meson-python ninja cython cmake
pip install ${{ matrix.numpy_version }}

- name: List oneAPI folder content
Expand All @@ -66,14 +66,10 @@ jobs:
source ${{ env.ONEAPI_ROOT }}/setvars.sh
echo "$CMPLR_ROOT"
export CC="$CMPLR_ROOT/bin/icx"
export CFLAGS="${CFLAGS} -fno-fast-math -O2"
Comment thread
vlad-perevezentsev marked this conversation as resolved.
pip install . --no-build-isolation --no-deps --verbose
pip install -e . --no-build-isolation --no-deps --verbose

- name: Run mkl_umath tests
run: |
source ${{ env.ONEAPI_ROOT }}/setvars.sh
pip install pytest
# mkl_umath cannot be installed in editable mode, we need
# to change directory before importing it and running tests
cd ..
python -m pytest -sv --pyargs mkl_umath
60 changes: 60 additions & 0 deletions .github/workflows/build-with-standard-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build project with standard clang compiler

on:
pull_request:
push:
branches: [main]

permissions: read-all

jobs:
build-with-standard-clang:
runs-on: ubuntu-latest

strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
numpy_version: ["'numpy>=2'"]

env:
COMPILER_ROOT: /usr/bin

defaults:
run:
shell: bash -el {0}

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0
with:
access_token: ${{ github.token }}

- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y clang
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python }}
architecture: x64

- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- name: Install mkl_umath dependencies
run: |
pip install meson-python ninja cmake cython mkl-devel
pip install ${{ matrix.numpy_version }}
- name: Build mkl_umath
run: |
export CC=${{ env.COMPILER_ROOT }}/clang
pip install -e . --no-build-isolation --no-deps --verbose
- name: Run mkl_umath tests
run: |
pip install pytest
python -m pytest -sv --pyargs mkl_umath
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build using pip and pre-release NumPy
on:
push:
branches:
- master
- main
pull_request:

permissions: read-all
Expand All @@ -21,11 +21,6 @@ jobs:
use_pre: ["", "--pre"]

steps:
- name: Install jq
shell: bash -l {0}
run: |
sudo apt-get install jq

- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -46,16 +41,11 @@ jobs:
python -c "import sys; print(sys.executable)"
which python

- name: Build conda package
- name: Build with pip
run: |
pip install --no-cache-dir scikit-build cmake ninja cython
pip install --no-cache-dir meson-python ninja cmake cython
pip install --no-cache-dir numpy ${{ matrix.use_pre }}
echo "CONDA_PREFFIX is '${CONDA_PREFIX}'"
export MKLROOT=${CONDA_PREFIX}
CC=icx pip install . --no-build-isolation --no-deps --verbose
CC=icx pip install -e . --no-build-isolation --no-deps --verbose
pip install --no-cache-dir pytest
pip list
# mkl_umath cannot be installed in editable mode, we need
# to change directory before importing it and running tests
cd ..
python -m pytest -v --pyargs mkl_umath
python -m pytest -sv --pyargs mkl_umath
2 changes: 1 addition & 1 deletion .github/workflows/conda-package-cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Conda package with conda-forge channel only
on:
push:
branches:
- master
- main
pull_request:

permissions: read-all
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Conda package
on:
push:
branches:
- master
- main
pull_request:

permissions: read-all
Expand Down Expand Up @@ -75,12 +75,16 @@ jobs:
run: |
conda list -n base

- name: Store conda paths as envs
run: |
echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> "$GITHUB_ENV"
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> "$GITHUB_ENV"

- name: Build conda package
run: |
CHANNELS=(-c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
VERSIONS=(--python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}")
TEST=(--no-test)
echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> "$GITHUB_ENV"

conda build \
"${TEST[@]}" \
Expand All @@ -94,6 +98,12 @@ jobs:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}/${{ env.PACKAGE_NAME }}-*.conda

- name: Upload wheels artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl

test_linux:
needs: build_linux
runs-on: ${{ matrix.runner }}
Expand Down Expand Up @@ -234,6 +244,7 @@ jobs:
shell: bash -l {0}
run: |
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> "$GITHUB_ENV"

- name: Install conda build
run: |
Expand All @@ -252,6 +263,12 @@ jobs:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda

- name: Upload wheels artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl

test_windows:
needs: build_windows
runs-on: ${{ matrix.runner }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openssf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- cron: '28 2 * * 1'
- cron: '28 2 * * 4'
push:
branches: [ "master" ]
branches: [ "main" ]
workflow_dispatch:


Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ repos:
"-rn", # Only display messages
"-sn", # Don't display the score
"--errors-only",
"--disable=import-error",
"--disable=import-error,no-name-in-module",
Comment thread
vlad-perevezentsev marked this conversation as resolved.
]

- repo: https://github.com/jumanjihouse/pre-commit-hooks
Expand Down
41 changes: 25 additions & 16 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,39 @@ It provides:
- **Core C implementation:** `mkl_umath/src/` (ufuncsmodule.c, mkl_umath_loops.c.src)
- **Cython patch layer:** `mkl_umath/src/_patch_numpy.pyx`
- **Code generation:** `generate_umath.py`, `generate_umath_doc.py`
- **Build system:** CMake (CMakeLists.txt) + scikit-build
- **Build system:** meson-python + Cython

## Build dependencies
**Required:**
- Compiler toolchain: Intel `icx` or `clang` (with Intel-only flags gated when using clang)
- Intel® OneMKL (mkl-devel)
- NumPy, Cython, scikit-build, cmake, ninja
- Intel® oneMKL (`mkl-devel`)
- meson-python, CMake, Ninja, Cython, NumPy

**Conda environment:**
**Build against an existing `mkl` installation:**

Install the build dependencies via Conda:
```bash
conda install -c https://software.repos.intel.com/python/conda \
mkl-devel dpcpp_linux-64 numpy-base \
cmake ninja cython scikit-build
export MKLROOT=$CONDA_PREFIX
CC=${CC:-icx} pip install --no-build-isolation --no-deps . # clang is also supported in CI
mkl-devel dpcpp_linux-64 cython meson-python cmake ninja numpy
```
or via pip:
```bash
pip install mkl-devel cython meson-python cmake ninja numpy
```
then build:
```bash
CC=icx pip install --no-deps --no-build-isolation . # clang is also supported in CI
```

## CI/CD
- **Platforms:** Linux, Windows
- **Python versions:** 3.10, 3.11, 3.12, 3.13, 3.14
- **Workflows:** `.github/workflows/`
- `conda-package.yml` — main build/test pipeline
- `build_pip.yaml` — PyPI wheel builds
- `build-with-clang.yml` — Clang compatibility check
- `conda-package.yml` — main conda build/test pipeline
- `conda-package-cf.yml` — conda-forge-oriented build/test pipeline
- `build_pip.yml` — validates pip build with pre-release NumPy
- `build-with-clang.yml` — Intel clang compatibility check
- `build-with-standard-clang.yml` — standard clang compatibility check
- `openssf-scorecard.yml` — security scorecard

## Distribution
Expand All @@ -58,13 +67,14 @@ mkl_umath.restore_numpy_umath() # Restore original NumPy loops
- **Performance:** Changes should maintain or improve MKL VM utilization
- **Compatibility:** Must work with upstream NumPy APIs (NEP-36 compliance)
- **Testing:** Add tests to `mkl_umath/tests/test_basic.py`
- **Build hygiene:** CMake changes → verify Linux + Windows
- **Build hygiene:** `meson.build` is the source of truth for build config — verify Linux + Windows
- **Docs:** Update docstrings via `ufunc_docstrings_numpy{1,2}.py`

## Code structure
- **Generated code:** `*.src` files are templates (conv_template.py processes them)
- **Precision flags:** fp:precise, fimf-precision=high, fprotect-parens (non-negotiable)
- **Security:** Stack protection, FORTIFY_SOURCE, NX/DEP enforced in CMake
- **Security:** Stack protection, FORTIFY_SOURCE, NX/DEP enforced in `meson.build`
- **Build options:** `opt_report` and `mkl_threading` are exposed via `meson.options`


## Common pitfalls
Expand All @@ -74,12 +84,11 @@ mkl_umath.restore_numpy_umath() # Restore original NumPy loops
- **Compiler/toolchain:** `icx` and `clang` are both supported; when using clang, keep Intel-only flags behind compiler guards.
- **Build validation:**
- After setup: `which ${CC:-icx}` → should resolve to the intended compiler toolchain
- Verify: `echo $MKLROOT` → should be set
- Check: `python -c "import numpy; print(numpy.__version__)"` → confirm Intel NumPy
- Check: `python -c "import numpy; print(numpy.__version__)"` → confirm NumPy is available

## Notes
- `_vendored/` contains vendored NumPy code generation utilities
- Version in `mkl_umath/_version.py` (dynamic via setuptools)
- Version in `mkl_umath/_version.py` (read dynamically by `meson.build`)
Comment thread
vlad-perevezentsev marked this conversation as resolved.
- Patching is runtime-only; no NumPy source modification

## Directory map
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
* Removed `numpy-base` dependency and `USE_NUMPY_BASE` environment variable from conda recipe [gh-200](https://github.com/IntelPython/mkl_umath/pull/200)
* Migrated the build system from `scikit-build` to `meson-python`, removing `setup.py` and `CMakeLists.txt` in favor of `meson.build` [gh-166](https://github.com/IntelPython/mkl_umath/pull/166)
* Renamed the `OPTIMIZATION_REPORT` and `MKL_THREADING` build options to `opt_report` and `mkl_threading`, now passed as meson setup args (e.g. `-Csetup-args=-Dopt_report=true` and `-Csetup-args=-Dmkl_threading=tbb_thread`) [gh-166](https://github.com/IntelPython/mkl_umath/pull/166)

### Fixed

Expand Down
Loading
Loading