kernelforge 0.1.14__tar.gz → 0.1.17__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.17/.clang-format +84 -0
- kernelforge-0.1.17/.clang-tidy +60 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/.github/workflows/ci.yml +2 -2
- kernelforge-0.1.17/.github/workflows/code-quality.yml +42 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/.github/workflows/release.yaml +4 -3
- {kernelforge-0.1.14 → kernelforge-0.1.17}/.gitignore +2 -2
- kernelforge-0.1.17/.pre-commit-config.yaml +46 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/CMakeLists.txt +47 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/Makefile +19 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/PKG-INFO +7 -1
- {kernelforge-0.1.14 → kernelforge-0.1.17}/environments/environment-dev-macos.yaml +2 -2
- kernelforge-0.1.17/pyproject.toml +75 -0
- kernelforge-0.1.17/python/kernelforge/__init__.py +8 -0
- kernelforge-0.1.17/python/kernelforge/_cholesky.pyi +21 -0
- kernelforge-0.1.17/python/kernelforge/_fchl19.pyi +81 -0
- kernelforge-0.1.17/python/kernelforge/_invdist.pyi +10 -0
- kernelforge-0.1.17/python/kernelforge/_kernels.pyi +29 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/python/kernelforge/cli.py +20 -24
- kernelforge-0.1.17/src/aligned_alloc64.hpp +34 -0
- kernelforge-0.1.17/src/bindings.cpp +99 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/src/bindings_cholesky.cpp +74 -75
- kernelforge-0.1.17/src/bindings_fchl19.cpp +861 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/src/bindings_kernels.cpp +115 -134
- kernelforge-0.1.17/src/cholesky.cpp +182 -0
- kernelforge-0.1.17/src/cholesky.hpp +17 -0
- kernelforge-0.1.17/src/constants.hpp +22 -0
- kernelforge-0.1.17/src/fchl19_representation.cpp +2149 -0
- kernelforge-0.1.17/src/fchl19_representation.hpp +114 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/src/invdist.cpp +14 -20
- {kernelforge-0.1.14 → kernelforge-0.1.17}/src/invdist.hpp +5 -12
- {kernelforge-0.1.14 → kernelforge-0.1.17}/src/invdist_bindings.cpp +24 -32
- kernelforge-0.1.17/src/kernels.cpp +495 -0
- kernelforge-0.1.17/src/kernels.hpp +27 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_cholesky.py +10 -17
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_fchl19.py +149 -89
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_fchl19_gradient.py +6 -7
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_hessian.py +22 -20
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_invdist.py +5 -6
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_jacobian.py +8 -9
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_kernels.py +20 -43
- {kernelforge-0.1.14 → kernelforge-0.1.17}/tests/test_rfp.py +11 -11
- kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp310-cp310-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp311-cp311-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp312-cp312-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp313-cp313-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.17/wheelhouse/kernelforge-0.1.17-cp314-cp314-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.14/pyproject.toml +0 -38
- kernelforge-0.1.14/src/aligned_alloc64.hpp +0 -31
- kernelforge-0.1.14/src/bindings.cpp +0 -114
- kernelforge-0.1.14/src/bindings_fchl19.cpp +0 -912
- kernelforge-0.1.14/src/cholesky.cpp +0 -232
- kernelforge-0.1.14/src/cholesky.hpp +0 -22
- kernelforge-0.1.14/src/fchl19_representation.cpp +0 -1984
- kernelforge-0.1.14/src/fchl19_representation.hpp +0 -173
- kernelforge-0.1.14/src/kernels.cpp +0 -1287
- kernelforge-0.1.14/src/kernels.hpp +0 -55
- kernelforge-0.1.14/wheelhouse/kernelforge-0.1.14-cp310-cp310-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.14/wheelhouse/kernelforge-0.1.14-cp311-cp311-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.14/wheelhouse/kernelforge-0.1.14-cp312-cp312-macosx_15_0_arm64.whl +0 -0
- kernelforge-0.1.14/wheelhouse/kernelforge-0.1.14-cp313-cp313-macosx_15_0_arm64.whl +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/LICENSE +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/README.md +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/environments/environment-dev.yaml +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/desc_hess-gauss.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/desc_hess.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/ethanol.sdf +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/fchl_example.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/fchl_hess.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/qm7_example.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/regression_ethanol-Copy1.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/regression_forces.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/examples/sgdml.ipynb +0 -0
- {kernelforge-0.1.14 → kernelforge-0.1.17}/pytest.ini +0 -0
- /kernelforge-0.1.14/python/kernelforge/__init__.py → /kernelforge-0.1.17/python/kernelforge/py.typed +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
# KernelForge C++ Code Style Configuration
|
|
3
|
+
# Based on Google style with customizations
|
|
4
|
+
|
|
5
|
+
BasedOnStyle: Google
|
|
6
|
+
|
|
7
|
+
# Core formatting preferences
|
|
8
|
+
IndentWidth: 4
|
|
9
|
+
ColumnLimit: 100
|
|
10
|
+
DerivePointerAlignment: false
|
|
11
|
+
PointerAlignment: Right # int *ptr style
|
|
12
|
+
UseTab: Never
|
|
13
|
+
|
|
14
|
+
# Indentation
|
|
15
|
+
AccessModifierOffset: -4
|
|
16
|
+
IndentCaseLabels: true
|
|
17
|
+
NamespaceIndentation: None
|
|
18
|
+
IndentPPDirectives: BeforeHash
|
|
19
|
+
|
|
20
|
+
# Alignment
|
|
21
|
+
AlignAfterOpenBracket: Align
|
|
22
|
+
AlignConsecutiveAssignments: None
|
|
23
|
+
AlignConsecutiveDeclarations: None
|
|
24
|
+
AlignOperands: Align
|
|
25
|
+
AlignTrailingComments: true
|
|
26
|
+
|
|
27
|
+
# Line breaks
|
|
28
|
+
AllowShortFunctionsOnASingleLine: Inline
|
|
29
|
+
AllowShortIfStatementsOnASingleLine: Never
|
|
30
|
+
AllowShortLoopsOnASingleLine: false
|
|
31
|
+
AllowShortBlocksOnASingleLine: Never
|
|
32
|
+
AllowShortCaseLabelsOnASingleLine: false
|
|
33
|
+
AlwaysBreakAfterReturnType: None
|
|
34
|
+
AlwaysBreakBeforeMultilineStrings: false
|
|
35
|
+
|
|
36
|
+
# Braces (K&R style)
|
|
37
|
+
BreakBeforeBraces: Attach
|
|
38
|
+
BraceWrapping:
|
|
39
|
+
AfterClass: false
|
|
40
|
+
AfterControlStatement: Never
|
|
41
|
+
AfterEnum: false
|
|
42
|
+
AfterFunction: false
|
|
43
|
+
AfterNamespace: false
|
|
44
|
+
AfterStruct: false
|
|
45
|
+
AfterUnion: false
|
|
46
|
+
BeforeCatch: false
|
|
47
|
+
BeforeElse: false
|
|
48
|
+
|
|
49
|
+
# Spaces
|
|
50
|
+
SpaceAfterCStyleCast: false
|
|
51
|
+
SpaceBeforeAssignmentOperators: true
|
|
52
|
+
SpaceBeforeParens: ControlStatements
|
|
53
|
+
SpacesInParentheses: false
|
|
54
|
+
SpacesInAngles: Never
|
|
55
|
+
SpacesInSquareBrackets: false
|
|
56
|
+
|
|
57
|
+
# Includes
|
|
58
|
+
SortIncludes: true
|
|
59
|
+
IncludeBlocks: Regroup
|
|
60
|
+
IncludeCategories:
|
|
61
|
+
# Own headers first
|
|
62
|
+
- Regex: '^".*\.h(pp)?"$'
|
|
63
|
+
Priority: 1
|
|
64
|
+
# C system headers
|
|
65
|
+
- Regex: '^<[a-z_]+\.h>$'
|
|
66
|
+
Priority: 2
|
|
67
|
+
# C++ standard library
|
|
68
|
+
- Regex: '^<[a-z_]+>$'
|
|
69
|
+
Priority: 3
|
|
70
|
+
# Third-party libraries (BLAS, OpenMP, pybind11)
|
|
71
|
+
- Regex: '^<(cblas|omp|pybind11|Accelerate).*>$'
|
|
72
|
+
Priority: 4
|
|
73
|
+
# Everything else
|
|
74
|
+
- Regex: '.*'
|
|
75
|
+
Priority: 5
|
|
76
|
+
|
|
77
|
+
# Language
|
|
78
|
+
Language: Cpp
|
|
79
|
+
Standard: c++17
|
|
80
|
+
|
|
81
|
+
# Other
|
|
82
|
+
MaxEmptyLinesToKeep: 1
|
|
83
|
+
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
84
|
+
ReflowComments: true
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
# KernelForge C++ Static Analysis Configuration
|
|
3
|
+
# Moderate checks for code quality without being overly restrictive
|
|
4
|
+
|
|
5
|
+
Checks: >
|
|
6
|
+
bugprone-*,
|
|
7
|
+
clang-analyzer-*,
|
|
8
|
+
cppcoreguidelines-*,
|
|
9
|
+
modernize-*,
|
|
10
|
+
performance-*,
|
|
11
|
+
readability-*,
|
|
12
|
+
-bugprone-easily-swappable-parameters,
|
|
13
|
+
-bugprone-implicit-widening-of-multiplication-result,
|
|
14
|
+
-modernize-use-trailing-return-type,
|
|
15
|
+
-modernize-avoid-c-arrays,
|
|
16
|
+
-readability-identifier-length,
|
|
17
|
+
-readability-function-cognitive-complexity,
|
|
18
|
+
-readability-magic-numbers,
|
|
19
|
+
-cppcoreguidelines-avoid-magic-numbers,
|
|
20
|
+
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
|
21
|
+
-cppcoreguidelines-pro-type-reinterpret-cast,
|
|
22
|
+
-cppcoreguidelines-pro-type-const-cast,
|
|
23
|
+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
|
24
|
+
-cppcoreguidelines-avoid-const-or-ref-data-members,
|
|
25
|
+
-cppcoreguidelines-owning-memory,
|
|
26
|
+
-cppcoreguidelines-no-malloc,
|
|
27
|
+
-performance-no-int-to-ptr
|
|
28
|
+
|
|
29
|
+
CheckOptions:
|
|
30
|
+
# Naming conventions - snake_case for most things
|
|
31
|
+
- key: readability-identifier-naming.NamespaceCase
|
|
32
|
+
value: lower_case
|
|
33
|
+
- key: readability-identifier-naming.ClassCase
|
|
34
|
+
value: CamelCase
|
|
35
|
+
- key: readability-identifier-naming.StructCase
|
|
36
|
+
value: CamelCase
|
|
37
|
+
- key: readability-identifier-naming.FunctionCase
|
|
38
|
+
value: snake_case
|
|
39
|
+
- key: readability-identifier-naming.VariableCase
|
|
40
|
+
value: snake_case
|
|
41
|
+
- key: readability-identifier-naming.ParameterCase
|
|
42
|
+
value: snake_case
|
|
43
|
+
- key: readability-identifier-naming.ConstantCase
|
|
44
|
+
value: UPPER_CASE
|
|
45
|
+
- key: readability-identifier-naming.EnumConstantCase
|
|
46
|
+
value: UPPER_CASE
|
|
47
|
+
- key: readability-identifier-naming.GlobalConstantCase
|
|
48
|
+
value: UPPER_CASE
|
|
49
|
+
|
|
50
|
+
# Make some checks less aggressive
|
|
51
|
+
- key: readability-function-size.LineThreshold
|
|
52
|
+
value: '200'
|
|
53
|
+
- key: readability-function-size.StatementThreshold
|
|
54
|
+
value: '150'
|
|
55
|
+
- key: cppcoreguidelines-avoid-do-while.MaxStatements
|
|
56
|
+
value: '10'
|
|
57
|
+
|
|
58
|
+
WarningsAsErrors: ''
|
|
59
|
+
HeaderFilterRegex: 'src/.*\.(h|hpp)$'
|
|
60
|
+
FormatStyle: file # Use .clang-format
|
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
CMAKE_PREFIX_PATH: /opt/homebrew/opt/libomp
|
|
38
38
|
run: |
|
|
39
39
|
uv sync --dev --all-extras
|
|
40
|
-
uv pip install scikit-build-core pybind11
|
|
40
|
+
uv pip install scikit-build-core pybind11 setuptools-scm
|
|
41
41
|
CMAKE_ARGS="-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
|
|
42
42
|
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++" \
|
|
43
43
|
uv pip install -e .[test] --no-build-isolation
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
OPENBLAS_NUM_THREADS: "1"
|
|
50
50
|
run: |
|
|
51
51
|
uv sync --dev --all-extras
|
|
52
|
-
uv pip install scikit-build-core pybind11
|
|
52
|
+
uv pip install scikit-build-core pybind11 setuptools-scm
|
|
53
53
|
uv pip install -e .[test] --no-build-isolation
|
|
54
54
|
|
|
55
55
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
code-quality:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up uv
|
|
21
|
+
uses: astral-sh/setup-uv@v7
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- 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/
|
|
33
|
+
|
|
34
|
+
- name: Check import sorting with isort
|
|
35
|
+
run: isort --check-only python/ tests/
|
|
36
|
+
|
|
37
|
+
- name: Lint with Ruff
|
|
38
|
+
run: ruff check python/ tests/
|
|
39
|
+
|
|
40
|
+
- name: Type check with mypy
|
|
41
|
+
run: mypy python/ tests/
|
|
42
|
+
continue-on-error: true # Don't fail CI on mypy errors initially
|
|
@@ -16,6 +16,8 @@ jobs:
|
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0 # Fetch all history for setuptools-scm to detect version from tags
|
|
19
21
|
|
|
20
22
|
- uses: actions/setup-python@v5
|
|
21
23
|
with:
|
|
@@ -30,12 +32,12 @@ jobs:
|
|
|
30
32
|
run: brew install gcc libomp
|
|
31
33
|
|
|
32
34
|
- name: Install cibuildwheel
|
|
33
|
-
run: python -m pip install cibuildwheel==
|
|
35
|
+
run: python -m pip install cibuildwheel==3.3.1
|
|
34
36
|
|
|
35
37
|
- name: Build wheels
|
|
36
38
|
env:
|
|
37
39
|
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
|
|
38
|
-
CIBW_SKIP: "pp* *-musllinux_* cp*-manylinux_i686"
|
|
40
|
+
CIBW_SKIP: "pp* *-musllinux_* cp*-manylinux_i686 cp31?t-*"
|
|
39
41
|
CIBW_TEST_COMMAND: "pytest -q {project}/tests -k 'not slow' -x"
|
|
40
42
|
CIBW_TEST_EXTRAS: "test"
|
|
41
43
|
CIBW_ENVIRONMENT: >
|
|
@@ -105,4 +107,3 @@ jobs:
|
|
|
105
107
|
- uses: pypa/gh-action-pypi-publish@v1.11.0
|
|
106
108
|
with:
|
|
107
109
|
packages-dir: dist/flat
|
|
108
|
-
|
|
@@ -185,9 +185,9 @@ cython_debug/
|
|
|
185
185
|
.abstra/
|
|
186
186
|
|
|
187
187
|
# Visual Studio Code
|
|
188
|
-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
188
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
189
189
|
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
190
|
-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
190
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
191
191
|
# you could uncomment the following to ignore the entire vscode folder
|
|
192
192
|
# .vscode/
|
|
193
193
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Pre-commit hooks for code quality
|
|
2
|
+
# See https://pre-commit.com for more information
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v4.5.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
- id: check-merge-conflict
|
|
13
|
+
- id: mixed-line-ending
|
|
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
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
27
|
+
rev: v0.3.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: ruff
|
|
30
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
31
|
+
|
|
32
|
+
- repo: https://github.com/pre-commit/mirrors-clang-format
|
|
33
|
+
rev: v19.1.6
|
|
34
|
+
hooks:
|
|
35
|
+
- id: clang-format
|
|
36
|
+
types_or: [c++, c]
|
|
37
|
+
files: ^src/.*\.(cpp|hpp|h|cc|cxx)$
|
|
38
|
+
|
|
39
|
+
# Mypy disabled in pre-commit (run manually with: pre-commit run mypy --all-files --hook-stage manual)
|
|
40
|
+
# - repo: https://github.com/pre-commit/mirrors-mypy
|
|
41
|
+
# rev: v1.9.0
|
|
42
|
+
# hooks:
|
|
43
|
+
# - id: mypy
|
|
44
|
+
# additional_dependencies: [numpy>=2.0, types-psutil]
|
|
45
|
+
# args: [--ignore-missing-imports]
|
|
46
|
+
# files: ^(python|tests|benchmark)/.*\.py$
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.18)
|
|
2
2
|
project(kernelforge LANGUAGES C CXX)
|
|
3
3
|
|
|
4
|
+
# C++ standard
|
|
5
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
6
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
7
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
8
|
+
|
|
4
9
|
# Platform tweaks
|
|
5
10
|
if(APPLE)
|
|
6
11
|
|
|
@@ -136,3 +141,45 @@ install(TARGETS _kernels _invdist _fchl19 _cholesky
|
|
|
136
141
|
RUNTIME DESTINATION kernelforge # Windows (.pyd)
|
|
137
142
|
)
|
|
138
143
|
install(FILES python/kernelforge/__init__.py DESTINATION kernelforge)
|
|
144
|
+
|
|
145
|
+
# ---- Development targets -----------------------------------------------------
|
|
146
|
+
# Collect all C++ source files
|
|
147
|
+
file(GLOB_RECURSE KF_CXX_SOURCES
|
|
148
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
|
|
149
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp
|
|
150
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# clang-format target
|
|
154
|
+
find_program(CLANG_FORMAT_EXE NAMES clang-format)
|
|
155
|
+
if(CLANG_FORMAT_EXE)
|
|
156
|
+
add_custom_target(format
|
|
157
|
+
COMMAND ${CLANG_FORMAT_EXE} -i ${KF_CXX_SOURCES}
|
|
158
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
159
|
+
COMMENT "Running clang-format on all C++ source files"
|
|
160
|
+
VERBATIM
|
|
161
|
+
)
|
|
162
|
+
else()
|
|
163
|
+
add_custom_target(format
|
|
164
|
+
COMMAND ${CMAKE_COMMAND} -E echo "clang-format not found. Please install it to use this target."
|
|
165
|
+
COMMENT "clang-format not available"
|
|
166
|
+
)
|
|
167
|
+
endif()
|
|
168
|
+
|
|
169
|
+
# clang-tidy target
|
|
170
|
+
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
|
|
171
|
+
if(CLANG_TIDY_EXE)
|
|
172
|
+
add_custom_target(tidy
|
|
173
|
+
COMMAND ${CLANG_TIDY_EXE} ${KF_CXX_SOURCES} --
|
|
174
|
+
-std=c++17
|
|
175
|
+
-I${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
176
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
177
|
+
COMMENT "Running clang-tidy on all C++ source files"
|
|
178
|
+
VERBATIM
|
|
179
|
+
)
|
|
180
|
+
else()
|
|
181
|
+
add_custom_target(tidy
|
|
182
|
+
COMMAND ${CMAKE_COMMAND} -E echo "clang-tidy not found. Please install it to use this target."
|
|
183
|
+
COMMENT "clang-tidy not available"
|
|
184
|
+
)
|
|
185
|
+
endif()
|
|
@@ -10,3 +10,22 @@ test:
|
|
|
10
10
|
environment:
|
|
11
11
|
uv venv --python 3.14
|
|
12
12
|
uv pip install scikit-build-core pybind11
|
|
13
|
+
|
|
14
|
+
# Code quality targets
|
|
15
|
+
.PHONY: format lint typecheck check
|
|
16
|
+
|
|
17
|
+
format:
|
|
18
|
+
black python/ tests/
|
|
19
|
+
isort python/ tests/
|
|
20
|
+
|
|
21
|
+
lint:
|
|
22
|
+
ruff check python/ tests/
|
|
23
|
+
|
|
24
|
+
lint-fix:
|
|
25
|
+
ruff check --fix python/ tests/
|
|
26
|
+
|
|
27
|
+
typecheck:
|
|
28
|
+
mypy python/ tests/
|
|
29
|
+
|
|
30
|
+
check: format lint typecheck
|
|
31
|
+
@echo "All code quality checks passed!"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: kernelforge
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.17
|
|
4
4
|
Summary: Optimized Kernels for ML
|
|
5
5
|
Author: Anders Christensen
|
|
6
6
|
License: MIT
|
|
@@ -13,6 +13,12 @@ Requires-Dist: pytest>=8; extra == "test"
|
|
|
13
13
|
Requires-Dist: pytest-xdist; extra == "test"
|
|
14
14
|
Requires-Dist: pytest-cov; extra == "test"
|
|
15
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"
|
|
16
22
|
Description-Content-Type: text/markdown
|
|
17
23
|
|
|
18
24
|
# KernelForge - Optimized Kernels for ML
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
dependencies = [
|
|
14
|
+
"numpy>=2.00",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
test = ["pytest>=8", "pytest-xdist", "pytest-cov", "pytest-timeout"]
|
|
19
|
+
dev = [
|
|
20
|
+
"black>=24.0.0",
|
|
21
|
+
"isort>=5.13.0",
|
|
22
|
+
"ruff>=0.3.0",
|
|
23
|
+
"mypy>=1.9.0",
|
|
24
|
+
"pre-commit>=3.6.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
qmlbench = "kernelforge.cli:main"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/andersx/kernelforge"
|
|
32
|
+
Issues = "https://github.com/andersx/kernelforge/issues"
|
|
33
|
+
|
|
34
|
+
[tool.scikit-build]
|
|
35
|
+
wheel.expand-macos-universal-tags = true
|
|
36
|
+
cmake.build-type = "Release"
|
|
37
|
+
build.verbose = true
|
|
38
|
+
wheel.packages = ["python/kernelforge"]
|
|
39
|
+
|
|
40
|
+
[tool.scikit-build.metadata.version]
|
|
41
|
+
provider = "scikit_build_core.metadata.setuptools_scm"
|
|
42
|
+
|
|
43
|
+
[tool.scikit-build.cmake.define]
|
|
44
|
+
CMAKE_VERBOSE_MAKEFILE = "ON"
|
|
45
|
+
CMAKE_BUILD_TYPE = "Release"
|
|
46
|
+
|
|
47
|
+
[tool.uv.extra-build-dependencies]
|
|
48
|
+
kernelforge = ["scikit_build_core", "setuptools-scm>=8.0"]
|
|
49
|
+
|
|
50
|
+
[tool.setuptools_scm]
|
|
51
|
+
# Use git tags with 'v' prefix (e.g., v0.1.14)
|
|
52
|
+
version_scheme = "python-simplified-semver"
|
|
53
|
+
local_scheme = "no-local-version"
|
|
54
|
+
tag_regex = "^v?(?P<version>[0-9.]+)$"
|
|
55
|
+
fallback_version = "0.0.0.dev0"
|
|
56
|
+
|
|
57
|
+
[tool.black]
|
|
58
|
+
line-length = 100
|
|
59
|
+
|
|
60
|
+
[tool.isort]
|
|
61
|
+
profile = "black"
|
|
62
|
+
line_length = 100
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 100
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint.per-file-ignores]
|
|
68
|
+
"tests/*" = ["N803", "N806"]
|
|
69
|
+
"python/kernelforge/cli.py" = ["N806", "F841"]
|
|
70
|
+
"python/kernelforge/*.pyi" = ["N802", "N803", "N806"]
|
|
71
|
+
|
|
72
|
+
[tool.mypy]
|
|
73
|
+
python_version = "3.11"
|
|
74
|
+
disallow_untyped_defs = true
|
|
75
|
+
check_untyped_defs = 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]: ...
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Type stubs for _fchl19 C++ extension module."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy.typing import NDArray
|
|
5
|
+
|
|
6
|
+
def compute_rep_size(nelements: int, nbasis2: int, nbasis3: int, nabasis: int) -> int: ...
|
|
7
|
+
def generate_fchl_acsf(
|
|
8
|
+
coords: NDArray[np.float64],
|
|
9
|
+
nuclear_z: NDArray[np.int32],
|
|
10
|
+
elements: list[int] = [1, 6, 7, 8, 16],
|
|
11
|
+
nRs2: int = 24,
|
|
12
|
+
nRs3: int = 20,
|
|
13
|
+
nFourier: int = 1,
|
|
14
|
+
eta2: float = 0.32,
|
|
15
|
+
eta3: float = 2.7,
|
|
16
|
+
zeta: float = ...,
|
|
17
|
+
rcut: float = 8.0,
|
|
18
|
+
acut: float = 8.0,
|
|
19
|
+
two_body_decay: float = 1.8,
|
|
20
|
+
three_body_decay: float = 0.57,
|
|
21
|
+
three_body_weight: float = 13.4,
|
|
22
|
+
) -> NDArray[np.float64]: ...
|
|
23
|
+
def generate_fchl_acsf_and_gradients(
|
|
24
|
+
coords: NDArray[np.float64],
|
|
25
|
+
nuclear_z: NDArray[np.int32],
|
|
26
|
+
elements: list[int] = [1, 6, 7, 8, 16],
|
|
27
|
+
nRs2: int = 24,
|
|
28
|
+
nRs3: int = 20,
|
|
29
|
+
nFourier: int = 1,
|
|
30
|
+
eta2: float = 0.32,
|
|
31
|
+
eta3: float = 2.7,
|
|
32
|
+
zeta: float = ...,
|
|
33
|
+
rcut: float = 8.0,
|
|
34
|
+
acut: float = 8.0,
|
|
35
|
+
two_body_decay: float = 1.8,
|
|
36
|
+
three_body_decay: float = 0.57,
|
|
37
|
+
three_body_weight: float = 13.4,
|
|
38
|
+
) -> tuple[NDArray[np.float64], NDArray[np.float64]]: ...
|
|
39
|
+
def flocal_kernel_symm(
|
|
40
|
+
X: NDArray[np.float64], Q: NDArray[np.int32], N: NDArray[np.int32], sigma: float
|
|
41
|
+
) -> NDArray[np.float64]: ...
|
|
42
|
+
def flocal_kernel_symm_rfp(
|
|
43
|
+
X: NDArray[np.float64], Q: NDArray[np.int32], N: NDArray[np.int32], sigma: float
|
|
44
|
+
) -> NDArray[np.float64]: ...
|
|
45
|
+
def flocal_kernel(
|
|
46
|
+
X1: NDArray[np.float64],
|
|
47
|
+
X2: NDArray[np.float64],
|
|
48
|
+
Q1: NDArray[np.int32],
|
|
49
|
+
Q2: NDArray[np.int32],
|
|
50
|
+
N1: NDArray[np.int32],
|
|
51
|
+
N2: NDArray[np.int32],
|
|
52
|
+
sigma: float,
|
|
53
|
+
) -> NDArray[np.float64]: ...
|
|
54
|
+
def fgdml_kernel_symm(
|
|
55
|
+
X: NDArray[np.float64],
|
|
56
|
+
dX: NDArray[np.float64],
|
|
57
|
+
Q: NDArray[np.int32],
|
|
58
|
+
N: NDArray[np.int32],
|
|
59
|
+
sigma: float,
|
|
60
|
+
) -> NDArray[np.float64]: ...
|
|
61
|
+
def fgdml_kernel(
|
|
62
|
+
X1: NDArray[np.float64],
|
|
63
|
+
X2: NDArray[np.float64],
|
|
64
|
+
dX1: NDArray[np.float64],
|
|
65
|
+
dX2: NDArray[np.float64],
|
|
66
|
+
Q1: NDArray[np.int32],
|
|
67
|
+
Q2: NDArray[np.int32],
|
|
68
|
+
N1: NDArray[np.int32],
|
|
69
|
+
N2: NDArray[np.int32],
|
|
70
|
+
sigma: float,
|
|
71
|
+
) -> NDArray[np.float64]: ...
|
|
72
|
+
def fatomic_local_gradient_kernel(
|
|
73
|
+
x1: NDArray[np.float64],
|
|
74
|
+
x2: NDArray[np.float64],
|
|
75
|
+
dX2: NDArray[np.float64],
|
|
76
|
+
q1: NDArray[np.int32],
|
|
77
|
+
q2: NDArray[np.int32],
|
|
78
|
+
n1: NDArray[np.int32],
|
|
79
|
+
n2: NDArray[np.int32],
|
|
80
|
+
sigma: float,
|
|
81
|
+
) -> NDArray[np.float64]: ...
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Type stubs for _invdist C++ extension module."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy.typing import NDArray
|
|
5
|
+
|
|
6
|
+
def num_pairs(N: int) -> int: ...
|
|
7
|
+
def inverse_distance_upper(R: NDArray[np.float64]) -> NDArray[np.float64]: ...
|
|
8
|
+
def inverse_distance_upper_and_jacobian(
|
|
9
|
+
R: NDArray[np.float64], eps: float = 0.0
|
|
10
|
+
) -> tuple[NDArray[np.float64], NDArray[np.float64]]: ...
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Type stubs for _kernels C++ extension module."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from numpy.typing import NDArray
|
|
5
|
+
|
|
6
|
+
def kernel_symm(X: NDArray[np.float64], alpha: float) -> NDArray[np.float64]: ...
|
|
7
|
+
def kernel_asymm(
|
|
8
|
+
X1: NDArray[np.float64], X2: NDArray[np.float64], alpha: float
|
|
9
|
+
) -> NDArray[np.float64]: ...
|
|
10
|
+
def gaussian_jacobian_batch(
|
|
11
|
+
X1: NDArray[np.float64],
|
|
12
|
+
dX1: NDArray[np.float64],
|
|
13
|
+
X2: NDArray[np.float64],
|
|
14
|
+
sigma: float,
|
|
15
|
+
) -> NDArray[np.float64]: ...
|
|
16
|
+
def rbf_hessian_full_tiled_gemm(
|
|
17
|
+
X1: NDArray[np.float64],
|
|
18
|
+
dX1: NDArray[np.float64],
|
|
19
|
+
X2: NDArray[np.float64],
|
|
20
|
+
dX2: NDArray[np.float64],
|
|
21
|
+
sigma: float,
|
|
22
|
+
tile_B: int | None = None,
|
|
23
|
+
) -> NDArray[np.float64]: ...
|
|
24
|
+
def rbf_hessian_full_tiled_gemm_sym(
|
|
25
|
+
X: NDArray[np.float64],
|
|
26
|
+
dX: NDArray[np.float64],
|
|
27
|
+
sigma: float,
|
|
28
|
+
tile_B: int | None = None,
|
|
29
|
+
) -> NDArray[np.float64]: ...
|