-
Notifications
You must be signed in to change notification settings - Fork 508
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Multiple backend C++ API #3119
Labels
Milestone
Comments
This was referenced Jan 9, 2024
wanghan-iapcm
pushed a commit
that referenced
this issue
Jan 15, 2024
See #3119. At this time, only TF is supported in such the multiple-backend framework. --------- Signed-off-by: Jinzhe Zeng <[email protected]>
njzjz
added a commit
to njzjz/deepmd-kit
that referenced
this issue
Jan 16, 2024
See deepmodeling#3119 Signed-off-by: Jinzhe Zeng <[email protected]>
wanghan-iapcm
pushed a commit
that referenced
this issue
Jan 17, 2024
See #3119 --------- Signed-off-by: Jinzhe Zeng <[email protected]>
wanghan-iapcm
pushed a commit
that referenced
this issue
Jan 17, 2024
See #3119 --------- Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 28, 2024
need to test in union environment (tf and pt) see #3119 --------- Signed-off-by: Lysithea <[email protected]> Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng <[email protected]> Co-authored-by: Han Wang <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Propose a multiple backend C++ API. The backend can be switched according to the file format.
Detailed Description
Backend independent library
When @wanghan-iapcm designed v1,
libdeepmd.so
has been backend-independent, so we can just reuse it.Factory method pattern
Take the example of
DeepPot
. Move the currentDeepPot
toDeepPotTf
. Create a base classDeepPotBase
, with two subclasses inherited,DeepPotTf
andDeepPotPt
. Create a wrapper class,DeepPot
, to keep the same API as the current one, so no downstream codes need to change.The wrapper class may look like:
The list of public APIs can be found in
deepmd.hpp
andc_api.cc
. Not implemented methods can throw an exception.Backend detection
The backend can be detected from the model file described below:
PK
.If a backend is not enabled, we should skip it.
If a backend fails to read the file, continue to the next backend (assume there is a list).
If all backends fail, throw the error, with errors of each backend.
DeepPotModelDevi
DeepPotModelDevi
may need to be refactored. The current implementation requires 4 models to come from the same backend, while they may come from different backends.Further Information, Files, and Links
No response
The text was updated successfully, but these errors were encountered: