sakrejda / protostan

Thin protobuf interface wrapper for Stan
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Minimal example C++ project #28

Closed ariddell closed 8 years ago

ariddell commented 8 years ago

We need a good, simple example of using protostan in a C++ project as a library. (pystan-protostan is opaque to people who don't know Python.) The point here is mainly to show how you can use this repo (shallow clone), the stan source code, and preinstalled libprotobuf and protoc to do something useful.

My only idea right now is a binary validate_stan_program which just reads a .stan file and returns 0 if everything is ok and 1 if things are not ok (and writes something to stderr).

This little example project would have its own Makefile and instructions.

sakrejda commented 8 years ago

The issue I see with something simple is that it's not straightforward, as far as I can tell, what the in-memory gymnastics would be to hand over data fast enough, avoid the message size limit, and stick to standard protobuf. Not as much of an issue if you're sending small messages in the server-client context.

ariddell commented 8 years ago

I'm thinking an example project would be useful to iron out some of the details about how someone would use protostan + stan. (pystan-protostan can't fill that role because the Python/C++ extension building completely opaque to non-Python users.) For example, someone distributing software using the stan + protostan interface could ship the generated .pb.c and .pb.h files; they don't need to (have the end user) worry about protoc. This would make for a leaner Makefile.

I'm happy to work on this. I think the simple example would be useful in its own right and it would also help me think through about how I'll package pystan-protostan.

(What does this have to do with the size limit? We're not going to have any individual messages bigger than 512M.)

ariddell commented 8 years ago

Here's an example of the kind of thing that would be cool to have (just to iron out the details): https://github.com/joshrotenberg/zmqpbexample

I think by using autotools you can also deal with the issue of allowing someone to use their own local copy of protobuf if they want to. I might be wrong about this.

ariddell commented 8 years ago

We can just make cmdstan-protostan the example -- we don't need two examples.