I’d like to maintain a forked stanc3 and use it along with cmdstan & math. Instead of downloading a nightly build of binary as in cmdstan 2.22, is there a cmdstan branch somewhere in which stan submodule is stanc3? If not, what need to be done to replace stan submodule with stanc3? @Matthijs @rok_cesnovar @mitzimorris
The Stan submodule is still used for the algorithms parts, so I guess stanc3 will only replace the /lang parts of
stan-dev/stan. I am not sure if there is a plan on when and how that will be done.
If you want to use your forked version of stanc3, the simplest way is to set the
STANC3 make variable to the path to your stanc3.
Setting up a submodule stanc3 with cmdstan is also really simple. I pushed a branch where stanc3 is cloned to
src/stanc3 and a default value for the path set. The better path would probably be in
stan/src/... but this way I only needed to make a cmdstan branch.
Right, sorry I wasn’t being clear.
I assume eventually stanc3 will replace stanc2. Do we plan to do binary download even after that?
Didn’t notice that, thanks.
Yes, that is the plan I think. Though I would personally wait at least until we have stanc3 in rstan for a release cycle before removing the stanc2 sources from the repo. Because that is when stanc3 will hit the majority of the users and we want to have a simple way of debugging issues.
The binary is downloaded only on the develop (clone) versions. In release tarballs the binaries are already present, so there is no need for additional downloading.
The makefiles for cmdstan work like this for stanc (as of 2.22):
- if STANC3 is set, build stanc3 from source using dune build
- if no STANC3 and if there is a OS-specific binary present (bin/windows-stanc, bin/linux-stanc, bin/mac-stanc) then rename the applicable to bin/stanc
- if none of the above applies, download the appropriate binary from stan-dev/stanc3
A huge downside of not downloading binaries is that requires building Ocaml code which means installing all the tools. I dont think we want to go that way.
Just another note for anyone that will go the route of your cmdstan including binaries directly and want to make your binaries be actually portable.
On a mac its
dune build @install
On linux run
dune build @install --profile static
otherwise you get a
version GLIBC_2.29 not found (require... error.
On windows run
dune build -x windows
This is all taken from how jenkins build the binaries, see https://github.com/stan-dev/stanc3/blob/master/Jenkinsfile#L162 and lines below.
This really should be more notably written down somewhere…
building the Ocaml binaries means installing specific versions of the Ocaml libraries - you need to run https://github.com/stan-dev/stanc3/blob/master/scripts/setup_dev_env.sh