cmdstanr icon indicating copy to clipboard operation
cmdstanr copied to clipboard

STANCFLAGS in make/local doesn't work

Open avehtari opened this issue 3 years ago • 1 comments

Describe the bug make/local can be used to set CXXFLAGS, LDLIBS, O, STAN_CPP_OPTIMS, STAN_NO_RANGE_CHECKS, but STANCFLAGS set in make/local is not used.

To Reproduce Add to make local

STANCFLAGS=--O1

Run

file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
cmdstan_model(file, force_recompile = TRUE, quiet=FALSE)

and look at the line after --- Translating Stan model to C++ code ---

Expected behavior Use STANCFLAGS from make/local

Operating system Your operating system (e.g. mac os x 10.15, windows 10, etc.)

CmdStanR version number Your CmdStanR version number (e.g. from packageVersion("cmdstanr")).

Additional context Add any other context about the problem here.

avehtari avatar Aug 01 '22 11:08 avehtari

Thanks!

Don't have time to address this right away, just noting down what is the underlying issue, so I dont forget: Here we set some stancflags like the model name and include paths if there are any: https://github.com/stan-dev/cmdstanr/blob/master/R/model.R#L563

We set those flags are STANCFLAGS += ... but seems that += does not do the job and the past value of STANCFLAGS set in make/local are ignored.

One way of fixing it would be reading stancflags using make print-STANCFLAGS and then appending that.

rok-cesnovar avatar Aug 01 '22 12:08 rok-cesnovar