-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Add dispatcher object to callbacks to coordinate sampler outputs #3334
Conversation
clang auto-formatting is introducing errors for the linter. |
…v/stan into feature/in-memory-writer
here is a chat I've been having with Claude 3.7 about how the in-memory sample could be accessed by R and Python. |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Is there a design goal you have in mind for that which isn't answered by something like the existing code in tinystan? In a bigger picture sense, I'm not sure that this would make sense to live in the Stan repo as opposed to a consumer (like tinystan or a future cmdstan-derived thing). I think focusing on what the API would look like (e.g. the router class, new sets of base classes, or improved services) is more important than on any specific instantiation of it (e.g. something that derives from one of the new base classes and stores its results in a buffer) at this point Asides on Claude:
I can't see the files you provided as input to the model, but I'm guessing this is some AI-"yes-man" behavior where it doesn't seek to criticize. This is in fact a very difficult design to make work compared to the allocation happening externally. It is a general requirement that allocations and deallocations happen in the same library/module (especially if you want any hope of working on Windows, where we don't compile against the same libc as Python would), which also means that handing long-lived pointers between modules is fraught in general. Especially when one side is garbage collected, it is usually infinitely easier to have that side be in charge of memory that needs to be shared between them, otherwise you will end up with use-after-frees, double-frees, or lots of additional copy operations. One way to see this is to think about RAII and where the eigen matrix you're storing the draws in would get freed by C++. If you wrote wrapper calls to This is why tinystan operates the way that it does. RStan lets R manage the memory (it gets this more or less 'for free' by using Rcpp) and Pystan writes back into python using a socket (Pystan2 was much more similar to RStan)
This is a more minor point, but this is false. Python is largely agnostic but actually defaults to row-major. |
Closing this PR. |
Submission Checklist
./runTests.py src/test/unit
make cpplint
Summary
Implement proposals in design-doc 32: https://github.com/stan-dev/design-docs/blob/master/designs/0032-stan-output-formats.md, starting by adding a dispatcher class to the stan::callbacks namespace.
Intended Effect
How to Verify
unit tests
Side Effects
??
Documentation
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Columbia University
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: