-
-
Notifications
You must be signed in to change notification settings - Fork 63
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 model methods once and reuse for all models #894
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #894 +/- ##
==========================================
+ Coverage 88.28% 88.32% +0.03%
==========================================
Files 12 12
Lines 4534 4592 +58
==========================================
+ Hits 4003 4056 +53
- Misses 531 536 +5 ☔ View full report in Codecov by Sentry. |
I tested as
and got
Can you provide more instructions on how to test this? |
@avehtari Thanks for catching that issue! It looks like Linux needs the Stan model to be compiled with an additional flag for R to be able to link to it afterwards. I've pushed a fix and the CI is passing, can you pull the changes and try again when you get a minute? |
I get the same error |
c4d2461
to
7c28d7e
Compare
Awesome! Thanks for working on this. |
e2f91e4
to
733e052
Compare
Sorted! This is ready for review now |
Compilation and re-use of model methods in other model worked. But it seems I still need to recompile every model in a session, and I just save the time not needing to recompile the model methods part several times? As the models usually don't need to be recompiled, can you explain why the model methods can't be used with pre-compiled models? |
Compiling
|
Looks related to this: https://discourse.mc-stan.org/t/segfault-when-using-brms-cmdstanr-compile-model-methods-true/33771/4 Can you try compiling with |
Another error
|
That call stack indicates that you're not on this branch, since it's using the "old" pathway for exposing model methods |
Either way I'll have a proper look into this tomorrow and add a fix |
After rebuilding with threads I get
|
63be35d
to
c23f522
Compare
FYI that I'm going to leave this PR for the v1.0/CRAN branch. A lot of the complexity/issues here are caused by the windows cmdstan using Once we move to RTools-only on windows, this PR/implementation will be much simpler and easier |
Submission Checklist
Summary
This PR adds the ability for the model methods to be pre-compiled and then simply linked to the object file produced by cmdstan. This will significantly speed up users' workflows, as they only need to perform the model method compilation once, instead of every time
$init_model_methods()
is calledCopyright 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):
Andrew Johnson
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: