stan-dev / cmdstan

CmdStan, the command line interface to Stan
https://mc-stan.org/users/interfaces/cmdstan
BSD 3-Clause "New" or "Revised" License
210 stars 93 forks source link

Expected? cmdstan considers binary up-to-date when make is run with different build args #1294

Open katrinabrock opened 1 month ago

katrinabrock commented 1 month ago

Summary:

cmdstan does not automatically recompile a model when build args change. If this is expected, would be good to document.

Description:

Doc states

If the you call Make with target bernoulli twice in a row, without any editing bernoulli.stan or otherwise changing the system, on the second invocation, Make will determine that the executable is already newer than the Stan source file and will not recompile the program:

It's unclear whether changing a build arg such as STAN_THREADS or STAN_OPENCL constitutes "otherwise changing the system". Would be good to clarify this.

Reproducible Steps:

make examples/bernoulli/bernoulli
STAN_THREADS=true make examples/bernoulli/bernoulli

I got the same behavior editing make/local.

Current Output:

make: 'examples/bernoulli/bernoulli' is up to date.

Expected Output:

Describe what you expect the output to be. Knowing the correct behavior is also very useful.

Additional Information:

Related cmdstanr discussions: https://github.com/stan-dev/cmdstanr/issues/1019 https://github.com/stan-dev/cmdstanr/pull/1022

Current Version:

v2.35.0

WardBrian commented 1 month ago

This is a known bug that is basically not fixable when using make.

There are some ways you can hack around it, and we have some half-attempts at doing so (for example, on a clean install, the example you gave should trigger a rebuild the first time...) but the "right" way to do this is to use a different build system entirely