-
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
65
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
65 commits
Select commit
Hold shift + click to select a range
ca05e07
Add an empty metatomic-core python package, re-exporting metatomic-torch
Luthaf 70c044a
Use pathlib for all path manipulations
Luthaf 15c5a60
Switch main test runner from tox to cargo
Luthaf 14746e2
Scaffold a new metatomic-core package
Luthaf 114625e
Draft the C API for metatomic-core
Luthaf 7ab62fa
Implement PairListOptions json serialization
sofiia-chorna 1b7b3de
Implement JSON serialization for `Quantity`
GardevoirX 0b44828
Validate quantities names
Luthaf 5c0f917
Implement JSON serialization for ModelMetadata
alessandroforina ae8ebd4
Add error handling based on metatensor
RMeli 1753a2b
Implement mta_string_t in the C API
johannes-spies f946bde
Port unit parsing from metatomic-torch
Luthaf 237eff8
document mta_model_t and related functions in C API
sofiia-chorna 7b72efb
Add ModelCapabilities to the JSON structs
Luthaf d2a98f8
Implement plugin registration and loading, model loading
frostedoyster a79a644
Add a C model registration test
frostedoyster 9fcb4c6
Implement System in metatomic-core
Luthaf 1f0ef3d
Implement `mta_format_metadata`
GardevoirX 3004765
Add unit conversion and error handling to C++
RMeli 37dcef8
Add C++ documentation
Luthaf b609b74
Expose mta_model_t function in rust's Model struct
alessandroforina d917540
Cleanup CMake code calling cargo
Luthaf 0ff083f
C++ API to format model metadata (#266)
RMeli 488ec5f
Add C++ API for loading plugins
RMeli b0fa6ff
Re-enable Windows Rust tests
Luthaf afa36ec
Add a C API for systems
Luthaf 1ff1453
Separate C++ and C API tests
Luthaf 4c9d00b
Better fix to "no module named __pip__" in tests
Luthaf f8a8ab4
Bump MSRV to 1.88
Luthaf 41d4a14
Update to edition 2024
Luthaf d0b7b25
Implement serialization for Systems
Luthaf d726ddb
Remove double indirection (Box + Arc) in mta_system_t
Luthaf 7c3cd14
C++ metadata classes with JSON serialization/deserialization (#277)
RMeli ef0b039
Implement System in the C++ API
frostedoyster 310cfe3
Group all code accessing values in a new `kernels` module
Luthaf b9c4e43
Add cuda kernels for system validation
Luthaf ce312f1
Add custom metal kernels for system validation
Luthaf b0ad08b
Cache reference values on device
Luthaf 147dd52
Remove cargo caching in CI, it interacts badly with our setup
Luthaf 948aed6
Use an output parameter in mta_load{_buffer}
Luthaf 679b5ee
Refactory quantity name parsing, keep the separate components accessible
Luthaf aa9180a
Add function to check that Quantity match the expected layout
GardevoirX 1637cfb
Update to metatensor-core v0.2.4
Luthaf dba5ec9
C++ API for custom models (#314)
RMeli eb2c093
Setup examples/tutorials for the C API (#313)
Luthaf f5b07b7
Always handle System through an Arc
Luthaf cbd06cb
Handle multiple devices in ReferenceValue
Luthaf 6780b03
Add tests for cuda and metal kernels
Luthaf 734fb45
Add a scale_inplace kernel for unit conversion
Luthaf 2863294
Add a kernel to clone DLPack Tensors and use it to clone Systems
Luthaf 6041ba5
Add a check_atomic_types kernel
Luthaf 8b0d897
Implement mta_execute_model
Luthaf aacbc32
Remove supported_outputs from mta_model_t
Luthaf 92a167d
Use builders for metadata objects in C++ (#319)
RMeli c833193
Install nlohmann_json headers in include/metatomic/third-party/
Luthaf ea807c9
Build the library in metatomic-core Python package
johannes-spies aed429b
Serialization for C++ system
lucaskloss c8134f3
C declaration generation for Python and minimal library loading
Luthaf 340a192
Remap path properly for code coverage
Luthaf d1e6811
Implement metadata classes in Python
Luthaf 1105ca7
C++ wrapper for mta_execute_model
RMeli ed4e805
Add more status code that can be used by models
Luthaf 96d2432
C API tutorials for custom models and plugins (#320)
EricBoittier f8e8828
Pass through exceptions in the C++ bindings
RMeli 3856716
API to define plugins in C++
RMeli 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.