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

Compile with Stan as a library (Stan 2.22) #217

Closed
2 tasks
riddell-stan opened this issue Oct 11, 2019 · 7 comments
Closed
2 tasks

Compile with Stan as a library (Stan 2.22) #217

riddell-stan opened this issue Oct 11, 2019 · 7 comments
Assignees

Comments

@riddell-stan
Copy link
Contributor

riddell-stan commented Oct 11, 2019

Stan 2.21 requires using TBB as an external library. We can no longer use the header-only approach.

Seems simplest to start with 2.20 and get things working here. We can look at how RStan does it. (I'm almost positive they do not do header-only.)

Fairly sure we have to abandon pbr and use something like numpy's install_clib.

Suggested path:

  • Compile with Stan 2.19.1 without using header-only approach (try numpy build_clib first, it worked in the past)
  • Move to Stan 2.22 "ensure[ing] that nothing of the AD tape global stuff gets compiled into the services", see discussion on static init order problem math#1306
@riddell-stan riddell-stan self-assigned this Oct 11, 2019
@ahartikainen
Copy link
Contributor

I don't think numpy's install_clib works with the current distutils.

PyStan 2 sundials update PR has one "working" solution which could be used. Basically only thing what is "edited" is for .c files. Similar procedure for C++ should work "out-of-the-box" with distutils.

@ahartikainen
Copy link
Contributor

@ahartikainen
Copy link
Contributor

Should we also compile Sundials at setup and only link them to the model?

Then we could compile C++ and C in different steps.

@riddell-stan
Copy link
Contributor Author

Eventually. I want to take this slow though. I think it was a mistake to make a release which didn't have linux or gcc support.

I also do want to identify a "standard" way of distributing compiled libraries, if one exists. If numpy's install_clib no longer works, then we should look at what packages which relied on that are doing now. If no other packages are doing what we are doing then we can, of course, develop a custom solution.

@ahartikainen
Copy link
Contributor

Yeah, we need to find which package has C and C++ (with c++14).

@riddell-stan
Copy link
Contributor Author

It may be worth looking at poetry for this. It looks like there is an undocumented way to add extra steps to the build phase. If we could manage to get to this to work we could build httpstan without the trouble of writing and maintaining a setup.py. pbr lets us do this right now but we will have to abandon it in order to use anything remotely like numpy's build_clib.

Here's an issue in poetry's repo which describes the approach: python-poetry/poetry#1351

@riddell-stan riddell-stan changed the title Compile with Stan as a library Compile with Stan as a library (Stan 2.22) Nov 22, 2019
@riddell-stan
Copy link
Contributor Author

This is no longer really relevant. stanc3 changes these considerations a bit.

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

No branches or pull requests

2 participants