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

Make compile(..., cpp_options()) consistent with makefile options #1019

Open
mippeqf opened this issue Aug 1, 2024 · 1 comment
Open

Make compile(..., cpp_options()) consistent with makefile options #1019

mippeqf opened this issue Aug 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mippeqf
Copy link

mippeqf commented Aug 1, 2024

Several things about enabling TBB and OpenCL are incredibly confusing and documented nowhere:

  1. If STAN_OPENCL or STAN_THREADS are set, they will be enabled regardless of the cpp_options in the compile() function. (I believe this even holds true when they are set to anything (true or false) in the makefile, but am not 100% firm on that.)
  2. The CmdStanModel$cpp_options() returns STAN_OPENCL and STAN_THREADS set to TRUE no matter what is set in the makefile. The actual cpp_options in the compile() function do not change the reported values, although they do work for changing the actual application of either option.
  3. When the cpp_options are changed, the model is not recompiled automatically via the same mechanism that recompiles if the model file changed.

I'm mostly sure that this is the actual behavior on my machine, but I may have forgotten to recompile the model at some point.

@mippeqf mippeqf added the bug Something isn't working label Aug 1, 2024
@katrinabrock
Copy link

1. Potential conflicts between makefile and cpp_options

Q for @mippeqf: When you say "are set" or "set ... in the makefile" do you mean make/local or something else? Can you give a bit more detailed example with expected and actual behavior?

2. Setting and reporting build options is inconsistent and sometimes inaccurate

This is #765 . I'm working on a fix and there's a bit more discussion here: #1022 .

3. No rebuild when cpp options change

This is indeed the current behavior of both cmdstan and cmdstanr. Not sure if it is the intended behavior. I agree it is not well documented.

MRE for cmdstan w/o R. This is without STAN_THREADS in make/local.

~/.cmdstan/cmdstan-2.35.0$ make examples/bernoulli/bernoulli
<compiles>
~/.cmdstan/cmdstan-2.35.0$ STAN_THREADS=true make examples/bernoulli/bernoulli
make: 'examples/bernoulli/bernoulli' is up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants