kernelforge 0.1.2__tar.gz → 0.1.8__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.
@@ -1,5 +1,5 @@
1
1
  # .github/workflows/release.yml
2
- name: Build & Publish
2
+ name: "Build & Publish"
3
3
 
4
4
  on:
5
5
  release:
@@ -12,7 +12,7 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- os: [ubuntu-22.04] # macos-14]
15
+ os: [ubuntu-22.04, macos-latest]
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v4
@@ -21,12 +21,24 @@ jobs:
21
21
  with:
22
22
  python-version: "3.12" # host Python, cibuildwheel makes all others
23
23
 
24
+ - name: Clean wheelhouse and build artifacts
25
+ run: |
26
+ rm -rf dist/ build/ *.egg-info wheelhouse/
27
+
28
+ - name: Install gfortran (macOS)
29
+ if: runner.os == 'macOS'
30
+ run: brew install gcc libomp
31
+
32
+ - name: Check gfortran version
33
+ if: runner.os == 'macOS'
34
+ run: which gfortran-14
35
+
24
36
  - name: Install cibuildwheel
25
37
  run: python -m pip install cibuildwheel==2.*
26
38
 
27
39
  - name: Build wheels
28
40
  env:
29
- CIBW_BUILD: "cp312-*"
41
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
30
42
  CIBW_SKIP: "pp* *-musllinux_* cp*-manylinux_i686"
31
43
  CIBW_TEST_COMMAND: "pytest -q {project}/tests -k 'not slow' -x"
32
44
  CIBW_TEST_EXTRAS: "test"
@@ -47,6 +59,15 @@ jobs:
47
59
  CMAKE_ARGS
48
60
  OPENBLAS_NUM_THREADS
49
61
  OMP_NUM_THREADS
62
+ CIBW_ENVIRONMENT_MACOS: >
63
+ MACOSX_DEPLOYMENT_TARGET=15.0
64
+ CMAKE_ARGS="-DBLAS_VENDOR=Apple"
65
+ FC=gfortran-14
66
+ CIBW_ENVIRONMENT_PASS_MACOS: >
67
+ MACOSX_DEPLOYMENT_TARGET
68
+ CMAKE_ARGS
69
+ FC
70
+ CIBW_ARCHS_MACOS: arm64
50
71
  run: python -m cibuildwheel --output-dir wheelhouse
51
72
 
52
73
  - name: Build sdist
@@ -55,20 +76,32 @@ jobs:
55
76
  - name: Upload artifacts
56
77
  uses: actions/upload-artifact@v4
57
78
  with:
58
- name: wheels
79
+ name: wheels-${{ runner.os }}
59
80
  path: wheelhouse/*
60
-
61
81
  publish:
62
82
  needs: build-wheels
63
83
  runs-on: ubuntu-22.04
64
- if: github.event_name == 'release'
84
+ if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
65
85
  steps:
66
86
  - uses: actions/download-artifact@v4
67
87
  with:
68
- name: wheels
88
+ name: wheels-Linux
69
89
  path: dist
90
+
91
+ - uses: actions/download-artifact@v4
92
+ with:
93
+ name: wheels-macOS
94
+ path: dist
95
+
96
+ - name: Flatten artifacts
97
+ run: |
98
+ mkdir -p dist/flat
99
+ find dist -name '*.whl' -exec cp {} dist/flat/ \;
100
+ find dist -name '*.tar.gz' -exec cp {} dist/flat/ \;
101
+
70
102
  - uses: pypa/gh-action-pypi-publish@v1.11.0
71
103
  with:
72
104
  user: __token__
73
105
  password: ${{ secrets.PYPI_API_TOKEN }}
106
+ packages-dir: dist/flat
74
107
 
@@ -0,0 +1,8 @@
1
+ install:
2
+ pip install -e .[test] --verbose
3
+
4
+ test:
5
+ pytest
6
+
7
+ environment:
8
+ conda env create -f environments/environment-dev.yaml
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.2
2
+ Name: kernelforge
3
+ Version: 0.1.8
4
+ Summary: Optimzed Kernels for ML
5
+ Author: Anders Christensen
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/youruser/kernelforge
8
+ Project-URL: Issues, https://github.com/youruser/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
+ Description-Content-Type: text/markdown
17
+
18
+ # KernelForge - Optimized Lernels for ML
19
+
20
+ I really only care about writing optimized kernel code, so this project will be completed as I find additional time... XD
21
+
22
+ I'm reviving this project to finish an old project using random Fourier features for kernel ML.
23
+
24
+
25
+ # Installation
26
+
27
+ ```bash
28
+ conda env create -f environments/environment-dev.yml
29
+ pip install -e .
30
+ pytest -v -s
31
+ ```
32
+ ## PyPI installation
33
+
34
+ Install the requirements (e.g. the conda env above) and install from PyPI.
35
+ This should work on both MacOS and Linux/PC:
36
+
37
+ ```bash
38
+ conda activate kernelforge-dev
39
+ pip install kernelforge
40
+ ```
41
+ This will install pre-compiled wheels with gfortran and linked againts OpenBLAS on Linux and Accelerate on MacOS.
42
+ If you want to use MKL or other BLAS/LAPACK libraries, you need to compile from source, see below.
43
+
44
+
45
+ ## Intel compilers and MKL
46
+
47
+ It is 2025 so you can `sudo apt get install intel-basekit` on Linux/PC to get the compilers and MKL.
48
+ Then set up the environment variables:
49
+ ```bash
50
+ source /opt/intel/oneapi/setvars.sh
51
+ ```
52
+ 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`:
53
+ ```bash
54
+ CC=icx CXX=icpx FC=ifx make install
55
+ ```
56
+
57
+ ## Timings
58
+
59
+ | Function Name | QML [s] | Kernelforge [s] |
60
+ |:---------------|------------:|--------------------:|
61
+ | Upper triangle Gaussian kernel 16K x 16K| 1.82 | 0.64 |
62
+ | Kernel Jacobian | | |
63
+ | Kernel Hessian | | |
64
+
65
+ ## TODO list
66
+
67
+ The goal is to remove pain-points of existing QML libraries
68
+ - Improved use of BLAS/LAPACK routines
69
+ - Removal of Fortran dependencies
70
+ - No Fortran-ordered arrays
71
+ - No Fortran compilers needed
72
+ - Simplified build system
73
+ - No cooked F2PY/Meson build system
74
+ - Simplified entrypoints that are compatible with RDKit, ASE, Scikit-learn, etc.
75
+ - A few high-level functions that do the most common tasks efficiently and correctly
76
+
77
+ #### Todos:
78
+ - Houskeeping:
79
+ - [x] Pybind11 bindings and CMake build system
80
+ - [x] Setup CI with GitHub Actions
81
+ - [ ] Rewrite existing kernels to C++ (no Fortran)
82
+ - [x] Setup GHA to build PyPI wheels
83
+ - [x] Test Linux build matrices
84
+ - [ ] Test MacOS build matrices
85
+ - [ ] Test Windows build matrices
86
+ - [ ] Add build for all Python version >=3.11
87
+ - Ensure correct linking with optimized BLAS/LAPACK libraries:
88
+ - [x] OpenBLAS (Linux) <- also used in wheels
89
+ - [x] AMD BLIS and libflame (Linux)
90
+ - [x] MKL (Linux)
91
+ - [x] Accelerated (MacOS)
92
+ - Add kernels:
93
+ - [x] Gaussian kernel
94
+ - [ ] Jacobian/gradient kernel
95
+ - [ ] Optimized Jacobian kernel for single inference
96
+ - [ ] Hessian kernel
97
+ - [ ] GDML-like kernel
98
+ - Add random Fourier features kernel code
99
+ - [ ] RFF kernel
100
+ - [ ] RFF gradient kernel
101
+ - [ ] RFF chunked DSYRK kernel
102
+ - The same as above, just for Hadamard features when I find the time
103
+ - Add standard solvers:
104
+ - [ ] Cholesky
105
+ - [ ] QR and/or SVD for non-square matrices
106
+ - Add moleular descriptors with derivatives:
107
+ - [ ] Coulomb matrix
108
+ - [ ] FCHL19 + derivatives
109
+ - [ ] GDML-like inverse-distance matrix + derivatives
110
+ - [ ] Plan structure for saving models for inference as `.npz` files
111
+ #### Stretch goals:
112
+ - [ ] Plan RDKit interface
113
+ - [ ] Plan Scikit-learn interface
114
+ - [ ] Plan ASE interface
@@ -0,0 +1,97 @@
1
+ # KernelForge - Optimized Lernels for ML
2
+
3
+ I really only care about writing optimized kernel code, so this project will be completed as I find additional time... XD
4
+
5
+ I'm reviving this project to finish an old project using random Fourier features for kernel ML.
6
+
7
+
8
+ # Installation
9
+
10
+ ```bash
11
+ conda env create -f environments/environment-dev.yml
12
+ pip install -e .
13
+ pytest -v -s
14
+ ```
15
+ ## PyPI installation
16
+
17
+ Install the requirements (e.g. the conda env above) and install from PyPI.
18
+ This should work on both MacOS and Linux/PC:
19
+
20
+ ```bash
21
+ conda activate kernelforge-dev
22
+ pip install kernelforge
23
+ ```
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
+
27
+
28
+ ## Intel compilers and MKL
29
+
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
+ ```bash
33
+ source /opt/intel/oneapi/setvars.sh
34
+ ```
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`:
36
+ ```bash
37
+ CC=icx CXX=icpx FC=ifx make install
38
+ ```
39
+
40
+ ## Timings
41
+
42
+ | Function Name | QML [s] | Kernelforge [s] |
43
+ |:---------------|------------:|--------------------:|
44
+ | Upper triangle Gaussian kernel 16K x 16K| 1.82 | 0.64 |
45
+ | Kernel Jacobian | | |
46
+ | Kernel Hessian | | |
47
+
48
+ ## TODO list
49
+
50
+ The goal is to remove pain-points of existing QML libraries
51
+ - Improved use of BLAS/LAPACK routines
52
+ - Removal of Fortran dependencies
53
+ - No Fortran-ordered arrays
54
+ - No Fortran compilers needed
55
+ - Simplified build system
56
+ - No cooked F2PY/Meson build system
57
+ - Simplified entrypoints that are compatible with RDKit, ASE, Scikit-learn, etc.
58
+ - A few high-level functions that do the most common tasks efficiently and correctly
59
+
60
+ #### Todos:
61
+ - Houskeeping:
62
+ - [x] Pybind11 bindings and CMake build system
63
+ - [x] Setup CI with GitHub Actions
64
+ - [ ] Rewrite existing kernels to C++ (no Fortran)
65
+ - [x] Setup GHA to build PyPI wheels
66
+ - [x] Test Linux build matrices
67
+ - [ ] Test MacOS build matrices
68
+ - [ ] Test Windows build matrices
69
+ - [ ] Add build for all Python version >=3.11
70
+ - Ensure correct linking with optimized BLAS/LAPACK libraries:
71
+ - [x] OpenBLAS (Linux) <- also used in wheels
72
+ - [x] AMD BLIS and libflame (Linux)
73
+ - [x] MKL (Linux)
74
+ - [x] Accelerated (MacOS)
75
+ - Add kernels:
76
+ - [x] Gaussian kernel
77
+ - [ ] Jacobian/gradient kernel
78
+ - [ ] Optimized Jacobian kernel for single inference
79
+ - [ ] Hessian kernel
80
+ - [ ] GDML-like kernel
81
+ - Add random Fourier features kernel code
82
+ - [ ] RFF kernel
83
+ - [ ] RFF gradient kernel
84
+ - [ ] RFF chunked DSYRK kernel
85
+ - The same as above, just for Hadamard features when I find the time
86
+ - Add standard solvers:
87
+ - [ ] Cholesky
88
+ - [ ] QR and/or SVD for non-square matrices
89
+ - Add moleular descriptors with derivatives:
90
+ - [ ] Coulomb matrix
91
+ - [ ] FCHL19 + derivatives
92
+ - [ ] GDML-like inverse-distance matrix + derivatives
93
+ - [ ] Plan structure for saving models for inference as `.npz` files
94
+ #### Stretch goals:
95
+ - [ ] Plan RDKit interface
96
+ - [ ] Plan Scikit-learn interface
97
+ - [ ] Plan ASE interface
@@ -0,0 +1,29 @@
1
+ name: kernelforge-dev
2
+ channels:
3
+ - conda-forge
4
+ - defaults
5
+ dependencies:
6
+ - python=3.12
7
+ - pip
8
+ - pandas
9
+ - mamba
10
+ - numpy
11
+ - plotly
12
+ - matplotlib
13
+ - jupyterlab
14
+ - ipykernel
15
+ - ipywidgets
16
+ - nbconvert
17
+ - tqdm
18
+ - black
19
+ - isort
20
+ - scipy
21
+ - scikit-learn
22
+ - seaborn
23
+ - flake8
24
+ - mypy
25
+ - pre-commit
26
+ - pytest
27
+ - pytest-cov
28
+ - pytest-xdist
29
+ - pytest-timeout
@@ -4,14 +4,14 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "kernelforge"
7
- version = "0.1.2"
8
- description = "Fortran kernels with C ABI and Python bindings (CMake/skbuild/pybind11)"
7
+ version = "0.1.8"
8
+ description = "Optimzed Kernels for ML"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
11
11
  authors = [{name = "Anders Christensen"}]
12
- requires-python = ">=3.9"
12
+ requires-python = ">=3.10"
13
13
  dependencies = [
14
- "numpy>=2.00", # required at runtime
14
+ "numpy>=2.00",
15
15
  ]
16
16
 
17
17
  [project.optional-dependencies]
@@ -23,14 +23,10 @@ Issues = "https://github.com/youruser/kernelforge/issues"
23
23
 
24
24
  [tool.scikit-build]
25
25
  wheel.expand-macos-universal-tags = true
26
- wheel.py-api = "py3"
27
26
  cmake.build-type = "Release"
28
27
  cmake.verbose = true
29
28
  wheel.packages = ["python/kernelforge"]
30
29
 
31
- # optional: put compiled outputs under build/{tag}/ to avoid clashes
32
- # build-dir = "build/{wheel_tag}"
33
-
34
30
  [tool.scikit-build.cmake.define]
35
31
  CMAKE_VERBOSE_MAKEFILE = "ON"
36
32
  CMAKE_BUILD_TYPE = "Release"
@@ -1,5 +0,0 @@
1
- install:
2
- pip install -e .[test] --verbose
3
-
4
- test:
5
- pytest
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: kernelforge
3
- Version: 0.1.2
4
- Summary: Fortran kernels with C ABI and Python bindings (CMake/skbuild/pybind11)
5
- Author: Anders Christensen
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/youruser/kernelforge
8
- Project-URL: Issues, https://github.com/youruser/kernelforge/issues
9
- Requires-Python: >=3.9
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
- Description-Content-Type: text/markdown
17
-
18
- # kernelforge
19
- Optimized kernels for ML
20
-
21
- - Without using F2PY or Meson
22
-
23
- # Installation
24
-
25
- ```bash
26
- pip install -e .
27
- pytest -v -s
28
- ```
29
-
30
- ## Intel compilers and MKL
31
-
32
- GNU compilers will be used by default. If you want to use Intel compilers and MKL, you can set the environment variables:
33
-
34
- ```bash
35
- source /opt/intel/oneapi/setvars.sh
36
- ```
37
- In this case, MKL will be autodetected and used. If you additionally want to compile with Intel compilers, you can set the environment variables when running `pip install`:
38
-
39
- ```bash
40
- CC=icx CXX=icpx FC=ifx make install
41
- ```
@@ -1,24 +0,0 @@
1
- # kernelforge
2
- Optimized kernels for ML
3
-
4
- - Without using F2PY or Meson
5
-
6
- # Installation
7
-
8
- ```bash
9
- pip install -e .
10
- pytest -v -s
11
- ```
12
-
13
- ## Intel compilers and MKL
14
-
15
- GNU compilers will be used by default. If you want to use Intel compilers and MKL, you can set the environment variables:
16
-
17
- ```bash
18
- source /opt/intel/oneapi/setvars.sh
19
- ```
20
- In this case, MKL will be autodetected and used. If you additionally want to compile with Intel compilers, you can set the environment variables when running `pip install`:
21
-
22
- ```bash
23
- CC=icx CXX=icpx FC=ifx make install
24
- ```
File without changes
File without changes
File without changes
File without changes
File without changes