stan-dev / stan-dev/cmdstanr

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

Open
#1,019 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
160
Forks
69
Avg merge
1d 19h
Merged PRs (30d)
15

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior through CmdStanModel$compile(..., cpp_options()) and inspect CmdStanModel$cpp_options() alongside the makefile settings. Check how STAN_OPENCL and STAN_THREADS are enabled, reported, and considered when deciding whether to recompile. Done means the compile options and reported values are consistent with the makefile, and changing them triggers recompilation when needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.