feat: rgpot-compatible RPC serve mode with gateway#316
Merged
HaoZeke merged 17 commits intoTheochemUI:mainfrom Feb 24, 2026
Merged
feat: rgpot-compatible RPC serve mode with gateway#316HaoZeke merged 17 commits intoTheochemUI:mainfrom
HaoZeke merged 17 commits intoTheochemUI:mainfrom
Conversation
eOn Documentation PreviewDownload: documentation.zip Unzip and open |
Benchmark ResultsNote All benchmarks unchanged
8 unchanged benchmark(s)
Details
Raw asv-spyglass output |
Add serve mode to eonclient that wraps any eOn potential as an rgpot PotentialBase served over Cap'n Proto RPC. Supports four operating modes: - Single-potential: `eonclient -p lj --serve-port 12345` - Multi-model: `eonclient --serve "lj:12345,eam_al:12346"` - Replicated: `eonclient -p lj --serve-port 12345 --replicas 4` - Gateway: `eonclient -p lj --serve-port 12345 --replicas 6 --gateway` Gateway mode exposes a single port backed by a round-robin pool of potential instances, so clients need only one address. All modes are also configurable via INI config file with a [Serve] section (host, port, replicas, gateway_port, endpoints). Implementation uses a two-TU architecture to avoid naming collision between eOn's Potential class and capnp-generated Potential interface. Includes meson build integration (with_serve option, rgpot subproject wrap), Catch2 unit tests for parseServeSpec, Python schema (schema.py), config.yaml section, and user documentation.
- Set pure_lib: false for rgpot subproject (serve mode needs full lib) - Move serve sources to eonclib_sources (fixes test linking) - Trim whitespace after colon-split in parseServeSpec (fixes "lj : 12345" parsing where trailing space broke enum_cast)
Replace rgpot::PotentialBase virtual interface with a flat-array ForceCallback (std::function) to avoid the name collision between eOn's Eigen-based AtomMatrix and rgpot's custom AtomMatrix type. Both were defined at global scope, causing segfaults when capnp dispatched through the wrong vtable layout. The serve code now only links ptlrpc_dep (capnp schema) from rgpot with with_rpc_client_only:true -- no rgpot types cross the TU boundary. ServeMode.cpp wraps eOn's Potential::force() in a lambda, and ServeRpcServer.cpp converts capnp data to flat arrays directly.
Torch 2.9 bundles fmt 11.2 internally; pixi's spdlog was compiled against pixi's fmt. With fmt>=12 the ABI mismatch caused linker errors when building metatomic+serve together. Pin fmt to v11 for the metatomic feature so both torch and spdlog use the same fmt ABI. Also adds towncrier fragment for the AtomMatrix collision fix and updates serve_mode.md with architecture notes and corrected Julia API.
capnproto is available on win-64 and the serve code uses no POSIX APIs, so enable the serve feature on Windows. Also remove unused <csignal> and <atomic> includes from ServeMode.cpp.
8e9c0d8 to
db0f30f
Compare
2 tasks
Add run_*.py scripts to each major example directory (akmc-al, akmc-pt, akmc-cu-vacancy, basin-hopping, parallel-replica, neb-al) showing the equivalent config.ini expressed as Python dicts via write_eon_config. Also adds an advanced NEB example with climbing image, energy-weighted springs, and MMF options. New tutorial page (dict_config.md) documents the approach with side-by-side INI/Python comparisons and a parameter sweep example. References eon.schema as the single source of truth for option names.
…ples docs: add dictionary-style config examples using `rgpycrumbs`
Add serve mode to eonclient that wraps any eOn potential as an rgpot PotentialBase served over Cap'n Proto RPC. Supports four operating modes: - Single-potential: `eonclient -p lj --serve-port 12345` - Multi-model: `eonclient --serve "lj:12345,eam_al:12346"` - Replicated: `eonclient -p lj --serve-port 12345 --replicas 4` - Gateway: `eonclient -p lj --serve-port 12345 --replicas 6 --gateway` Gateway mode exposes a single port backed by a round-robin pool of potential instances, so clients need only one address. All modes are also configurable via INI config file with a [Serve] section (host, port, replicas, gateway_port, endpoints). Implementation uses a two-TU architecture to avoid naming collision between eOn's Potential class and capnp-generated Potential interface. Includes meson build integration (with_serve option, rgpot subproject wrap), Catch2 unit tests for parseServeSpec, Python schema (schema.py), config.yaml section, and user documentation.
- Set pure_lib: false for rgpot subproject (serve mode needs full lib) - Move serve sources to eonclib_sources (fixes test linking) - Trim whitespace after colon-split in parseServeSpec (fixes "lj : 12345" parsing where trailing space broke enum_cast)
Replace rgpot::PotentialBase virtual interface with a flat-array ForceCallback (std::function) to avoid the name collision between eOn's Eigen-based AtomMatrix and rgpot's custom AtomMatrix type. Both were defined at global scope, causing segfaults when capnp dispatched through the wrong vtable layout. The serve code now only links ptlrpc_dep (capnp schema) from rgpot with with_rpc_client_only:true -- no rgpot types cross the TU boundary. ServeMode.cpp wraps eOn's Potential::force() in a lambda, and ServeRpcServer.cpp converts capnp data to flat arrays directly.
Torch 2.9 bundles fmt 11.2 internally; pixi's spdlog was compiled against pixi's fmt. With fmt>=12 the ABI mismatch caused linker errors when building metatomic+serve together. Pin fmt to v11 for the metatomic feature so both torch and spdlog use the same fmt ABI. Also adds towncrier fragment for the AtomMatrix collision fix and updates serve_mode.md with architecture notes and corrected Julia API.
capnproto is available on win-64 and the serve code uses no POSIX APIs, so enable the serve feature on Windows. Also remove unused <csignal> and <atomic> includes from ServeMode.cpp.
Replace manual config table with autopydantic directive, add pixi serve environment to compilation instructions, fix ASCII punctuation, remove internal function name references, and link rgpot integration guide.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
eonclient --servemode that wraps any eOn potential as an rgpot PotentialBase over Cap'n Proto RPC[Serve]INI section (host, port, replicas, gateway_port, endpoints)Potentialvs capnpPotentialname collision-Dwith_serve=true), rgpot subproject wrap, Catch2 unit testsserveenvironment, CI workflowFunctionality
-p lj --serve-port 12345--serve "lj:12345,eam_al:12346"-p lj --serve-port 12345 --replicas 4-p lj --serve-port 12345 --replicas 6 --gateway--config serve.ini[Serve]INI section