sakrejda / protostan Goto Github PK
View Code? Open in Web Editor NEWThin protobuf interface wrapper for Stan
License: BSD 3-Clause "New" or "Revised" License
Thin protobuf interface wrapper for Stan
License: BSD 3-Clause "New" or "Revised" License
I'm happy to work on this but I don't want to start if you're already on it.
Protostan should be very fast to clone (without submodules). Not sure how best to fix this. It should be fixed though.
Prototyping actual use of protostan+stan will be easier to do in C++. It's too hard to do in Python right now because protobuf3 is still in beta.
The way the makefile works right now we get a stanc.pb.cc which has this line
``
but our source directory is
src/so this needs to be
``
Per discussion.
This project would be more useful if it used gRPC as the serialisation / message handling layer instead of the manual length-prefixed serialisation code it currently uses. The change would not be that fundamental, as gRPC is also based on Protocol Buffers.
Benefits:
The tests should test every possible outcome for stanc
From an email from Bob
>> Right now, there's two ways to fail. You can either get
>> an exception in the code when there's a failed expectation
>> (such as an opening brace without the expected close brace)
>> and a parse failure when the program's ill formed for other
>> reasons. This is just the behavior inherited from the Spirit
>> Qi parser, but we could always take a negative return and
>> throw an exception.
Tests for these conditions must be somewhere in cmdstan or stan, right?
Currently the Makefile forces the user to use the included protoc which isn't ideal. The default case will be that the user already has protoc installed (via their operating system package manager).
Is it alright if we standardize on Google's C++ style? https://google.github.io/styleguide/cppguide.html
I find the lack of firm conventions in C++ maddening.
'stanc' is a cmdstan-ism. Using compile
everywhere (incl. filenames) is clearer.
I think they should be put in src/stan/proto
in keeping with the namespace.
The pull request was fully tested but now it only makes sense to me:
There's some opportunity for code reuse in the Makefile.
@sakrejda let me know when you're done working on the Makefile for a bit and I'll work on this.
I think the in_file_name
argument is dead code. I'll double check.
(Related to #13)
The change in nomenclature is part of the Stan 3 refactor.
Do we need to drop the namespaces for the shim to be usable from programming languages that only wrap C functions? Will everything need to be declared extern "C"
or should the shim library be written in C?
What's the best way to document the proto files and the shim C++ files? It would be nice to automatically generate HTML docs for future interface writers.
Once this is done we can move on to bigger fish.
Travis seems to have gcc 4.6.3 which doesn't support C++11 (?) which is used in some of the newer code.
Try compiling "invalid model code"
As a demonstration it might be useful to have a program written in C which uses the interface. Maybe put it in examples/c
? (https://github.com/protobuf-c/protobuf-c)
cpplint: https://github.com/google/styleguide/tree/gh-pages/cpplint
I think this isn't difficult to do. Perhaps Stan has done this already?
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.
To check on how much CPU is chewed up going from Eigen data types to Protocol Buffers in practice, do a simple writer which:
We should have a license. Since it's just a wrapper I feel like MIT or CC0 might be reasonable.
Looks like:
Looks like we are exposing three types of things: 1) messages; 2) thin wrappers; and 3) callbacks. So generalizing to a namespace policy:
@ariddell Feel free to comment, close if you agree and I'll write it up as a Wiki thing and/or add to README.md
To check on how much CPU is chewed up going from Eigen data types to Protocol Buffers in practice, do a simple writer which:
Right now g++ is hard-coded so clang doesn't get used on travis.
So the file name argument in stan::lang::compile (in_file_name
) is purely aesthetic -- it's used in the error messages, as far as I can tell.
* @param in_file_name Name of input file to use in error
* messages; defaults to <code>input</code>.
I think we should drop it or rename the field (to in_file_name?) in StanCompileRequest. Right now I think it would be very easy to think that it's the location of a source file where the model code is stored.
Thoughts @sakrejda?
I've done some some work on this already. Basically travis needs to run (separately) make cpplint and make test. and report the results.
On Jenkins/Travis
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.