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

mod$variables works w includes in precompile state (fix #680) #682

Merged

Conversation

MKyhos
Copy link
Contributor

@MKyhos MKyhos commented Jul 28, 2022

Naive attempt to tackle #680.

Description

Approach
Adapt the CmdStanModel$variables() query method in such a way that it returns either private$include_paths_ or private$precompile_include_paths_.

Alternative that was considered:
During call to model_variables(), make the value passed to the include_paths argument dependent on the state of the model. I.e., if no executable is present, insert private$precompile_include_paths_, and otherwise self$include_paths().

Concerns: it seems somewhat not optimal to query the state of the model (compiled / not compiled) via the existence of the executable, but I saw this approach also elsewhere in the code.


Submission Checklist

  • Run unit tests
  • Add unit tests for added / fixed behavior.
  • Declare copyright holder and agree to license (see below)

Summary

Please describe the purpose of the pull request.

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):
INSERT COPYRIGHT HOLDER HERE

Malte Kyhos

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@MKyhos MKyhos changed the title 680 mod variables w includes precompile mod$variables works w includes in precompile state (fix #680) Jul 28, 2022
Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MKyhos. Congrats on your first merged contribution to cmdstanr 🎉 🎉 ! We appreciate it!

@MKyhos
Copy link
Contributor Author

MKyhos commented Jul 29, 2022

Thank you @rok-cesnovar :) I was wondering, maybe an active binding for the state of a model (compiled / not compiled) would be beneficial? It would hide the logic, given that there could be even more sophisticated checks that do not fit well into a condition.

@rok-cesnovar
Copy link
Member

maybe an active binding for the state of a model (compiled / not compiled) would be beneficial?

Agreed, though this PR is good to go as is. Maybe if you have time, a refactor is always welcome.

@MKyhos
Copy link
Contributor Author

MKyhos commented Jul 29, 2022

Cool :) Then merge whenever suits you, I will not add something on this branch / PR 👍

@rok-cesnovar rok-cesnovar merged commit 9ad2918 into stan-dev:master Jul 29, 2022
@MKyhos MKyhos deleted the 680-mod-variables-w-includes-precompile branch November 24, 2022 21:25
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

Successfully merging this pull request may close these issues.

2 participants