-
Notifications
You must be signed in to change notification settings - Fork 1
ENH: Add RPC support #18
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
base: main
Are you sure you want to change the base?
Conversation
Since pycapnp uses dictionaries
|
Note that, thankfully, there is no real difference between working with this "simpler interface": @0xbd1f89fa17369103;
# Design kanged from eOn v4 C-style structs
# TODO(rg): Should be more object oriented
struct ForceInput {
natm @0 :Int32; # TODO(rg): Do we really need this..
pos @1 :List(Float64);
atmnrs @2 :List(Int32);
box @3 :List(Float64);
}
struct PotentialResult {
energy @0: Float64;
forces @1: List(Float64);
}
interface CuH2Pot {
calculate @0 (fip :ForceInput)
-> (result :PotentialResult);
}Or this redundant one: struct Position {
x @0 :Float64;
y @1 :Float64;
z @2 :Float64;
}
struct AtomMatrixRPC {
positions @0 :List(Position);
}
struct BoxMatrix {
box @0: List(Vector);
}
struct Vector {
x @0: Float64;
y @1: Float64;
z @2: Float64;
}
struct AtomTypes {
atomTypes @0: List(Int32);
}
struct PotentialResult {
energy @0: Float64;
forces @1: List(ForceVector);
}
struct ForceVector {
x @0: Float64;
y @1: Float64;
z @2: Float64;
}
interface CuH2Pot {
calculate @0 (positions :AtomMatrixRPC, atomTypes :AtomTypes, boxMatrix :BoxMatrix)
-> (result :PotentialResult);
}Which is essentially the design in 0e3d99c and 1dd36ad. Basically there is no time difference for running two servers.
Where Essentially this seems to suggest that more nested structures are OK, which is better (needs testing of course for buffer size) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces RPC (Remote Procedure Call) support to the project using Cap'n Proto. The implementation allows for remote calculation of potential energies and forces for the CuH2 potential through a client-server architecture.
- Adds Cap'n Proto RPC server and Python client implementation for remote potential calculations
- Updates C++ standard to C++20 and adds necessary dependencies (capnproto, pycapnp, etc.)
- Includes build system integration with conditional RPC compilation
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pixi.toml | Adds Cap'n Proto and Python dependencies for RPC support |
| meson_options.txt | Adds with_rpc build option to conditionally enable RPC features |
| meson.build | Updates C++ standard from C++17 to C++20 for RPC compatibility |
| CppCore/rgpot/rpc/server.cpp | Implements Cap'n Proto RPC server for CuH2 potential calculations |
| CppCore/rgpot/rpc/pyclient.py | Python client for connecting to and using the RPC server |
| CppCore/rgpot/rpc/meson.build | Build configuration for RPC server and library |
| CppCore/rgpot/rpc/Potentials.capnp | Cap'n Proto schema definition for potential calculation interface |
| CppCore/rgpot/LennardJones/meson.build | Code formatting improvements |
| CppCore/rgpot/CuH2/meson.build | Code formatting improvements |
| CppCore/meson.build | Integrates RPC subdirectory when option is enabled |
| .pre-commit-config.yaml | Adds meson formatting to pre-commit hooks |
| .github/workflows/build_test.yml | Renames job from buildmamba to buildpixi |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The design is still being threshed out.