kernelforge 0.1.17__tar.gz → 0.1.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. kernelforge-0.1.18/.github/dependabot.yml +54 -0
  2. {kernelforge-0.1.17 → kernelforge-0.1.18}/.github/workflows/ci.yml +10 -1
  3. {kernelforge-0.1.17 → kernelforge-0.1.18}/.github/workflows/code-quality.yml +10 -9
  4. kernelforge-0.1.17/.github/workflows/release.yaml → kernelforge-0.1.18/.github/workflows/release.yml +13 -6
  5. {kernelforge-0.1.17 → kernelforge-0.1.18}/.pre-commit-config.yaml +2 -12
  6. {kernelforge-0.1.17 → kernelforge-0.1.18}/Makefile +2 -2
  7. kernelforge-0.1.17/README.md → kernelforge-0.1.18/PKG-INFO +97 -18
  8. kernelforge-0.1.17/PKG-INFO → kernelforge-0.1.18/README.md +63 -41
  9. {kernelforge-0.1.17 → kernelforge-0.1.18}/pyproject.toml +38 -16
  10. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/cli.py +19 -17
  11. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_fchl19.py +67 -60
  12. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_fchl19_gradient.py +12 -2
  13. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_hessian.py +19 -5
  14. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_invdist.py +2 -2
  15. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_jacobian.py +8 -4
  16. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_kernels.py +6 -3
  17. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_rfp.py +14 -5
  18. kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp310-cp310-macosx_15_0_arm64.whl +0 -0
  19. kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp311-cp311-macosx_15_0_arm64.whl +0 -0
  20. kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp312-cp312-macosx_15_0_arm64.whl +0 -0
  21. kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp313-cp313-macosx_15_0_arm64.whl +0 -0
  22. kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp314-cp314-macosx_15_0_arm64.whl +0 -0
  23. kernelforge-0.1.17/environments/environment-dev-macos.yaml +0 -33
  24. kernelforge-0.1.17/environments/environment-dev.yaml +0 -30
  25. kernelforge-0.1.17/pytest.ini +0 -2
  26. kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp310-cp310-macosx_15_0_arm64.whl +0 -0
  27. kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp311-cp311-macosx_15_0_arm64.whl +0 -0
  28. kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp312-cp312-macosx_15_0_arm64.whl +0 -0
  29. kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp313-cp313-macosx_15_0_arm64.whl +0 -0
  30. kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp314-cp314-macosx_15_0_arm64.whl +0 -0
  31. {kernelforge-0.1.17 → kernelforge-0.1.18}/.clang-format +0 -0
  32. {kernelforge-0.1.17 → kernelforge-0.1.18}/.clang-tidy +0 -0
  33. {kernelforge-0.1.17 → kernelforge-0.1.18}/.gitignore +0 -0
  34. {kernelforge-0.1.17 → kernelforge-0.1.18}/CMakeLists.txt +0 -0
  35. {kernelforge-0.1.17 → kernelforge-0.1.18}/LICENSE +0 -0
  36. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/desc_hess-gauss.ipynb +0 -0
  37. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/desc_hess.ipynb +0 -0
  38. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/ethanol.sdf +0 -0
  39. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/fchl_example.ipynb +0 -0
  40. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/fchl_hess.ipynb +0 -0
  41. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/qm7_example.ipynb +0 -0
  42. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/regression_ethanol-Copy1.ipynb +0 -0
  43. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/regression_forces.ipynb +0 -0
  44. {kernelforge-0.1.17 → kernelforge-0.1.18}/examples/sgdml.ipynb +0 -0
  45. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/__init__.py +0 -0
  46. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/_cholesky.pyi +0 -0
  47. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/_fchl19.pyi +0 -0
  48. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/_invdist.pyi +0 -0
  49. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/_kernels.pyi +0 -0
  50. {kernelforge-0.1.17 → kernelforge-0.1.18}/python/kernelforge/py.typed +0 -0
  51. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/aligned_alloc64.hpp +0 -0
  52. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/bindings.cpp +0 -0
  53. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/bindings_cholesky.cpp +0 -0
  54. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/bindings_fchl19.cpp +0 -0
  55. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/bindings_kernels.cpp +0 -0
  56. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/cholesky.cpp +0 -0
  57. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/cholesky.hpp +0 -0
  58. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/constants.hpp +0 -0
  59. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/fchl19_representation.cpp +0 -0
  60. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/fchl19_representation.hpp +0 -0
  61. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/invdist.cpp +0 -0
  62. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/invdist.hpp +0 -0
  63. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/invdist_bindings.cpp +0 -0
  64. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/kernels.cpp +0 -0
  65. {kernelforge-0.1.17 → kernelforge-0.1.18}/src/kernels.hpp +0 -0
  66. {kernelforge-0.1.17 → kernelforge-0.1.18}/tests/test_cholesky.py +0 -0
@@ -0,0 +1,54 @@
1
+ # Dependabot configuration for automated dependency updates
2
+ # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3
+
4
+ version: 2
5
+
6
+ updates:
7
+ # Python dependencies
8
+ - package-ecosystem: "pip"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "weekly"
12
+ day: "monday"
13
+ time: "09:00"
14
+ open-pull-requests-limit: 5
15
+ labels:
16
+ - "dependencies"
17
+ - "python"
18
+ commit-message:
19
+ prefix: "deps"
20
+ include: "scope"
21
+ groups:
22
+ # Group dev dependencies together
23
+ dev-dependencies:
24
+ patterns:
25
+ - "ruff"
26
+ - "mypy"
27
+ - "pytest*"
28
+ - "pre-commit"
29
+ update-types:
30
+ - "minor"
31
+ - "patch"
32
+
33
+ # GitHub Actions
34
+ - package-ecosystem: "github-actions"
35
+ directory: "/"
36
+ schedule:
37
+ interval: "weekly"
38
+ day: "monday"
39
+ time: "09:00"
40
+ open-pull-requests-limit: 3
41
+ labels:
42
+ - "dependencies"
43
+ - "github-actions"
44
+ commit-message:
45
+ prefix: "ci"
46
+ include: "scope"
47
+ groups:
48
+ # Group all GitHub Actions updates
49
+ actions:
50
+ patterns:
51
+ - "*"
52
+ update-types:
53
+ - "minor"
54
+ - "patch"
@@ -5,6 +5,13 @@ on:
5
5
  branches: [ master ]
6
6
  pull_request:
7
7
 
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
8
15
  jobs:
9
16
  test:
10
17
  name: pytest (${{ matrix.os }} / py${{ matrix.python-version }})
@@ -16,7 +23,7 @@ jobs:
16
23
  python-version: ["3.14"]
17
24
 
18
25
  steps:
19
- - uses: actions/checkout@v4
26
+ - uses: actions/checkout@v6
20
27
 
21
28
  - name: Install OpenMP (macOS only)
22
29
  if: runner.os == 'macOS'
@@ -28,6 +35,8 @@ jobs:
28
35
 
29
36
  - name: Set up uv
30
37
  uses: astral-sh/setup-uv@v7
38
+ with:
39
+ enable-cache: true
31
40
 
32
41
  - name: Build & install (macOS only)
33
42
  if: runner.os == 'macOS'
@@ -6,6 +6,9 @@ on:
6
6
  pull_request:
7
7
  branches: [master]
8
8
 
9
+ permissions:
10
+ contents: read
11
+
9
12
  concurrency:
10
13
  group: ${{ github.workflow }}-${{ github.ref }}
11
14
  cancel-in-progress: true
@@ -15,28 +18,26 @@ jobs:
15
18
  runs-on: ubuntu-latest
16
19
 
17
20
  steps:
18
- - uses: actions/checkout@v4
21
+ - uses: actions/checkout@v6
19
22
 
20
23
  - name: Set up uv
21
24
  uses: astral-sh/setup-uv@v7
25
+ with:
26
+ enable-cache: true
22
27
 
23
28
  - name: Set up Python
24
- uses: actions/setup-python@v5
29
+ uses: actions/setup-python@v6
25
30
  with:
26
31
  python-version: "3.12"
27
32
 
28
33
  - name: Install code quality tools
29
- run: uv pip install --system black isort ruff mypy numpy pytest
30
-
31
- - name: Check formatting with Black
32
- run: black --check python/ tests/
34
+ run: uv pip install --system ruff mypy numpy pytest
33
35
 
34
- - name: Check import sorting with isort
35
- run: isort --check-only python/ tests/
36
+ - name: Check formatting with Ruff
37
+ run: ruff format --check python/ tests/
36
38
 
37
39
  - name: Lint with Ruff
38
40
  run: ruff check python/ tests/
39
41
 
40
42
  - name: Type check with mypy
41
43
  run: mypy python/ tests/
42
- continue-on-error: true # Don't fail CI on mypy errors initially
@@ -6,6 +6,13 @@ on:
6
6
  types: [published]
7
7
  workflow_dispatch:
8
8
 
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}
14
+ cancel-in-progress: true
15
+
9
16
  jobs:
10
17
  build-wheels:
11
18
  runs-on: ${{ matrix.os }}
@@ -15,11 +22,11 @@ jobs:
15
22
  os: [ubuntu-22.04, macos-latest]
16
23
 
17
24
  steps:
18
- - uses: actions/checkout@v4
25
+ - uses: actions/checkout@v6
19
26
  with:
20
27
  fetch-depth: 0 # Fetch all history for setuptools-scm to detect version from tags
21
28
 
22
- - uses: actions/setup-python@v5
29
+ - uses: actions/setup-python@v6
23
30
  with:
24
31
  python-version: "3.12" # host Python, cibuildwheel makes all others
25
32
 
@@ -77,7 +84,7 @@ jobs:
77
84
  run: python -m pip install build && python -m build --sdist -o wheelhouse
78
85
 
79
86
  - name: Upload artifacts
80
- uses: actions/upload-artifact@v4
87
+ uses: actions/upload-artifact@v6
81
88
  with:
82
89
  name: wheels-${{ runner.os }}
83
90
  path: wheelhouse/*
@@ -88,12 +95,12 @@ jobs:
88
95
  permissions:
89
96
  id-token: write
90
97
  steps:
91
- - uses: actions/download-artifact@v4
98
+ - uses: actions/download-artifact@v7
92
99
  with:
93
100
  name: wheels-Linux
94
101
  path: dist
95
102
 
96
- - uses: actions/download-artifact@v4
103
+ - uses: actions/download-artifact@v7
97
104
  with:
98
105
  name: wheels-macOS
99
106
  path: dist
@@ -104,6 +111,6 @@ jobs:
104
111
  find dist -name '*.whl' -exec cp {} dist/flat/ \;
105
112
  find dist -name '*.tar.gz' -exec cp {} dist/flat/ \;
106
113
 
107
- - uses: pypa/gh-action-pypi-publish@v1.11.0
114
+ - uses: pypa/gh-action-pypi-publish@v1.13.0
108
115
  with:
109
116
  packages-dir: dist/flat
@@ -12,22 +12,12 @@ repos:
12
12
  - id: check-merge-conflict
13
13
  - id: mixed-line-ending
14
14
 
15
- - repo: https://github.com/psf/black
16
- rev: 24.2.0
17
- hooks:
18
- - id: black
19
-
20
- - repo: https://github.com/pycqa/isort
21
- rev: 5.13.2
22
- hooks:
23
- - id: isort
24
- args: ["--profile", "black"]
25
-
26
15
  - repo: https://github.com/astral-sh/ruff-pre-commit
27
- rev: v0.3.0
16
+ rev: v0.15.1
28
17
  hooks:
29
18
  - id: ruff
30
19
  args: [--fix, --exit-non-zero-on-fix]
20
+ - id: ruff-format
31
21
 
32
22
  - repo: https://github.com/pre-commit/mirrors-clang-format
33
23
  rev: v19.1.6
@@ -15,8 +15,8 @@ environment:
15
15
  .PHONY: format lint typecheck check
16
16
 
17
17
  format:
18
- black python/ tests/
19
- isort python/ tests/
18
+ ruff format python/ tests/
19
+ ruff check --select I --fix python/ tests/
20
20
 
21
21
  lint:
22
22
  ruff check python/ tests/
@@ -1,5 +1,46 @@
1
+ Metadata-Version: 2.2
2
+ Name: kernelforge
3
+ Version: 0.1.18
4
+ Summary: Optimized Kernels for ML
5
+ Author: Anders Christensen
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: MacOS
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: Implementation :: CPython
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
+ Project-URL: Homepage, https://github.com/andersx/kernelforge
22
+ Project-URL: Issues, https://github.com/andersx/kernelforge/issues
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: numpy>=2.00
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest>=8; extra == "test"
27
+ Requires-Dist: pytest-xdist; extra == "test"
28
+ Requires-Dist: pytest-timeout; extra == "test"
29
+ Provides-Extra: dev
30
+ Requires-Dist: ruff>=0.8.0; extra == "dev"
31
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
32
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
33
+ Description-Content-Type: text/markdown
34
+
1
35
  # KernelForge - Optimized Kernels for ML
2
36
 
37
+ [![CI](https://github.com/andersx/kernelforge/actions/workflows/ci.yml/badge.svg)](https://github.com/andersx/kernelforge/actions/workflows/ci.yml)
38
+ [![Code Quality](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml/badge.svg)](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml)
39
+ [![PyPI version](https://badge.fury.io/py/kernelforge.svg)](https://pypi.org/project/kernelforge/)
40
+ [![Python Versions](https://img.shields.io/pypi/pyversions/kernelforge?logo=python&logoColor=white)](https://pypi.org/project/kernelforge/)
41
+ [![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos-lightgrey)](https://github.com/andersx/kernelforge)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+
3
44
  I really only care about writing optimized kernel code, so this project will be completed as I find additional time... XD
4
45
 
5
46
  I'm reviving this project to finish an old project using random Fourier features for kernel ML.
@@ -7,38 +48,76 @@ I'm reviving this project to finish an old project using random Fourier features
7
48
 
8
49
  # Installation
9
50
 
51
+ ## Quick Start (Recommended)
52
+
53
+ For most users, install from PyPI:
54
+
10
55
  ```bash
11
- conda env create -f environments/environment-dev.yml
12
- pip install -e .
13
- pytest -v -s
56
+ pip install kernelforge
14
57
  ```
15
- ## PyPI installation
16
58
 
17
- Install the requirements (e.g. the conda env above) and install from PyPI.
18
- This should work on both MacOS and Linux/PC:
59
+ This installs pre-compiled wheels with optimized BLAS libraries:
60
+ - **Linux**: OpenBLAS
61
+ - **macOS**: Apple Accelerate framework
62
+
63
+ **Requirements**: Python 3.10+
64
+
65
+ ## Development Installation
66
+
67
+ ### Linux
19
68
 
20
69
  ```bash
21
- conda activate kernelforge-dev
22
- pip install kernelforge
70
+ # Create virtual environment with uv
71
+ uv venv
72
+ source .venv/bin/activate
73
+
74
+ # Install in editable mode with test dependencies
75
+ make install-linux
76
+
77
+ # Or manually:
78
+ CMAKE_ARGS="-DKF_USE_NATIVE=ON" uv pip install -e .[test] --verbose
23
79
  ```
24
- This will install pre-compiled wheels with gfortran and linked againts OpenBLAS on Linux and Accelerate on MacOS.
25
- If you want to use MKL or other BLAS/LAPACK libraries, you need to compile from source, see below.
26
80
 
81
+ ### macOS
27
82
 
28
- ## Intel compilers and MKL
83
+ macOS requires Homebrew LLVM for OpenMP support:
29
84
 
30
- It is 2025 so you can `sudo apt get install intel-basekit` on Linux/PC to get the compilers and MKL.
31
- Then set up the environment variables:
32
85
  ```bash
33
- source /opt/intel/oneapi/setvars.sh
86
+ # Install dependencies
87
+ brew install llvm libomp
88
+
89
+ # Create virtual environment
90
+ uv venv
91
+ source .venv/bin/activate
92
+
93
+ # Install in editable mode
94
+ make install-macos
95
+
96
+ # Or manually:
97
+ CMAKE_ARGS="-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ -DKF_USE_NATIVE=ON" uv pip install -e .[test] --verbose
34
98
  ```
35
- In this case, MKL will be autodetected by some CMake magic. If you additionally want to compile with Intel compilers, you can set the environment variables when running `pip install`:
99
+
100
+ **Note**: The `-DKF_USE_NATIVE=ON` flag enables `-march=native`/`-mcpu=native` optimizations for maximum performance on your specific CPU.
101
+
102
+ ## Advanced: Custom BLAS/LAPACK Libraries
103
+
104
+ ### Intel MKL (Linux)
105
+
36
106
  ```bash
37
- CC=icx CXX=icpx FC=ifx make install
107
+ # Install Intel oneAPI Base Toolkit
108
+ sudo apt install intel-basekit
109
+
110
+ # Set up environment
111
+ source /opt/intel/oneapi/setvars.sh
112
+
113
+ # Install (MKL will be auto-detected by CMake)
114
+ uv pip install -e .[test] --verbose
115
+
116
+ # Optional: Use Intel compilers
117
+ CC=icx CXX=icpx uv pip install -e .[test] --verbose
38
118
  ```
39
119
 
40
- In my experience, GCC/G++/GFortran with OpenBLAS is very similar to Intel API alternatives in terms of performance, perhaps even better.
41
- On MacOS, GNU compilers with `-framework Accelerate` for BLAS/LAPACK is the default and is very fast on M-series macs.
120
+ **Note**: In practice, GCC/G++ with OpenBLAS performs similarly to (or better than) Intel compilers with MKL. On macOS, LLVM with Accelerate framework is highly optimized for Apple Silicon.
42
121
 
43
122
  ## Timings
44
123
  I've rewritten a few of the kernels from the original QML code completely in C++.
@@ -1,28 +1,12 @@
1
- Metadata-Version: 2.2
2
- Name: kernelforge
3
- Version: 0.1.17
4
- Summary: Optimized Kernels for ML
5
- Author: Anders Christensen
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/andersx/kernelforge
8
- Project-URL: Issues, https://github.com/andersx/kernelforge/issues
9
- Requires-Python: >=3.10
10
- Requires-Dist: numpy>=2.00
11
- Provides-Extra: test
12
- Requires-Dist: pytest>=8; extra == "test"
13
- Requires-Dist: pytest-xdist; extra == "test"
14
- Requires-Dist: pytest-cov; extra == "test"
15
- Requires-Dist: pytest-timeout; extra == "test"
16
- Provides-Extra: dev
17
- Requires-Dist: black>=24.0.0; extra == "dev"
18
- Requires-Dist: isort>=5.13.0; extra == "dev"
19
- Requires-Dist: ruff>=0.3.0; extra == "dev"
20
- Requires-Dist: mypy>=1.9.0; extra == "dev"
21
- Requires-Dist: pre-commit>=3.6.0; extra == "dev"
22
- Description-Content-Type: text/markdown
23
-
24
1
  # KernelForge - Optimized Kernels for ML
25
2
 
3
+ [![CI](https://github.com/andersx/kernelforge/actions/workflows/ci.yml/badge.svg)](https://github.com/andersx/kernelforge/actions/workflows/ci.yml)
4
+ [![Code Quality](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml/badge.svg)](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml)
5
+ [![PyPI version](https://badge.fury.io/py/kernelforge.svg)](https://pypi.org/project/kernelforge/)
6
+ [![Python Versions](https://img.shields.io/pypi/pyversions/kernelforge?logo=python&logoColor=white)](https://pypi.org/project/kernelforge/)
7
+ [![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos-lightgrey)](https://github.com/andersx/kernelforge)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
26
10
  I really only care about writing optimized kernel code, so this project will be completed as I find additional time... XD
27
11
 
28
12
  I'm reviving this project to finish an old project using random Fourier features for kernel ML.
@@ -30,38 +14,76 @@ I'm reviving this project to finish an old project using random Fourier features
30
14
 
31
15
  # Installation
32
16
 
17
+ ## Quick Start (Recommended)
18
+
19
+ For most users, install from PyPI:
20
+
33
21
  ```bash
34
- conda env create -f environments/environment-dev.yml
35
- pip install -e .
36
- pytest -v -s
22
+ pip install kernelforge
37
23
  ```
38
- ## PyPI installation
39
24
 
40
- Install the requirements (e.g. the conda env above) and install from PyPI.
41
- This should work on both MacOS and Linux/PC:
25
+ This installs pre-compiled wheels with optimized BLAS libraries:
26
+ - **Linux**: OpenBLAS
27
+ - **macOS**: Apple Accelerate framework
28
+
29
+ **Requirements**: Python 3.10+
30
+
31
+ ## Development Installation
32
+
33
+ ### Linux
42
34
 
43
35
  ```bash
44
- conda activate kernelforge-dev
45
- pip install kernelforge
36
+ # Create virtual environment with uv
37
+ uv venv
38
+ source .venv/bin/activate
39
+
40
+ # Install in editable mode with test dependencies
41
+ make install-linux
42
+
43
+ # Or manually:
44
+ CMAKE_ARGS="-DKF_USE_NATIVE=ON" uv pip install -e .[test] --verbose
46
45
  ```
47
- This will install pre-compiled wheels with gfortran and linked againts OpenBLAS on Linux and Accelerate on MacOS.
48
- If you want to use MKL or other BLAS/LAPACK libraries, you need to compile from source, see below.
49
46
 
47
+ ### macOS
50
48
 
51
- ## Intel compilers and MKL
49
+ macOS requires Homebrew LLVM for OpenMP support:
52
50
 
53
- It is 2025 so you can `sudo apt get install intel-basekit` on Linux/PC to get the compilers and MKL.
54
- Then set up the environment variables:
55
51
  ```bash
56
- source /opt/intel/oneapi/setvars.sh
52
+ # Install dependencies
53
+ brew install llvm libomp
54
+
55
+ # Create virtual environment
56
+ uv venv
57
+ source .venv/bin/activate
58
+
59
+ # Install in editable mode
60
+ make install-macos
61
+
62
+ # Or manually:
63
+ CMAKE_ARGS="-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ -DKF_USE_NATIVE=ON" uv pip install -e .[test] --verbose
57
64
  ```
58
- In this case, MKL will be autodetected by some CMake magic. If you additionally want to compile with Intel compilers, you can set the environment variables when running `pip install`:
65
+
66
+ **Note**: The `-DKF_USE_NATIVE=ON` flag enables `-march=native`/`-mcpu=native` optimizations for maximum performance on your specific CPU.
67
+
68
+ ## Advanced: Custom BLAS/LAPACK Libraries
69
+
70
+ ### Intel MKL (Linux)
71
+
59
72
  ```bash
60
- CC=icx CXX=icpx FC=ifx make install
73
+ # Install Intel oneAPI Base Toolkit
74
+ sudo apt install intel-basekit
75
+
76
+ # Set up environment
77
+ source /opt/intel/oneapi/setvars.sh
78
+
79
+ # Install (MKL will be auto-detected by CMake)
80
+ uv pip install -e .[test] --verbose
81
+
82
+ # Optional: Use Intel compilers
83
+ CC=icx CXX=icpx uv pip install -e .[test] --verbose
61
84
  ```
62
85
 
63
- In my experience, GCC/G++/GFortran with OpenBLAS is very similar to Intel API alternatives in terms of performance, perhaps even better.
64
- On MacOS, GNU compilers with `-framework Accelerate` for BLAS/LAPACK is the default and is very fast on M-series macs.
86
+ **Note**: In practice, GCC/G++ with OpenBLAS performs similarly to (or better than) Intel compilers with MKL. On macOS, LLVM with Accelerate framework is highly optimized for Apple Silicon.
65
87
 
66
88
  ## Timings
67
89
  I've rewritten a few of the kernels from the original QML code completely in C++.
@@ -10,16 +10,30 @@ readme = "README.md"
10
10
  license = {text = "MIT"}
11
11
  authors = [{name = "Anders Christensen"}]
12
12
  requires-python = ">=3.10"
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: MacOS",
18
+ "Operating System :: POSIX :: Linux",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Programming Language :: Python :: Implementation :: CPython",
26
+ "Topic :: Scientific/Engineering",
27
+ "Topic :: Scientific/Engineering :: Chemistry",
28
+ ]
13
29
  dependencies = [
14
30
  "numpy>=2.00",
15
31
  ]
16
32
 
17
33
  [project.optional-dependencies]
18
- test = ["pytest>=8", "pytest-xdist", "pytest-cov", "pytest-timeout"]
34
+ test = ["pytest>=8", "pytest-xdist", "pytest-timeout"]
19
35
  dev = [
20
- "black>=24.0.0",
21
- "isort>=5.13.0",
22
- "ruff>=0.3.0",
36
+ "ruff>=0.8.0",
23
37
  "mypy>=1.9.0",
24
38
  "pre-commit>=3.6.0",
25
39
  ]
@@ -54,22 +68,30 @@ local_scheme = "no-local-version"
54
68
  tag_regex = "^v?(?P<version>[0-9.]+)$"
55
69
  fallback_version = "0.0.0.dev0"
56
70
 
57
- [tool.black]
71
+ [tool.ruff]
58
72
  line-length = 100
73
+ target-version = "py310"
59
74
 
60
- [tool.isort]
61
- profile = "black"
62
- line_length = 100
75
+ [tool.ruff.lint]
76
+ select = [
77
+ "E", # pycodestyle errors
78
+ "F", # pyflakes
79
+ "I", # isort (import sorting)
80
+ "N", # pep8-naming
81
+ "UP", # pyupgrade (modern Python syntax)
82
+ "B", # flake8-bugbear
83
+ "C4", # flake8-comprehensions
84
+ "SIM", # flake8-simplify
85
+ ]
63
86
 
64
- [tool.ruff]
65
- line-length = 100
87
+ [tool.ruff.lint.isort]
88
+ known-first-party = ["kernelforge"]
66
89
 
67
90
  [tool.ruff.lint.per-file-ignores]
68
- "tests/*" = ["N803", "N806"]
69
- "python/kernelforge/cli.py" = ["N806", "F841"]
91
+ "tests/*" = ["N803", "N806", "B017", "B023", "C408"] # Allow test-specific patterns
92
+ "python/kernelforge/cli.py" = ["N806", "F841", "B905"] # Allow zip without strict in benchmarks
70
93
  "python/kernelforge/*.pyi" = ["N802", "N803", "N806"]
71
-
94
+ #
72
95
  [tool.mypy]
73
- python_version = "3.11"
74
- disallow_untyped_defs = true
75
- check_untyped_defs = true
96
+ python_version = "3.10"
97
+ strict = true