kernelforge 0.1.16__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.
- kernelforge-0.1.18/.github/dependabot.yml +54 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/.github/workflows/ci.yml +12 -3
- kernelforge-0.1.18/.github/workflows/code-quality.yml +43 -0
- kernelforge-0.1.16/.github/workflows/release.yaml → kernelforge-0.1.18/.github/workflows/release.yml +15 -8
- {kernelforge-0.1.16 → kernelforge-0.1.18}/.pre-commit-config.yaml +2 -12
- {kernelforge-0.1.16 → kernelforge-0.1.18}/Makefile +2 -2
- kernelforge-0.1.16/README.md → kernelforge-0.1.18/PKG-INFO +97 -18
- kernelforge-0.1.16/PKG-INFO → kernelforge-0.1.18/README.md +63 -41
- kernelforge-0.1.18/pyproject.toml +97 -0
- kernelforge-0.1.18/python/kernelforge/_cholesky.pyi +21 -0
- kernelforge-0.1.18/python/kernelforge/_fchl19.pyi +81 -0
- kernelforge-0.1.18/python/kernelforge/_invdist.pyi +10 -0
- kernelforge-0.1.18/python/kernelforge/_kernels.pyi +29 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/python/kernelforge/cli.py +19 -17
- kernelforge-0.1.18/python/kernelforge/py.typed +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_cholesky.py +5 -5
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_fchl19.py +68 -62
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_fchl19_gradient.py +15 -5
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_hessian.py +21 -7
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_invdist.py +4 -4
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_jacobian.py +12 -8
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_kernels.py +11 -40
- {kernelforge-0.1.16 → kernelforge-0.1.18}/tests/test_rfp.py +16 -7
- kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp310-cp310-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp311-cp311-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp312-cp312-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp313-cp313-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.18/wheelhouse/kernelforge-0.1.18-cp314-cp314-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.16/.github/workflows/code-quality.yml +0 -41
- kernelforge-0.1.16/environments/environment-dev-macos.yaml +0 -33
- kernelforge-0.1.16/environments/environment-dev.yaml +0 -30
- kernelforge-0.1.16/pyproject.toml +0 -130
- kernelforge-0.1.16/pytest.ini +0 -2
- kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp311-cp311-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp312-cp312-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp313-cp313-macosx_15_0_arm64.whl +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/.clang-format +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/.clang-tidy +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/.gitignore +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/CMakeLists.txt +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/LICENSE +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/desc_hess-gauss.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/desc_hess.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/ethanol.sdf +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/fchl_example.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/fchl_hess.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/qm7_example.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/regression_ethanol-Copy1.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/regression_forces.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/examples/sgdml.ipynb +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/python/kernelforge/__init__.py +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/aligned_alloc64.hpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/bindings.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/bindings_cholesky.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/bindings_fchl19.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/bindings_kernels.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/cholesky.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/cholesky.hpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/constants.hpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/fchl19_representation.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/fchl19_representation.hpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/invdist.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/invdist.hpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/invdist_bindings.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/kernels.cpp +0 -0
- {kernelforge-0.1.16 → kernelforge-0.1.18}/src/kernels.hpp +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@
|
|
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'
|
|
@@ -37,7 +46,7 @@ jobs:
|
|
|
37
46
|
CMAKE_PREFIX_PATH: /opt/homebrew/opt/libomp
|
|
38
47
|
run: |
|
|
39
48
|
uv sync --dev --all-extras
|
|
40
|
-
uv pip install scikit-build-core pybind11
|
|
49
|
+
uv pip install scikit-build-core pybind11 setuptools-scm
|
|
41
50
|
CMAKE_ARGS="-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
|
|
42
51
|
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++" \
|
|
43
52
|
uv pip install -e .[test] --no-build-isolation
|
|
@@ -49,7 +58,7 @@ jobs:
|
|
|
49
58
|
OPENBLAS_NUM_THREADS: "1"
|
|
50
59
|
run: |
|
|
51
60
|
uv sync --dev --all-extras
|
|
52
|
-
uv pip install scikit-build-core pybind11
|
|
61
|
+
uv pip install scikit-build-core pybind11 setuptools-scm
|
|
53
62
|
uv pip install -e .[test] --no-build-isolation
|
|
54
63
|
|
|
55
64
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
code-quality:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- name: Set up uv
|
|
24
|
+
uses: astral-sh/setup-uv@v7
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Install code quality tools
|
|
34
|
+
run: uv pip install --system ruff mypy numpy pytest
|
|
35
|
+
|
|
36
|
+
- name: Check formatting with Ruff
|
|
37
|
+
run: ruff format --check python/ tests/
|
|
38
|
+
|
|
39
|
+
- name: Lint with Ruff
|
|
40
|
+
run: ruff check python/ tests/
|
|
41
|
+
|
|
42
|
+
- name: Type check with mypy
|
|
43
|
+
run: mypy python/ tests/
|
kernelforge-0.1.16/.github/workflows/release.yaml → kernelforge-0.1.18/.github/workflows/release.yml
RENAMED
|
@@ -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@
|
|
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@
|
|
29
|
+
- uses: actions/setup-python@v6
|
|
23
30
|
with:
|
|
24
31
|
python-version: "3.12" # host Python, cibuildwheel makes all others
|
|
25
32
|
|
|
@@ -32,12 +39,12 @@ jobs:
|
|
|
32
39
|
run: brew install gcc libomp
|
|
33
40
|
|
|
34
41
|
- name: Install cibuildwheel
|
|
35
|
-
run: python -m pip install cibuildwheel==
|
|
42
|
+
run: python -m pip install cibuildwheel==3.3.1
|
|
36
43
|
|
|
37
44
|
- name: Build wheels
|
|
38
45
|
env:
|
|
39
46
|
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
|
|
40
|
-
CIBW_SKIP: "pp* *-musllinux_* cp*-manylinux_i686"
|
|
47
|
+
CIBW_SKIP: "pp* *-musllinux_* cp*-manylinux_i686 cp31?t-*"
|
|
41
48
|
CIBW_TEST_COMMAND: "pytest -q {project}/tests -k 'not slow' -x"
|
|
42
49
|
CIBW_TEST_EXTRAS: "test"
|
|
43
50
|
CIBW_ENVIRONMENT: >
|
|
@@ -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@
|
|
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@
|
|
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@
|
|
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.
|
|
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.
|
|
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
|
|
@@ -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
|
+
[](https://github.com/andersx/kernelforge/actions/workflows/ci.yml)
|
|
38
|
+
[](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml)
|
|
39
|
+
[](https://pypi.org/project/kernelforge/)
|
|
40
|
+
[](https://pypi.org/project/kernelforge/)
|
|
41
|
+
[](https://github.com/andersx/kernelforge)
|
|
42
|
+
[](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
|
-
|
|
12
|
-
pip install -e .
|
|
13
|
-
pytest -v -s
|
|
56
|
+
pip install kernelforge
|
|
14
57
|
```
|
|
15
|
-
## PyPI installation
|
|
16
58
|
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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.16
|
|
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.11
|
|
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
|
+
[](https://github.com/andersx/kernelforge/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/andersx/kernelforge/actions/workflows/code-quality.yml)
|
|
5
|
+
[](https://pypi.org/project/kernelforge/)
|
|
6
|
+
[](https://pypi.org/project/kernelforge/)
|
|
7
|
+
[](https://github.com/andersx/kernelforge)
|
|
8
|
+
[](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
|
-
|
|
35
|
-
pip install -e .
|
|
36
|
-
pytest -v -s
|
|
22
|
+
pip install kernelforge
|
|
37
23
|
```
|
|
38
|
-
## PyPI installation
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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++.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core>=0.9", "setuptools-scm>=8.0", "pybind11", "setuptools", "wheel"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kernelforge"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Optimized Kernels for ML"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "Anders Christensen"}]
|
|
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
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"numpy>=2.00",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
test = ["pytest>=8", "pytest-xdist", "pytest-timeout"]
|
|
35
|
+
dev = [
|
|
36
|
+
"ruff>=0.8.0",
|
|
37
|
+
"mypy>=1.9.0",
|
|
38
|
+
"pre-commit>=3.6.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
qmlbench = "kernelforge.cli:main"
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/andersx/kernelforge"
|
|
46
|
+
Issues = "https://github.com/andersx/kernelforge/issues"
|
|
47
|
+
|
|
48
|
+
[tool.scikit-build]
|
|
49
|
+
wheel.expand-macos-universal-tags = true
|
|
50
|
+
cmake.build-type = "Release"
|
|
51
|
+
build.verbose = true
|
|
52
|
+
wheel.packages = ["python/kernelforge"]
|
|
53
|
+
|
|
54
|
+
[tool.scikit-build.metadata.version]
|
|
55
|
+
provider = "scikit_build_core.metadata.setuptools_scm"
|
|
56
|
+
|
|
57
|
+
[tool.scikit-build.cmake.define]
|
|
58
|
+
CMAKE_VERBOSE_MAKEFILE = "ON"
|
|
59
|
+
CMAKE_BUILD_TYPE = "Release"
|
|
60
|
+
|
|
61
|
+
[tool.uv.extra-build-dependencies]
|
|
62
|
+
kernelforge = ["scikit_build_core", "setuptools-scm>=8.0"]
|
|
63
|
+
|
|
64
|
+
[tool.setuptools_scm]
|
|
65
|
+
# Use git tags with 'v' prefix (e.g., v0.1.14)
|
|
66
|
+
version_scheme = "python-simplified-semver"
|
|
67
|
+
local_scheme = "no-local-version"
|
|
68
|
+
tag_regex = "^v?(?P<version>[0-9.]+)$"
|
|
69
|
+
fallback_version = "0.0.0.dev0"
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 100
|
|
73
|
+
target-version = "py310"
|
|
74
|
+
|
|
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
|
+
]
|
|
86
|
+
|
|
87
|
+
[tool.ruff.lint.isort]
|
|
88
|
+
known-first-party = ["kernelforge"]
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint.per-file-ignores]
|
|
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
|
|
93
|
+
"python/kernelforge/*.pyi" = ["N802", "N803", "N806"]
|
|
94
|
+
#
|
|
95
|
+
[tool.mypy]
|
|
96
|
+
python_version = "3.10"
|
|
97
|
+
strict = true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Type stubs for _cholesky C++ extension module."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy.typing import NDArray
|
|
5
|
+
|
|
6
|
+
def solve_cholesky(
|
|
7
|
+
K: NDArray[np.float64], y: NDArray[np.float64], regularize: float = 0.0
|
|
8
|
+
) -> NDArray[np.float64]: ...
|
|
9
|
+
def solve_cholesky_rfp_L(
|
|
10
|
+
K_arf: NDArray[np.float64],
|
|
11
|
+
y: NDArray[np.float64],
|
|
12
|
+
regularize: float = 0.0,
|
|
13
|
+
uplo: str = "U",
|
|
14
|
+
transr: str = "N",
|
|
15
|
+
) -> NDArray[np.float64]: ...
|
|
16
|
+
def full_to_rfp(
|
|
17
|
+
A: NDArray[np.float64], uplo: str = "U", transr: str = "N"
|
|
18
|
+
) -> NDArray[np.float64]: ...
|
|
19
|
+
def rfp_to_full(
|
|
20
|
+
ARF: NDArray[np.float64], n: int, uplo: str = "U", transr: str = "N"
|
|
21
|
+
) -> NDArray[np.float64]: ...
|