mlipcpp 0.1.1__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 (152) hide show
  1. mlipcpp-0.1.1/.clang-format +3 -0
  2. mlipcpp-0.1.1/.github/workflows/build_wasm.yml +149 -0
  3. mlipcpp-0.1.1/.github/workflows/ci.yml +78 -0
  4. mlipcpp-0.1.1/.github/workflows/website.yml +99 -0
  5. mlipcpp-0.1.1/.github/workflows/wheels.yml +147 -0
  6. mlipcpp-0.1.1/.gitignore +56 -0
  7. mlipcpp-0.1.1/.gitmodules +9 -0
  8. mlipcpp-0.1.1/CMakeLists.txt +392 -0
  9. mlipcpp-0.1.1/LICENSE +28 -0
  10. mlipcpp-0.1.1/PKG-INFO +163 -0
  11. mlipcpp-0.1.1/README.md +114 -0
  12. mlipcpp-0.1.1/cmake/PythonBindings.cmake +27 -0
  13. mlipcpp-0.1.1/cmake/mlipcppConfig.cmake.in +16 -0
  14. mlipcpp-0.1.1/examples/CMakeLists.txt +60 -0
  15. mlipcpp-0.1.1/examples/backend_benchmark.cpp +241 -0
  16. mlipcpp-0.1.1/examples/c_api_test.c +182 -0
  17. mlipcpp-0.1.1/examples/cpp_api_test.cpp +158 -0
  18. mlipcpp-0.1.1/examples/fortran_api_test.f90 +167 -0
  19. mlipcpp-0.1.1/examples/python_ase.py +121 -0
  20. mlipcpp-0.1.1/examples/python_basic.py +81 -0
  21. mlipcpp-0.1.1/examples/python_comparison.py +207 -0
  22. mlipcpp-0.1.1/examples/simple_inference.cpp +309 -0
  23. mlipcpp-0.1.1/geometries/si.xyz +4 -0
  24. mlipcpp-0.1.1/geometries/urea.cif +51 -0
  25. mlipcpp-0.1.1/geometries/urea.xyz +18 -0
  26. mlipcpp-0.1.1/geometries/urea_molecule.xyz +10 -0
  27. mlipcpp-0.1.1/geometries/water.xyz +5 -0
  28. mlipcpp-0.1.1/gguf/LICENSE +30 -0
  29. mlipcpp-0.1.1/gguf/README.md +53 -0
  30. mlipcpp-0.1.1/include/mlipcpp/io.h +69 -0
  31. mlipcpp-0.1.1/include/mlipcpp/mlipcpp.h +469 -0
  32. mlipcpp-0.1.1/include/mlipcpp/mlipcpp.hpp +244 -0
  33. mlipcpp-0.1.1/include/mlipcpp/model.h +42 -0
  34. mlipcpp-0.1.1/include/mlipcpp/neighbor_list.h +40 -0
  35. mlipcpp-0.1.1/include/mlipcpp/system.h +59 -0
  36. mlipcpp-0.1.1/include/mlipcpp/timer.h +164 -0
  37. mlipcpp-0.1.1/packages/mlip.js/LICENSE +28 -0
  38. mlipcpp-0.1.1/packages/mlip.js/README.md +216 -0
  39. mlipcpp-0.1.1/packages/mlip.js/examples/basic.html +269 -0
  40. mlipcpp-0.1.1/packages/mlip.js/package-lock.json +51 -0
  41. mlipcpp-0.1.1/packages/mlip.js/package.json +76 -0
  42. mlipcpp-0.1.1/packages/mlip.js/scripts/build.js +201 -0
  43. mlipcpp-0.1.1/pyproject.toml +51 -0
  44. mlipcpp-0.1.1/python/mlipcpp/__init__.py +94 -0
  45. mlipcpp-0.1.1/python/mlipcpp/ase.py +202 -0
  46. mlipcpp-0.1.1/scripts/__init__.py +0 -0
  47. mlipcpp-0.1.1/scripts/benchmark_backends.sh +173 -0
  48. mlipcpp-0.1.1/scripts/benchmark_graph_inference_forces.py +93 -0
  49. mlipcpp-0.1.1/scripts/benchmark_pet_full_torch_compile.py +256 -0
  50. mlipcpp-0.1.1/scripts/build_wasm.sh +56 -0
  51. mlipcpp-0.1.1/scripts/calc_energy_pytorch.py +92 -0
  52. mlipcpp-0.1.1/scripts/convert_cif_to_extxyz.py +57 -0
  53. mlipcpp-0.1.1/scripts/convert_models.py +189 -0
  54. mlipcpp-0.1.1/scripts/convert_pet_mad.py +325 -0
  55. mlipcpp-0.1.1/scripts/export_pytorch/__init__.py +15 -0
  56. mlipcpp-0.1.1/scripts/export_pytorch/export_pet_full.py +957 -0
  57. mlipcpp-0.1.1/scripts/export_pytorch/export_pet_gguf.py +426 -0
  58. mlipcpp-0.1.1/scripts/export_pytorch/fx_converter.py +2152 -0
  59. mlipcpp-0.1.1/scripts/export_pytorch/graph_ir.py +342 -0
  60. mlipcpp-0.1.1/scripts/publish_ggufs.py +205 -0
  61. mlipcpp-0.1.1/scripts/test_all_models.py +383 -0
  62. mlipcpp-0.1.1/scripts/test_all_models.sh +274 -0
  63. mlipcpp-0.1.1/src/CMakeLists.txt +112 -0
  64. mlipcpp-0.1.1/src/api/c/mlipcpp_api.cpp +784 -0
  65. mlipcpp-0.1.1/src/api/cpp/mlipcpp_cpp.cpp +321 -0
  66. mlipcpp-0.1.1/src/api/fortran/mlipcpp.f90 +611 -0
  67. mlipcpp-0.1.1/src/api/python/mlipcpp_bindings.cpp +282 -0
  68. mlipcpp-0.1.1/src/bin/graph_inference.cpp +122 -0
  69. mlipcpp-0.1.1/src/core/backend.cpp +258 -0
  70. mlipcpp-0.1.1/src/core/backend.h +112 -0
  71. mlipcpp-0.1.1/src/core/ggml_utils.cpp +332 -0
  72. mlipcpp-0.1.1/src/core/ggml_utils.h +431 -0
  73. mlipcpp-0.1.1/src/core/gguf_loader.cpp +150 -0
  74. mlipcpp-0.1.1/src/core/gguf_loader.h +62 -0
  75. mlipcpp-0.1.1/src/core/log.h +136 -0
  76. mlipcpp-0.1.1/src/core/neighbor_list.cpp +299 -0
  77. mlipcpp-0.1.1/src/core/system.cpp +91 -0
  78. mlipcpp-0.1.1/src/core/timer.cpp +144 -0
  79. mlipcpp-0.1.1/src/ggml_attention.cpp +61 -0
  80. mlipcpp-0.1.1/src/ggml_attention.h +34 -0
  81. mlipcpp-0.1.1/src/io/xyz.cpp +185 -0
  82. mlipcpp-0.1.1/src/models/model.cpp +31 -0
  83. mlipcpp-0.1.1/src/models/pet/pet.cpp +1314 -0
  84. mlipcpp-0.1.1/src/models/pet/pet.h +270 -0
  85. mlipcpp-0.1.1/src/models/pet/pet_batch.cpp +763 -0
  86. mlipcpp-0.1.1/src/models/pet/pet_batch.h +74 -0
  87. mlipcpp-0.1.1/src/models/pet/pet_graph.h +249 -0
  88. mlipcpp-0.1.1/src/models/pet/pet_layers.cpp +1017 -0
  89. mlipcpp-0.1.1/src/models/pet/pet_types.h +347 -0
  90. mlipcpp-0.1.1/src/runtime/graph_interpreter.cpp +1837 -0
  91. mlipcpp-0.1.1/src/runtime/graph_interpreter.h +146 -0
  92. mlipcpp-0.1.1/src/runtime/graph_ir.cpp +518 -0
  93. mlipcpp-0.1.1/src/runtime/graph_ir.h +92 -0
  94. mlipcpp-0.1.1/src/runtime/graph_model.cpp +578 -0
  95. mlipcpp-0.1.1/src/runtime/graph_model.h +112 -0
  96. mlipcpp-0.1.1/tests/CMakeLists.txt +205 -0
  97. mlipcpp-0.1.1/tests/test_auto_vs_manual.cpp +373 -0
  98. mlipcpp-0.1.1/tests/test_backend_selection.cpp +96 -0
  99. mlipcpp-0.1.1/tests/test_full_export.cpp +689 -0
  100. mlipcpp-0.1.1/tests/test_ggml_layout.cpp +54 -0
  101. mlipcpp-0.1.1/tests/test_graph_interpreter.cpp +754 -0
  102. mlipcpp-0.1.1/tests/test_graph_model.cpp +514 -0
  103. mlipcpp-0.1.1/tests/test_io.cpp +204 -0
  104. mlipcpp-0.1.1/tests/test_main.cpp +2 -0
  105. mlipcpp-0.1.1/tests/test_neighbor_list.cpp +266 -0
  106. mlipcpp-0.1.1/tests/test_pet.cpp +322 -0
  107. mlipcpp-0.1.1/tests/test_pet_gradients.cpp +234 -0
  108. mlipcpp-0.1.1/tests/test_python_api.py +229 -0
  109. mlipcpp-0.1.1/tests/test_system.cpp +169 -0
  110. mlipcpp-0.1.1/uv.lock +569 -0
  111. mlipcpp-0.1.1/website/.gitignore +6 -0
  112. mlipcpp-0.1.1/website/bench.html +16 -0
  113. mlipcpp-0.1.1/website/bun.lock +766 -0
  114. mlipcpp-0.1.1/website/index.html +13 -0
  115. mlipcpp-0.1.1/website/package.json +26 -0
  116. mlipcpp-0.1.1/website/public/favicon.svg +15 -0
  117. mlipcpp-0.1.1/website/src/App.svelte +73 -0
  118. mlipcpp-0.1.1/website/src/bench-main.ts +53 -0
  119. mlipcpp-0.1.1/website/src/components/EnergyPlot.svelte +93 -0
  120. mlipcpp-0.1.1/website/src/components/MDParams.svelte +129 -0
  121. mlipcpp-0.1.1/website/src/components/ModelLoader.svelte +241 -0
  122. mlipcpp-0.1.1/website/src/components/OptParams.svelte +131 -0
  123. mlipcpp-0.1.1/website/src/components/RunControls.svelte +94 -0
  124. mlipcpp-0.1.1/website/src/components/Segmented.svelte +63 -0
  125. mlipcpp-0.1.1/website/src/components/Stats.svelte +71 -0
  126. mlipcpp-0.1.1/website/src/components/StructureLoader.svelte +204 -0
  127. mlipcpp-0.1.1/website/src/components/VibrationsPanel.svelte +382 -0
  128. mlipcpp-0.1.1/website/src/components/Viewer.svelte +61 -0
  129. mlipcpp-0.1.1/website/src/components/ViewerControls.svelte +63 -0
  130. mlipcpp-0.1.1/website/src/components/XyzEditorModal.svelte +140 -0
  131. mlipcpp-0.1.1/website/src/lib/chem/bonds.ts +32 -0
  132. mlipcpp-0.1.1/website/src/lib/chem/cell.ts +54 -0
  133. mlipcpp-0.1.1/website/src/lib/chem/elements.ts +169 -0
  134. mlipcpp-0.1.1/website/src/lib/chem/pubchem.ts +80 -0
  135. mlipcpp-0.1.1/website/src/lib/chem/sdf.ts +28 -0
  136. mlipcpp-0.1.1/website/src/lib/chem/supercell.ts +37 -0
  137. mlipcpp-0.1.1/website/src/lib/chem/xyz.ts +23 -0
  138. mlipcpp-0.1.1/website/src/lib/data/samples.ts +93 -0
  139. mlipcpp-0.1.1/website/src/lib/ngl/viewer.ts +220 -0
  140. mlipcpp-0.1.1/website/src/lib/stores/simulation.svelte.ts +435 -0
  141. mlipcpp-0.1.1/website/src/lib/vib/jacobi.ts +90 -0
  142. mlipcpp-0.1.1/website/src/lib/vib/modes.ts +194 -0
  143. mlipcpp-0.1.1/website/src/lib/vib/projector.ts +139 -0
  144. mlipcpp-0.1.1/website/src/lib/worker/mdWorker.ts +1452 -0
  145. mlipcpp-0.1.1/website/src/lib/worker/simulation.ts +237 -0
  146. mlipcpp-0.1.1/website/src/main.ts +9 -0
  147. mlipcpp-0.1.1/website/src/styles/app.css +168 -0
  148. mlipcpp-0.1.1/website/src/vite-env.d.ts +26 -0
  149. mlipcpp-0.1.1/website/svelte.config.js +5 -0
  150. mlipcpp-0.1.1/website/tsconfig.json +21 -0
  151. mlipcpp-0.1.1/website/tsconfig.node.json +11 -0
  152. mlipcpp-0.1.1/website/vite.config.ts +31 -0
@@ -0,0 +1,3 @@
1
+ BasedOnStyle: LLVM
2
+ IndentWidth: 2
3
+ SortIncludes: true
@@ -0,0 +1,149 @@
1
+ name: Build WASM/JavaScript Package
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: "v*"
7
+ paths:
8
+ - 'packages/mlip.js/**'
9
+ - 'src/api/wasm/**'
10
+ - 'scripts/build_wasm.sh'
11
+ - '.github/workflows/build_wasm.yml'
12
+ pull_request:
13
+ branches: [main]
14
+ paths:
15
+ - 'packages/mlip.js/**'
16
+ - 'src/api/wasm/**'
17
+ - 'scripts/build_wasm.sh'
18
+ - '.github/workflows/build_wasm.yml'
19
+ workflow_dispatch:
20
+ inputs:
21
+ upload_to_npm:
22
+ description: 'Upload to npm after building'
23
+ required: false
24
+ type: boolean
25
+ default: false
26
+
27
+ env:
28
+ BUILD_TYPE: Release
29
+ CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_cache
30
+
31
+ jobs:
32
+ build-wasm:
33
+ name: Build WASM Package
34
+ runs-on: ubuntu-latest
35
+
36
+ steps:
37
+ - name: Checkout repository
38
+ uses: actions/checkout@v4
39
+ with:
40
+ submodules: recursive
41
+
42
+ - name: Install system dependencies
43
+ run: |
44
+ sudo apt-get update
45
+ sudo apt-get install -y cmake ninja-build
46
+
47
+ - name: Setup Node.js
48
+ uses: actions/setup-node@v4
49
+ with:
50
+ node-version: 20
51
+ cache: 'npm'
52
+ cache-dependency-path: packages/mlip.js/package-lock.json
53
+
54
+ - name: Setup Emscripten
55
+ uses: mymindstorm/setup-emsdk@v14
56
+ with:
57
+ # 4.0.16 matches website.yml — emdawnwebgpu only ships in 4.x.
58
+ version: '4.0.16'
59
+ actions-cache-folder: 'emsdk-cache'
60
+
61
+ - name: Cache CPM Dependencies
62
+ uses: actions/cache@v4
63
+ with:
64
+ path: ${{ env.CPM_SOURCE_CACHE }}
65
+ key: wasm-cpm-${{ runner.os }}-${{ hashFiles('CMakeLists.txt') }}
66
+ restore-keys: |
67
+ wasm-cpm-${{ runner.os }}-
68
+
69
+ - name: Build WASM module (cpu + gpu variants)
70
+ working-directory: packages/mlip.js
71
+ run: |
72
+ rm -rf ../../wasm-cpu ../../wasm-gpu
73
+ npm run build:wasm
74
+
75
+ - name: Install package dependencies
76
+ working-directory: packages/mlip.js
77
+ run: npm ci
78
+
79
+ - name: Build package
80
+ working-directory: packages/mlip.js
81
+ run: npm run build:wrapper
82
+
83
+ - name: Pack package
84
+ working-directory: packages/mlip.js
85
+ run: npm pack
86
+
87
+ - name: Upload WASM build artifacts
88
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: wasm-build
92
+ path: packages/mlip.js/dist/
93
+ retention-days: 30
94
+
95
+ - name: Upload package artifact
96
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
97
+ uses: actions/upload-artifact@v4
98
+ with:
99
+ name: mlipjs-package
100
+ path: packages/mlip.js/*.tgz
101
+ retention-days: 30
102
+
103
+ publish-npm:
104
+ name: Publish to npm
105
+ needs: build-wasm
106
+ runs-on: ubuntu-latest
107
+ if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && inputs.upload_to_npm)
108
+ permissions:
109
+ contents: read
110
+ id-token: write
111
+
112
+ steps:
113
+ - name: Checkout repository
114
+ uses: actions/checkout@v4
115
+
116
+ - name: Setup Node.js
117
+ uses: actions/setup-node@v4
118
+ with:
119
+ node-version: 20
120
+ registry-url: 'https://registry.npmjs.org'
121
+
122
+ - name: Download WASM build artifacts
123
+ uses: actions/download-artifact@v4
124
+ with:
125
+ name: wasm-build
126
+ path: packages/mlip.js/dist/
127
+
128
+ - name: Install dependencies
129
+ working-directory: packages/mlip.js
130
+ run: npm ci
131
+
132
+ - name: Check if version changed
133
+ id: version
134
+ working-directory: packages/mlip.js
135
+ run: |
136
+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
137
+ NPM_VERSION=$(npm view @peterspackman/mlip.js version 2>/dev/null || echo "0.0.0")
138
+ echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
139
+ echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
140
+ if [ "$PACKAGE_VERSION" != "$NPM_VERSION" ]; then
141
+ echo "should_publish=true" >> $GITHUB_OUTPUT
142
+ else
143
+ echo "should_publish=false" >> $GITHUB_OUTPUT
144
+ fi
145
+
146
+ - name: Publish to npm
147
+ if: steps.version.outputs.should_publish == 'true'
148
+ working-directory: packages/mlip.js
149
+ run: npm publish --provenance --access public --ignore-scripts
@@ -0,0 +1,78 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ BUILD_TYPE: Release
11
+ CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_cache
12
+
13
+ jobs:
14
+ build-and-test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+ with:
21
+ submodules: recursive
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ sudo apt-get update
26
+ sudo apt-get install -y cmake ninja-build gcc g++ gfortran
27
+
28
+ - name: Cache CPM packages
29
+ uses: actions/cache@v4
30
+ with:
31
+ path: ${{ env.CPM_SOURCE_CACHE }}
32
+ key: cpm-${{ runner.os }}-${{ hashFiles('CMakeLists.txt') }}
33
+ restore-keys: |
34
+ cpm-${{ runner.os }}-
35
+
36
+ - name: Cache build directory
37
+ uses: actions/cache@v4
38
+ with:
39
+ path: build
40
+ key: build-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**') }}
41
+ restore-keys: |
42
+ build-${{ runner.os }}-${{ env.BUILD_TYPE }}-
43
+
44
+ - name: Configure CMake
45
+ run: |
46
+ cmake -B build -G Ninja \
47
+ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
48
+ -DMLIPCPP_BUILD_TESTS=ON \
49
+ -DMLIPCPP_BUILD_FORTRAN=ON \
50
+ -DMLIPCPP_BUILD_PYTHON=OFF \
51
+ -DCPM_SOURCE_CACHE=${{ env.CPM_SOURCE_CACHE }}
52
+
53
+ - name: Build
54
+ run: cmake --build build --config ${{ env.BUILD_TYPE }} -j $(nproc)
55
+
56
+ # Pull a pre-exported graph-format GGUF from HuggingFace and place it
57
+ # where the GraphModel tests look for it (build/tests/gguf/pet-auto.gguf).
58
+ # Legacy fixed-PET tests skip cleanly when pet-mad.gguf is absent, which
59
+ # is the desired behaviour here — CI exercises the graph path only.
60
+ - name: Cache graph GGUF
61
+ uses: actions/cache@v4
62
+ with:
63
+ path: build/tests/gguf/pet-auto.gguf
64
+ key: gguf-pet-auto-${{ hashFiles('scripts/convert_models.py') }}
65
+
66
+ - name: Fetch graph GGUF from HuggingFace
67
+ run: |
68
+ mkdir -p build/tests/gguf
69
+ if [ ! -s build/tests/gguf/pet-auto.gguf ]; then
70
+ curl -fL --retry 3 \
71
+ -o build/tests/gguf/pet-auto.gguf \
72
+ https://huggingface.co/peterspackman/mlip-gguf/resolve/main/pet-mad-xs.gguf
73
+ fi
74
+ ls -la build/tests/gguf/
75
+
76
+ - name: Run tests
77
+ working-directory: build
78
+ run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure -j $(nproc)
@@ -0,0 +1,99 @@
1
+ name: Deploy Website
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: "pages"
15
+ cancel-in-progress: false
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+ with:
24
+ submodules: recursive
25
+
26
+ - name: Setup Node
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: '20'
30
+
31
+ - name: Setup Bun
32
+ uses: oven-sh/setup-bun@v2
33
+ with:
34
+ bun-version: latest
35
+
36
+ - name: Install Emscripten
37
+ uses: mymindstorm/setup-emsdk@v14
38
+ with:
39
+ # Matches the local dev version that the WebGPU build is known to
40
+ # work with. 3.1.x doesn't ship the emdawnwebgpu port.
41
+ version: '4.0.16'
42
+
43
+ - name: Cache CPM packages
44
+ uses: actions/cache@v4
45
+ with:
46
+ path: .cpm_cache
47
+ key: cpm-wasm-${{ hashFiles('CMakeLists.txt') }}
48
+ restore-keys: |
49
+ cpm-wasm-
50
+
51
+ - name: Install mlip.js deps
52
+ working-directory: packages/mlip.js
53
+ run: npm install
54
+
55
+ # Cache the bundled GGUF across runs so we don't re-download from HF on
56
+ # every build. Keyed on the URL + filename so a model bump in
57
+ # package.json invalidates the cache automatically.
58
+ - name: Cache bundled GGUF
59
+ uses: actions/cache@v4
60
+ with:
61
+ path: website/public/pet-mad-xs.gguf
62
+ key: gguf-pet-mad-xs-${{ hashFiles('website/package.json') }}
63
+
64
+ - name: Build WASM (both variants)
65
+ working-directory: packages/mlip.js
66
+ # Two binaries shipped side-by-side:
67
+ # cpu: no WebGPU, no ASYNCIFY — fast on Firefox/Safari
68
+ # gpu: WebGPU + ASYNCIFY — Chrome path (ASYNCIFY kills Firefox perf)
69
+ # The loader picks the right variant based on the user's backend choice.
70
+ run: npm run build
71
+ env:
72
+ CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_cache
73
+
74
+ - name: Install website dependencies
75
+ working-directory: website
76
+ run: bun install --frozen-lockfile
77
+
78
+ - name: Build website
79
+ working-directory: website
80
+ run: bun run build
81
+
82
+ - name: Setup Pages
83
+ uses: actions/configure-pages@v4
84
+
85
+ - name: Upload artifact
86
+ uses: actions/upload-pages-artifact@v3
87
+ with:
88
+ path: website/dist
89
+
90
+ deploy:
91
+ environment:
92
+ name: github-pages
93
+ url: ${{ steps.deployment.outputs.page_url }}
94
+ runs-on: ubuntu-latest
95
+ needs: build
96
+ steps:
97
+ - name: Deploy to GitHub Pages
98
+ id: deployment
99
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,147 @@
1
+ name: Python Wheels
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ['v*']
7
+ pull_request:
8
+ branches: [main]
9
+ paths:
10
+ - 'pyproject.toml'
11
+ - 'python/**'
12
+ - 'src/**'
13
+ - 'include/**'
14
+ - 'CMakeLists.txt'
15
+ - 'cmake/**'
16
+ - 'tests/test_python_api.py'
17
+ - '.github/workflows/wheels.yml'
18
+ workflow_dispatch:
19
+
20
+ env:
21
+ CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_cache
22
+
23
+ jobs:
24
+ build_wheels:
25
+ name: Wheel · ${{ matrix.os }} · ${{ matrix.arch }}
26
+ runs-on: ${{ matrix.os }}
27
+ strategy:
28
+ fail-fast: false
29
+ matrix:
30
+ include:
31
+ - os: ubuntu-latest
32
+ arch: x86_64
33
+ - os: macos-14
34
+ arch: arm64
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+ with:
38
+ submodules: recursive
39
+
40
+ - name: Cache CPM packages
41
+ uses: actions/cache@v4
42
+ with:
43
+ path: ${{ env.CPM_SOURCE_CACHE }}
44
+ key: cpm-wheels-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt') }}
45
+ restore-keys: |
46
+ cpm-wheels-${{ runner.os }}-${{ matrix.arch }}-
47
+
48
+ # cibuildwheel uses `build[uv]` per pyproject.toml, so uv must be on
49
+ # PATH before the action runs. Hosted runners don't ship it.
50
+ - name: Install uv
51
+ uses: astral-sh/setup-uv@v3
52
+
53
+ - name: Build wheels
54
+ uses: pypa/cibuildwheel@v2.22
55
+ env:
56
+ CIBW_ARCHS: ${{ matrix.arch }}
57
+ # Forward the CPM cache to the manylinux container; macOS runs on host.
58
+ CIBW_ENVIRONMENT_LINUX: CPM_SOURCE_CACHE=/host${{ env.CPM_SOURCE_CACHE }}
59
+ CIBW_ENVIRONMENT_MACOS: CPM_SOURCE_CACHE=${{ env.CPM_SOURCE_CACHE }}
60
+
61
+ - uses: actions/upload-artifact@v4
62
+ with:
63
+ name: wheels-${{ matrix.os }}-${{ matrix.arch }}
64
+ path: ./wheelhouse/*.whl
65
+ if-no-files-found: error
66
+
67
+ test_wheel:
68
+ name: Python integration tests
69
+ needs: build_wheels
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+
74
+ - name: Install uv
75
+ uses: astral-sh/setup-uv@v3
76
+ with:
77
+ python-version: '3.12'
78
+
79
+ - name: Download linux wheel
80
+ uses: actions/download-artifact@v4
81
+ with:
82
+ name: wheels-ubuntu-latest-x86_64
83
+ path: wheelhouse
84
+
85
+ - name: Install wheel + test deps
86
+ run: |
87
+ uv venv .venv
88
+ uv pip install --python .venv/bin/python wheelhouse/*.whl
89
+ uv pip install --python .venv/bin/python pytest ase
90
+
91
+ - name: Fetch reference GGUF from HuggingFace
92
+ run: |
93
+ mkdir -p gguf
94
+ curl -fL --retry 3 \
95
+ -o gguf/pet-auto.gguf \
96
+ https://huggingface.co/peterspackman/mlip-gguf/resolve/main/pet-mad-xs.gguf
97
+
98
+ - name: Run Python tests
99
+ run: .venv/bin/pytest tests/test_python_api.py -v
100
+
101
+ build_sdist:
102
+ name: Source distribution
103
+ runs-on: ubuntu-latest
104
+ steps:
105
+ - uses: actions/checkout@v4
106
+ with:
107
+ submodules: recursive
108
+
109
+ - name: Install uv
110
+ uses: astral-sh/setup-uv@v3
111
+ with:
112
+ python-version: '3.12'
113
+
114
+ - name: Build sdist
115
+ run: uv build --sdist
116
+
117
+ - name: Verify sdist installs from source
118
+ run: |
119
+ uv venv .venv-sdist
120
+ uv pip install --python .venv-sdist/bin/python dist/*.tar.gz
121
+ .venv-sdist/bin/python -c "import mlipcpp; print(mlipcpp.version())"
122
+
123
+ - uses: actions/upload-artifact@v4
124
+ with:
125
+ name: sdist
126
+ path: dist/*.tar.gz
127
+ if-no-files-found: error
128
+
129
+ publish_pypi:
130
+ name: Publish to PyPI
131
+ needs: [build_wheels, build_sdist, test_wheel]
132
+ runs-on: ubuntu-latest
133
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
134
+ environment:
135
+ name: pypi
136
+ url: https://pypi.org/p/mlipcpp
137
+ permissions:
138
+ id-token: write
139
+ steps:
140
+ - name: Download all artifacts
141
+ uses: actions/download-artifact@v4
142
+ with:
143
+ path: dist
144
+ merge-multiple: true
145
+
146
+ - name: Publish package distributions to PyPI
147
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,56 @@
1
+ build/
2
+ build*/
3
+ debug/
4
+ *.swp
5
+ *.swo
6
+ *~
7
+ .DS_Store
8
+ *.gguf
9
+ *.pt
10
+ *.pth
11
+ compile_commands.json
12
+
13
+ .cache
14
+ # Reference repositories (for development only, not part of the project)
15
+ reference/
16
+
17
+ # Temporary files and directories
18
+ /tmp/
19
+ *_test_*/
20
+ *_debug*/
21
+ *.backup*
22
+ __pycache__/
23
+ pytorch_dump/
24
+ stdout
25
+
26
+ # Documentation (except README)
27
+ *.md
28
+ !README.md
29
+
30
+ # Development directories
31
+ testing/
32
+
33
+ # Local experiments and artifacts (not part of mlipcpp)
34
+ local/
35
+ petk_codegen/
36
+ tinypet/
37
+ scripts/repro_ase_optimizer_segfault.py
38
+ scripts/stress_ase_optimizer_segfault.py
39
+
40
+ # WASM build output
41
+ wasm/
42
+ wasm-cpu/
43
+ wasm-gpu/
44
+
45
+ # Node.js / npm
46
+ node_modules/
47
+ *.tgz
48
+ packages/mlip.js/dist/
49
+ packages/mlip.js/src/mlipcpp_wasm.js
50
+ packages/mlip.js/src/cpu/
51
+ packages/mlip.js/src/gpu/
52
+
53
+ # Website build output
54
+ website/dist/
55
+ website/node_modules/
56
+ a.out.*
@@ -0,0 +1,9 @@
1
+ [submodule "external/ggml"]
2
+ path = external/ggml
3
+ url = https://github.com/ggml-org/ggml.git
4
+ [submodule "external/Catch2"]
5
+ path = external/Catch2
6
+ url = https://github.com/catchorg/Catch2.git
7
+ [submodule "external/fmt"]
8
+ path = external/fmt
9
+ url = https://github.com/fmtlib/fmt.git