-
Notifications
You must be signed in to change notification settings - Fork 39
Move build system to meson-python
#174
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
503cdce
392d89a
e8255b5
8681c0d
acb1d16
488455e
f6e5526
869a7dc
02fdbbe
a92a577
49fc7be
83838d5
b39b64b
70124c9
243009b
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,7 +37,7 @@ Higher-precedence file overrides; lower must not restate overridden guidance. | |||||
| - Build/config: `pyproject.toml`, `setup.py` | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still listing
Suggested change
|
||||||
| - 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 | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| 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 -e ".[test]" --no-build-isolation --verbose | ||
| pip list | ||
| python -m pytest -v mkl/tests |
| 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: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| 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 with pip | ||
| 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 | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - `build-with-clang.yml` — Linux Clang compatibility | ||||||
| - `build-with-standard-clang.yml` — standard Clang compiler compatibility validation | ||||||
| - `build_pip` — validates editable build | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - `pre-commit.yml` — code quality checks | ||||||
| - `openssf-scorecard.yml` — security scanning | ||||||
|
|
||||||
|
|
@@ -65,7 +71,7 @@ mkl.get_version_string() # MKL version info | |||||
| - **C init:** `_mklinitmodule.c` handles Linux preloading (`dlopen(..., RTLD_GLOBAL)`) for MKL runtime | ||||||
| - **Windows loading helper:** `_init_helper.py` handles DLL path setup in Windows venv | ||||||
| - **Python wrapper:** `__init__.py` imports `_py_mkl_service` (generated from `.pyx`) | ||||||
| - **Version:** `_version.py` (dynamic via setuptools) | ||||||
| - **Version:** `_version.py` | ||||||
|
|
||||||
| ## Notes | ||||||
| - RTLD_GLOBAL preloading is required on Linux (handled by `RTLD_for_MKL` context manager) | ||||||
|
|
@@ -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) | ||||||
| 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 |
| 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 | ||
| #!/bin/bash -ex | ||
| $PYTHON -m pip install --no-deps --no-build-isolation . | ||
|
ndgrigorian marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -19,15 +19,17 @@ requirements: | |||
| - {{ compiler('c') }} | ||||
| - {{ stdlib('c') }} | ||||
| host: | ||||
| - meson-python >=0.13.0 | ||||
| - meson | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same
Suggested change
|
||||
| - 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 | ||||
|
ndgrigorian marked this conversation as resolved.
|
||||
| run: | ||||
| - python | ||||
| - python-gil # [py>=314] | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -18,14 +18,17 @@ requirements: | |||
| - {{ compiler('c') }} | ||||
| - {{ stdlib('c') }} | ||||
| host: | ||||
| - meson-python >=0.13.0 | ||||
|
ndgrigorian marked this conversation as resolved.
|
||||
| - meson | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| - cmake | ||||
| - ninja | ||||
| - python | ||||
| - python-gil # [py>=314] | ||||
| - python-build >=1.2.2 | ||||
| - pip >=25.0 | ||||
| - setuptools >=77 | ||||
| - mkl-devel | ||||
| - cython | ||||
| - wheel >=0.45.1 | ||||
| - python-build >=1.2.2 | ||||
| run: | ||||
| - python | ||||
| - python-gil # [py>=314] | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.