Skip to content
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

ENH: Add RPC support #18

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

ENH: Add RPC support #18

wants to merge 18 commits into from

Conversation

HaoZeke
Copy link
Contributor

@HaoZeke HaoZeke commented Oct 8, 2024

The design is still being threshed out.

@HaoZeke
Copy link
Contributor Author

HaoZeke commented Oct 8, 2024

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.

Command Mean [ms] Min [ms] Max [ms] Relative
python oclient.py localhost:12345 108.8 ± 12.7 98.9 143.3 1.00
python pyclient.py localhost:12346 109.4 ± 18.3 99.0 182.8 1.01 ± 0.21

Where oclient is the ForceInput variant, and pyclient is the redundant form.

Essentially this seems to suggest that more nested structures are OK, which is better (needs testing of course for buffer size).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant