Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 6 additions & 8 deletions .github/workflows/build-with-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
numpy_version: ["numpy'>=2'"]
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix value numpy_version: ["numpy'>=2'"] includes embedded quotes and will be passed verbatim to pip install, which is not a valid requirement specifier. Use something like numpy>=2.

Suggested change
numpy_version: ["numpy'>=2'"]
numpy_version: ["numpy>=2"]

Copilot uses AI. Check for mistakes.

env:
ONEAPI_ROOT: /opt/intel/oneapi
Expand All @@ -40,7 +41,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 +55,9 @@ 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 mkl
pip install ${{ matrix.numpy_version }}

- name: List oneAPI folder content
run: ls ${{ env.ONEAPI_ROOT }}/compiler
Expand All @@ -71,9 +68,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
64 changes: 64 additions & 0 deletions .github/workflows/build-with-standard-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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"]
numpy_version: ["numpy'>=2'"]
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix value numpy_version: ["numpy'>=2'"] includes embedded quotes and will be passed verbatim to pip install, which is not a valid requirement specifier. Use something like numpy>=2 (or just install numpy and control pre-releases separately).

Suggested change
numpy_version: ["numpy'>=2'"]
numpy_version: ["numpy>=2"]

Copilot uses AI. Check for mistakes.

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 mkl
Comment thread
ndgrigorian marked this conversation as resolved.
pip install ${{ matrix.numpy_version }}

- 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
50 changes: 50 additions & 0 deletions .github/workflows/build_pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Editable build using pip and pre-release NumPy

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"]
use_pre: ["", "--pre"]

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 --no-cache-dir numpy ${{ matrix.use_pre }}
pip install -e ".[test]" --no-build-isolation --verbose
pip list
python -m pytest -v mkl/tests
Comment thread
ndgrigorian marked this conversation as resolved.
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 @@ -18,14 +18,16 @@ 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
- cython
- wheel >=0.45.1
- python-build >=1.2.2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still used in conda-recipe/meta.yaml. Is that intended?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's used there because the build script there is more complicated and calls build command

conda-recipe-cf/build.sh just calls python -m pip install . --no-deps --no-build-isolation

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to parse pyproject.toml and to include the deps from there, as we currently do in dpnp/dpctl?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it probably does, though, I think it would be good for a follow up PR

- 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
70 changes: 70 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
project(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be helpful to add meson.options?

Copy link
Copy Markdown
Collaborator Author

@ndgrigorian ndgrigorian Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but I'm not sure if there's reason to add an empty one

I added an option in PR on top of this one
#184

Maybe I will think of others

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add a section to the README.md or similar with the build instructions, when building from the source?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revise the build instructions but, in theory, python -m pip install . should still work

'mkl-service',
['c', 'cython'],
version: run_command(
'python', '-c',
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_command('python', ...) hardcodes the interpreter, which may not match Meson’s discovered Python (virtualenv/pyenv/Windows). Use the py installation found by import('python').find_installation() when computing the version to avoid mismatched interpreters.

Suggested change
'python', '-c',
import('python').find_installation(pure: false), '-c',

Copilot uses AI. Check for mistakes.
'import os; exec(open("mkl/_version.py").read()); print(__version__)',
check: true
).stdout().strip(),
default_options: [
'buildtype=release',
]
)

py = import('python').find_installation(pure: false)

c_args = ['-DNDEBUG']

thread_dep = dependency('threads')

cc = meson.get_compiler('c')
Comment thread
ndgrigorian marked this conversation as resolved.
mkl_dep = dependency('MKL', method: 'cmake',
modules: ['MKL::MKL'],
cmake_args: [
'-DMKL_ARCH=intel64',
'-DMKL_LINK=sdl',
],
required: true
)

rpath = ''
if host_machine.system() != 'windows'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to be more explicit here? (since that will not work on macOS as well and probably others)

Suggested change
if host_machine.system() != 'windows'
if host_machine.system() == 'linux'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's a good idea

rpath = '$ORIGIN/../..:$ORIGIN/../../..'
endif

# C extension
py.extension_module(
'_mklinit',
sources: ['mkl/_mklinitmodule.c'],
dependencies: [mkl_dep, thread_dep],
c_args: c_args + ['-DUSING_MKL_RT'],
install_rpath: rpath,
install: true,
subdir: 'mkl'
)

# Cython extension
py.extension_module(
'_py_mkl_service',
sources: ['mkl/_py_mkl_service.pyx'],
dependencies: [mkl_dep],
c_args: c_args,
install_rpath: rpath,
install: true,
subdir: 'mkl'
)

# Python sources
py.install_sources(
[
'mkl/__init__.py',
'mkl/_init_helper.py',
'mkl/_version.py',
],
subdir: 'mkl'
)

install_subdir(
'mkl/tests',
install_dir: py.get_install_dir() / 'mkl'
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to update AGENTS.md and copilot-instructions.md with that change

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also to reflect there the new build command

File renamed without changes.
14 changes: 6 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

[build-system]
build-backend = "setuptools.build_meta"
build-backend = "mesonpy"
requires = [
"setuptools>=77",
"meson-python>=0.13.0",
"ninja",
"Cython",
"wheel>=0.45.1",
"build>=1.2.2",
"mkl-devel"
"mkl-devel",
Comment thread
ndgrigorian marked this conversation as resolved.
"cmake"
]

[project]
authors = [
{name = "Intel Corporation", email = "scripting@intel.com"}
]
authors = [{name = "Intel Corporation"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
Expand Down
Loading
Loading