Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .github/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ CI/CD workflows, automation, security scanning, and package distribution.

## Workflows
- **conda-package.yml** — main build/test pipeline (Linux/Windows, Python 3.10-3.14)
- **conda-package-cf.yml** — build/test using only conda-forge channel (Linux/Windows, Python 3.10-3.14)
- **build-with-clang.yml** — Linux Clang compiler compatibility validation
- **build-with-standard-clang.yml** — standard Clang compiler compatibility validation
- **build_pip.yml** — validates editable build
- **pre-commit.yml** — code quality checks (flake8, etc.)
- **openssf-scorecard.yml** — security posture scanning

Expand Down
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Higher-precedence file overrides; lower must not restate overridden guidance.
- Build/config: `pyproject.toml`, `setup.py`
- Recipe/deps: `conda-recipe/meta.yaml`, `conda-recipe/conda_build_config.yaml`
- CI: `.github/workflows/*.{yml,yaml}`
- API contracts: `mkl/__init__.py`, `mkl/_mkl_service.pyx`
- API contracts: `mkl/__init__.py`, `mkl/_py_mkl_service.pyx`
- Tests: `mkl/tests/test_mkl_service.py`

## MKL-specific constraints
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 @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]

env:
ONEAPI_ROOT: /opt/intel/oneapi
Expand All @@ -40,7 +40,6 @@ jobs:
- name: Install Intel OneAPI
run: |
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
sudo apt-get install intel-oneapi-tbb
sudo apt-get install intel-oneapi-mkl-devel

- name: Setup Python
Expand All @@ -55,12 +54,8 @@ jobs:
fetch-depth: 0

- name: Install mkl-service dependencies
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
with:
packages: |
cython
setuptools>=77
pytest
run: |
pip install meson-python cython cmake ninja

- name: List oneAPI folder content
run: ls ${{ env.ONEAPI_ROOT }}/compiler
Expand All @@ -71,9 +66,10 @@ jobs:
echo "$CMPLR_ROOT"
export CC="$CMPLR_ROOT/bin/icx"
export CFLAGS="${CFLAGS} -fno-fast-math"
python setup.py develop
pip install . --no-build-isolation --no-deps --verbose

- name: Run mkl-service tests
run: |
source ${{ env.ONEAPI_ROOT }}/setvars.sh
pip install pytest
pytest -s -v --pyargs mkl
62 changes: 62 additions & 0 deletions .github/workflows/build-with-standard-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build project with standard clang compiler

on:
pull_request:
push:
branches: [master]

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"]

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-service dependencies
run: |
pip install meson-python cython cmake ninja mkl-devel

- name: Build mkl-service
run: |
export CC=${{ env.COMPILER_ROOT }}/clang
pip install . --no-build-isolation --no-deps --verbose

- name: Run mkl-service tests
run: |
pip install pytest
# mkl-service cannot be installed in editable mode, we need
# to change directory before importing it and running tests
cd ..
pytest -s -v --pyargs mkl
48 changes: 48 additions & 0 deletions .github/workflows/build_pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Editable build using pip

on:
push:
branches:
- master
pull_request:

permissions: read-all

env:
PACKAGE_NAME: mkl-service
MODULE_NAME: mkl-service
TEST_ENV_NAME: test_mkl_service

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]

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

- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
channels: conda-forge
activate-environment: test
python-version: ${{ matrix.python }}

- name: Install MKL
run: |
conda install mkl-devel mkl

- name: Build conda package
run: |
pip install --no-cache-dir meson-python ninja cmake cython
pip install -e ".[test]" --no-build-isolation --verbose
pip list
python -m pytest -v mkl/tests
16 changes: 12 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,35 @@ Originally part of Intel® Distribution for Python*, now a standalone package av

## Key components
- **Python interface:** `mkl/__init__.py` — public API surface
- **Cython wrapper:** `mkl/_mkl_service.pyx` — wraps MKL support functions
- **Cython wrapper:** `mkl/_py_mkl_service.pyx` — wraps MKL support functions
- **C init module:** `mkl/_mklinitmodule.c` — Linux-side MKL runtime preloading / initialization
- **Helper:** `mkl/_init_helper.py` — Windows venv DLL loading helper
- **Build system:** setuptools + Cython
- **Build system:** meson-python + Cython

## Build dependencies
**Required:**
- Intel® oneMKL
- meson-python
- CMake
- Ninja
- Cython
- Python 3.10+

**Conda environment:**
```bash
conda install -c conda-forge mkl-devel cython
python setup.py install
conda install -c conda-forge mkl-devel cython meson-python cmake ninja
python -m pip install --no-deps --no-build-isolation .
```

## CI/CD
- **Platforms in CI workflows:** Linux, Windows
- **Python versions:** 3.10, 3.11, 3.12, 3.13, 3.14
- **Workflows:** `.github/workflows/`
- `conda-package.yml` — main conda build/test pipeline
- `conda-package-cf.yml — conda build/test using only conda-forge channel
- `build-with-clang.yml` — Linux Clang compatibility
- `build-with-standard-clang.yml` — standard Clang compiler compatibility validation
- `build_pip` — validates editable build
- `pre-commit.yml` — code quality checks
- `openssf-scorecard.yml` — security scanning

Expand Down Expand Up @@ -85,4 +91,6 @@ Below directories have local `AGENTS.md` for deeper context:
For broader IntelPython ecosystem context, see:
- `mkl_umath` (MKL-backed NumPy ufuncs)
- `mkl_random` (MKL-based random number generation)
- `mkl_fft` (MKL-based fast fourier transform functions)
- `dpnp` (Data Parallel NumPy)
- `dpctl` (Data Parallel Control)
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,28 @@ A short example, illustrating its use:
```

For more information about the usage of support functions see [Developer Reference for Intel® oneAPI Math Kernel Library for C](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-2/support-functions.html).

---

## Building

A C compiler and Intel(R) OneAPI Math Kernel Library (OneMKL) are required to build mkl-service from source.

Executing
```sh
python -m pip install .
```

will pull in the required build and runtime dependencies, including `mkl`, and build `mkl-service`.

With an existing system or Conda `mkl` installation, build dependencies
- `mkl-devel`
- `meson-python`
- `cmake`
- `ninja`
- `cython`

then, simply execute
```
python -m pip install --no-build-isolation --no-deps .
```
3 changes: 1 addition & 2 deletions conda-recipe-cf/bld.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@rem Remember to activate Intel Compiler, or remove these two lines to use Microsoft Visual Studio compiler

set MKLROOT=%PREFIX%
%PYTHON% setup.py build --force install --old-and-unmanageable
%PYTHON% -m pip install --no-deps --no-build-isolation .
if errorlevel 1 exit 1
2 changes: 1 addition & 1 deletion conda-recipe-cf/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash -x
MKLROOT=$PREFIX $PYTHON setup.py build --force install --old-and-unmanageable
$PYTHON -m pip install --no-deps --no-build-isolation .
6 changes: 4 additions & 2 deletions conda-recipe-cf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ requirements:
- {{ compiler('c') }}
- {{ stdlib('c') }}
host:
- meson-python >=0.13.0
- meson
- cmake
- ninja
- python
- python-gil # [py>=314]
- pip >=25.0
- setuptools >=77
- mkl-devel # [not osx]
- mkl-devel <2024 # [osx]
- cython
- wheel >=0.45.1
- python-build >=1.2.2
run:
- python
- python-gil # [py>=314]
Expand Down
7 changes: 0 additions & 7 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ echo on
rem set CFLAGS=-I%PREFIX%\Library\include %CFLAGS%
rem set LDFLAGS=/LIBPATH:%PREFIX% %LDFLAGS%

set MKLROOT=%CONDA_PREFIX%

"%PYTHON%" setup.py clean --all

:: Make CMake verbose
set "VERBOSE=1"

:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check
%PYTHON% -m build -w -n -x
if %ERRORLEVEL% neq 0 exit 1
Expand Down
9 changes: 3 additions & 6 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/bash
set -ex

export MKLROOT=$CONDA_PREFIX

read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"

${PYTHON} setup.py clean --all

# Make CMake verbose
export VERBOSE=1
if [ -d "build" ]; then
rm -rf build
fi

# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
${PYTHON} -m build -w -n -x
Expand Down
7 changes: 5 additions & 2 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ requirements:
- {{ compiler('c') }}
- {{ stdlib('c') }}
host:
- meson-python >=0.13.0
- meson
- cmake
- ninja
- python
- python-gil # [py>=314]
- python-build
- pip >=25.0
- setuptools >=77
- mkl-devel
- cython
- wheel >=0.45.1
- python-build >=1.2.2
run:
- python
- python-gil # [py>=314]
Expand Down
Loading
Loading