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

Allow instantiate to build cmdstanr-based packages without install as source #26

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

stemangiola
Copy link
Contributor

Prework

  • [ x] I understand and agree to the Contributor Code of Conduct.
  • [ x] I have already submitted a GitHub Discussion topic to discuss my idea with the maintainer.

Related GitHub issues and pull requests

#25 (reply in thread)

Summary

Hello,

I have prepared a pull request that enables instantiate to build cmdstanr-based packages without requiring users to install the package from the source (install.packages(..., type = "source")). This enhancement allows packages like sccomp (linked below) to be installed and compiled just like any other R package, simplifying the installation process for end-users.

https://github.com/MangiolaLaboratory/sccomp/tree/cmdstanr

For example, in the sccomp package, I have implemented the following:

•	The models are compiled once and cached when needed, avoiding the need to install from the source.
•	The process leverages several utilities from instantiate to handle the compilation efficiently, including stan_package_model() and stan_package_compile().

The PR would be very light, from here

https://github.com/stemangiola/instantiate

This would be the only simple change

image

This is how I am using this edited function

    mod = instantiate::stan_package_model(
      name = name, 
      package = "sccomp", 
      compile = TRUE,
      cpp_options = list(stan_threads = TRUE)
    )

Thanks for considering this PR

Copy link
Owner

@wlandau wlandau left a comment

Choose a reason for hiding this comment

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

Thanks, looks good, I just added a couple minor changes to your PR before merging.

@wlandau wlandau merged commit 6c27ed7 into wlandau:main Oct 2, 2024
3 of 14 checks passed
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