-
Notifications
You must be signed in to change notification settings - Fork 13
Implement a C API for metatomic #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Luthaf
wants to merge
66
commits into
main
Choose a base branch
from
metatomic-core
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
f1e5f69
Add an empty metatomic-core python package, re-exporting metatomic-torch
Luthaf 7177f3d
Use pathlib for all path manipulations
Luthaf d50ae4a
Switch main test runner from tox to cargo
Luthaf a2f79d3
Scaffold a new metatomic-core package
Luthaf 65aad04
Draft the C API for metatomic-core
Luthaf 5d4aae5
Implement PairListOptions json serialization
sofiia-chorna b0b16d9
Implement JSON serialization for `Quantity`
GardevoirX ed5e948
Validate quantities names
Luthaf f58df2d
Implement JSON serialization for ModelMetadata
alessandroforina 4bf9e5c
Add error handling based on metatensor
RMeli 63cbe3d
Implement mta_string_t in the C API
johannes-spies fd7dd7c
Port unit parsing from metatomic-torch
Luthaf 478f384
document mta_model_t and related functions in C API
sofiia-chorna eb1f633
Add ModelCapabilities to the JSON structs
Luthaf 95ea6c4
Implement plugin registration and loading, model loading
frostedoyster 7738f19
Add a C model registration test
frostedoyster b9a1289
Implement System in metatomic-core
Luthaf 55c1b86
Implement `mta_format_metadata`
GardevoirX fee5207
Add unit conversion and error handling to C++
RMeli f128463
Add C++ documentation
Luthaf a5eb8e0
Expose mta_model_t function in rust's Model struct
alessandroforina 709e202
Cleanup CMake code calling cargo
Luthaf fd26387
C++ API to format model metadata (#266)
RMeli 302647a
Add C++ API for loading plugins
RMeli 9e48f31
Re-enable Windows Rust tests
Luthaf dc6a8b2
Add a C API for systems
Luthaf 909ba52
Separate C++ and C API tests
Luthaf 7579bc8
Better fix to "no module named __pip__" in tests
Luthaf f086a9e
Bump MSRV to 1.88
Luthaf f3cc6a2
Update to edition 2024
Luthaf 6b70415
Implement serialization for Systems
Luthaf 6238fb1
Remove double indirection (Box + Arc) in mta_system_t
Luthaf 471449e
C++ metadata classes with JSON serialization/deserialization (#277)
RMeli 7d4d2a7
Implement System in the C++ API
frostedoyster 17e911a
Group all code accessing values in a new `kernels` module
Luthaf 543eaaf
Add cuda kernels for system validation
Luthaf cfdb374
Add custom metal kernels for system validation
Luthaf 9310e3a
Cache reference values on device
Luthaf b9331c6
Remove cargo caching in CI, it interacts badly with our setup
Luthaf 98d500e
Use an output parameter in mta_load{_buffer}
Luthaf 411ad2d
Refactory quantity name parsing, keep the separate components accessible
Luthaf 29d1817
Add function to check that Quantity match the expected layout
GardevoirX 8194679
Update to metatensor-core v0.2.4
Luthaf 50684ed
C++ API for custom models (#314)
RMeli bbf85e0
Setup examples/tutorials for the C API (#313)
Luthaf 6146aff
Always handle System through an Arc
Luthaf d4e4fa4
Handle multiple devices in ReferenceValue
Luthaf b74a32c
Add tests for cuda and metal kernels
Luthaf 73ae2a9
Add a scale_inplace kernel for unit conversion
Luthaf a6d11c7
Add a kernel to clone DLPack Tensors and use it to clone Systems
Luthaf 0d0d913
Add a check_atomic_types kernel
Luthaf 8663cf3
Implement mta_execute_model
Luthaf 72a2653
Remove supported_outputs from mta_model_t
Luthaf a1fb26d
Use builders for metadata objects in C++ (#319)
RMeli c9bbf88
Install nlohmann_json headers in include/metatomic/third-party/
Luthaf 6d8d04e
Build the library in metatomic-core Python package
johannes-spies 6b73f99
Serialization for C++ system
lucaskloss adf28ec
C declaration generation for Python and minimal library loading
Luthaf f81cb09
Remap path properly for code coverage
Luthaf 9bcc40a
Implement metadata classes in Python
Luthaf a71d0ef
C++ wrapper for mta_execute_model
RMeli 2167bb6
Add more status code that can be used by models
Luthaf 41edba0
C API tutorials for custom models and plugins (#320)
EricBoittier b7430cf
Pass through exceptions in the C++ bindings
RMeli e3ed922
API to define plugins in C++
RMeli 09b9cf2
Print more details when regression tests fails
Luthaf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Python tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| # Check all PR | ||
|
|
||
| concurrency: | ||
| group: python-tests-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| python-tests: | ||
| runs-on: ${{ matrix.os }} | ||
| name: ${{ matrix.os }} / Python ${{ matrix.python-version }} / Torch ${{ matrix.torch-version }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| python-version: "3.11" | ||
| torch-version: "2.3" | ||
| numpy-version-pin: "<2.0" | ||
| - os: ubuntu-24.04 | ||
| python-version: "3.11" | ||
| torch-version: "2.13" | ||
| - os: ubuntu-24.04 | ||
| # TorchScript is no longer supported in Python 3.14 | ||
| # so we keep a test with 3.13 to make sure this doesn't break | ||
| python-version: "3.13" | ||
| torch-version: "2.13" | ||
| - os: ubuntu-24.04 | ||
| python-version: "3.14" | ||
| torch-version: "2.13" | ||
| - os: macos-15 | ||
| python-version: "3.14" | ||
| torch-version: "2.13" | ||
| - os: windows-2022 | ||
|
RMeli marked this conversation as resolved.
|
||
| python-version: "3.14" | ||
| torch-version: "2.13" | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: setup Python | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: setup rust | ||
| uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Setup sccache | ||
| if: ${{ !env.ACT }} | ||
| uses: mozilla-actions/sccache-action@v0.0.10 | ||
| with: | ||
| version: "v0.10.0" | ||
|
RMeli marked this conversation as resolved.
|
||
|
|
||
| - name: setup MSVC command prompt | ||
| uses: ilammy/msvc-dev-cmd@v1 | ||
|
|
||
| - name: Setup sccache environnement variables | ||
| if: ${{ !env.ACT }} | ||
| run: | | ||
| echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
| echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV | ||
| echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV | ||
|
|
||
| - name: install tests dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install tox coverage | ||
|
|
||
| - name: run tests | ||
| run: tox -e lint,core-tests,torch-tests,docs-tests | ||
| env: | ||
| PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu | ||
| METATOMIC_TESTS_TORCH_VERSION: ${{ matrix.torch-version }} | ||
|
|
||
| - name: combine Python coverage files | ||
| shell: bash | ||
| run: | | ||
| coverage combine .tox/*/.coverage | ||
| coverage xml | ||
|
|
||
| - name: upload to codecov.io | ||
| uses: codecov/codecov-action@v7 | ||
| with: | ||
| fail_ci_if_error: true | ||
| files: coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.