Skip to content

urob/numpy-mkl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numpy-mkl

NumPy SciPy mkl-service

This repository provides binary wheels for NumPy and SciPy, linked to Intel's high-performance oneAPI Math Kernel Library for Intel CPUs. The wheels are accessible through a custom Python Package Index (PyPI) and can be installed with pip or uv.

Installation

MKL-accelerated wheels are available for 64-bit versions of Linux and Windows. There are no prerequisites apart from pip or uv; all dependencies are automatically installed by the package manager.

uv

# Run this from project directory
uv init
uv add numpy scipy --index https://urob.github.io/numpy-mkl

pip

pip install numpy scipy --extra-index-url https://urob.github.io/numpy-mkl

Cross-platform collaborations

MKL is only available on x86-64 architectures, excluding macOS systems. When using uv, one can use platform markers to automatically install MKL-linked versions of NumPy and SciPy when on a compatible system, and otherwise fall back to the default versions from PyPI.

To do so, copy the following into pyproject.toml and then run uv sync. This will install a virtual environment in .venv, which can be activated on the command line or via most Python editors.

[project]
name = "example-project"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
    "numpy>=2.2.6",
    "scipy>=1.15.2",
    "mkl-service>=2.4.2; platform_machine == 'x86_64' and sys_platform != 'darwin'",
]

[tool.uv.sources]
numpy = [{ index = "numpy-mkl", marker = "platform_machine == 'x86_64' and sys_platform != 'darwin'" }]
scipy = [{ index = "numpy-mkl", marker = "platform_machine == 'x86_64' and sys_platform != 'darwin'" }]
mkl-service = [{ index = "numpy-mkl", marker = "platform_machine == 'x86_64' and sys_platform != 'darwin'" }]

[[tool.uv.index]]
name = "numpy-mkl"
url = "https://urob.github.io/numpy-mkl"
explicit = true

Alternatives

The usual way to obtain MKL-accelerated NumPy and SciPy packages is through Anaconda or Conda-forge. The purpose of this repository is to provide an alternative for users who prefer to use pip or uv for package management. Other alternatives are listed below.

MKL PyPI Notes
This repository Yes Yes
Intel(r) Distribution for Python Yes Yes Does not support NumPy 2.x
Numpy-mkl-wheels Yes No No Linux wheels
Python Package Index No Yes Slow on Intel CPUs

Technical details

Linux wheels are built with gcc on Ubuntu 22.04. Windows wheels are built with msvc (numpy) and mingw-w64 (scipy) on Windows Server 2022. These compilers showed the most consistent runtime performance in a series of benchmarks, even in comparison to icx-compiled wheels.

References

About

MKL-accelerated NumPy and SciPy wheels

Topics

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •