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

Add option to keep object file after compiling model #1186

Closed
wants to merge 1 commit into from

Conversation

andrjohns
Copy link
Contributor

Submisison Checklist

  • Run tests: ./runCmdStanTests.py src/test
  • Declare copyright holder and open-source license: see below

Summary:

This PR adds a makeflag KEEP_OBJECT to allow keeping the .o object file when compiling a model.

When exposing model methods (log_prob, etc) in cmdstanr we end up having to compile a given model twice - once via cmdstan to generate the executable and once via Rcpp to expose the stan_model typedef to generate a model pointer. If we can still have access to the object file, we can instead just link against it and skip the additional compilation.

Intended Effect:

Reduce unnecessary compilation when exposing model methods in cmdstanr

How to Verify:

Add KEEP_OBJECT=true to make/local

Side Effects:

N/A

Documentation:

N/A

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): Andrew Johnson

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

@mitzimorris
Copy link
Member

will the makefile's "clean" methods get rid of these ".o" files?

@WardBrian
Copy link
Member

will the makefile's "clean" methods get rid of these ".o" files?

The .o files can be left around anywhere on disk (not necessarily under the cmdstan folder) so they wouldn't be

@WardBrian
Copy link
Member

@andrjohns do you mind adding a generic *.o entry to our gitignore? We have one right now specifically for main.o, but if someone has this in their make/local it would become annoying for development etc.

Otherwise I think this can go in

@andrjohns
Copy link
Contributor Author

Obsoleted by #1187

@andrjohns andrjohns closed this Aug 23, 2023
@WardBrian WardBrian deleted the keep-object branch September 30, 2024 20:48
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.

3 participants