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

Instructions on how to use core Stan directly in C++ #3086

Open
rok-cesnovar opened this issue Nov 19, 2021 · 3 comments
Open

Instructions on how to use core Stan directly in C++ #3086

rok-cesnovar opened this issue Nov 19, 2021 · 3 comments

Comments

@rok-cesnovar
Copy link
Member

Description:

We need some easy to follow instructions on how to use the core Stan inside a user-written C++ program. See #3085 for example.

The instruction can simply guide through the task of compiling one of the models and running MCMC with the services. The biggest challenges are typically all the dependencies that we need to include in the C++ compiler calls.

Current Version:

v2.28.1

@wjc86
Copy link

wjc86 commented Mar 8, 2023

Has any progress been made on this issue? I'm looking to use a Stan model directly in a C++ program, without parsing a csv from CMDSTAN, and this issue is all I've been able to find

@bob-carpenter
Copy link
Contributor

The thing to do is compile a model and look at the generated .hpp file. It's a C++ program that depends on the Stan math library, but can be used on its own. The interface is pretty simple. We've shown how to wrap it up in a very simple C wrapper for export as part of BridgeStan: https://github.com/roualdes/bridgestan [Even if you don't want BridgeStan, it has a very minimal build file for models and required dependent libraries and exercises most of the model interface.]. It assumes JSON data as input to construct an instance of the class (I think you may also still be able to do this with the R dump file.)

@wjc86
Copy link

wjc86 commented Mar 9, 2023

Great, thank you! This seems like exactly what I need

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

No branches or pull requests

3 participants