1) Has anyone tried to write up Protocol Buffers .proto files for Stan's _input_ arguments?
2) Is the argument hierarchy defined in the CmdStan manual the most authoritative thing to go from for writing the .proto files?
Background:
I (finally) had some time to figure out how CmdStan's command.hpp works and I think I can see how to do a branch that does streaming I/O through Protocol Buffers. I'm thinking of this as doing a mock-up of the I/O issues that would come up in doing a server version of Stan. My steps would be:
1) Define .proto files for CmdStan's command-line argument tree
2) Replace the argument parser (basically a temporary hack) with something to build up protocol buffers messages from command line arguments.
3) Replace the parser-argument logic in command.hpp (stuff like if (parser.arg("method")->arg("sample")) { ) with logic based on arguments extracted from the protocol buffers messages.
4) Define .proto files for CmdStan's output, I'm thinking output messages would be something like original input messages + adaptation parameters + sample/optimizer/etc... messages.
5) Modify the command.hpp output to produce protobuf messages and see about getting R to swallow them (R just because I know how to write interface code for R and there's a protocol buffers library)...
I think that path would let me test things well enough at each step so that I don't run into problems...
Krzysztof
Understood. I've been following the refactor and I think I know what's going on. Having the writer refactor go through should make things a lot simpler but I don't see it being time consuming to deal with changes.
> 1) Not that I know of, but we've been thinking about it.
> Allen's thoughts were that if we could define a protocol buffer
> for input and output, it'd be easy to write a container for Stan
> and call it that way.
Ok, good to know. I'll give it a shot and see what people say.
> 2) Code is always more authoritative than doc. You can run it
> and it's self documenting --- that should be most up to date
> because it's mirroring the code.
That's why I was thinking the right step after defining the .proto files would be to splice message construction/use into the middle of CmdStan so the two could be compared. I know there isn't much end-to-end testing but this might be the
>
> - Bob
Thanks, I'll put what I can together and drop a link here. I had some surprises land in my lap recently so it might be next week.