stan C++ library compilation

90 views
Skip to first unread message

Miguel de Val-Borro

unread,
Oct 23, 2015, 3:00:45 PM10/23/15
to Stan users mailing list
I am interested in making packages of stan C++ and the Stan interfaces
for a linux system. I would like to compile the Stan C++ package from
the repository:
https://github.com/stan-dev/stan
Could you givve some indications to compile the library?

Thanks,
Miguel

Daniel Lee

unread,
Oct 23, 2015, 3:07:15 PM10/23/15
to stan-...@googlegroups.com
Hi Miguel,

I don't understand what you want to do. Perhaps you could look at CmdStan and let us know if that is what you're looking for? Or some more detail would help. 


Daniel
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bob Carpenter

unread,
Oct 23, 2015, 3:08:07 PM10/23/15
to stan-...@googlegroups.com
You mean all the interfaces? I don't know how to do that,
but the CmdStan interface has a makefile.

Stan also does code generation on the fly, so needs a C++
compiler to really work.

- Bob

> On Oct 23, 2015, at 3:00 PM, Miguel de Val-Borro <miguel...@gmail.com> wrote:
>

Miguel de Val-Borro

unread,
Oct 23, 2015, 3:37:27 PM10/23/15
to Stan users mailing list
I wanted to make separate packages for Stan C++, pystan, rstan etc so that
all the interfaces depend on Stan C++ and is not installed independently.
I am not sure if this could work because I am not familiar with the source.

marmaduke woodman

unread,
Oct 23, 2015, 4:05:40 PM10/23/15
to stan-...@googlegroups.com
On 10/23/2015 09:37 PM, Miguel de Val-Borro wrote:
> I wanted to make separate packages for Stan C++, pystan, rstan etc so that
> all the interfaces depend on Stan C++ and is not installed independently.
> I am not sure if this could work because I am not familiar with the source.

For debian you'd have have a set of packages, one per interface all
depending on a stan-dev package as well as standard c++ compiler package.

Python packages usually have names like python-pystan, and I think R as
is similar.

There's a lot of documentation on packaging at least for Debian, so it
would be best to start there, to see how to package c++ stuff (for Stan
& CmdStan) and then for the individual interfaces.

Bob Carpenter

unread,
Oct 23, 2015, 5:19:55 PM10/23/15
to stan-...@googlegroups.com
RStan depends on other R packages, which include
bits of what are needed for Stan's source:
StanHeaders, RcppEigen, and BH.

- Bob

Ben Goodrich

unread,
Oct 23, 2015, 6:57:19 PM10/23/15
to Stan users mailing list
On Friday, October 23, 2015 at 3:37:27 PM UTC-4, Miguel de Val-Borro wrote:
I wanted to make separate packages for Stan C++, pystan, rstan etc so that
all the interfaces depend on Stan C++ and is not installed independently.
I am not sure if this could work because I am not familiar with the source.

This could work, but it is a lot of effort just to conserve disk space. I started to write a script to do this for linux servers a few months ago and then lost it when my battery died. It went something like this:
  1. Do a git clone of CmdStan and make sure to pull in the Stan Math Library git submodule
  2. Set environmental variables for STAN_HOME and CMDSTAN_HOME
  3. Download JuliaStan, MatlabStan, and perhaps StataStan. Those all just call CmdStan but need to have environmental variables to tell them where to look.
  4. In R, do install.packages("StanHeaders") and then go into the directory where the StanHeaders package is installed and replace the include/stan directory with a symlink to ${CMDSTAN_HOME}/stan/lib/stan_math/stan and replace the include/src directory with a symlink to ${CMDSTAN_HOME}/stan/src.
  5. In R, do install.packages("rstan")
That would probably get you 90 percent of the way there, but there are probably some things I am forgetting. PyStan seems to insist on copying everything it needs to a build directory, so I'm not sure if you could get it to work off of the submodules of CmdStan.

Ben
 

Allen B. Riddell

unread,
Oct 24, 2015, 3:59:22 AM10/24/15
to stan-...@googlegroups.com
I looked into debian packaging awhile back. It's certainly possible but
it's rather a lot of work. One thing you would have to do is use the
Debian system boost and Eigen libraries.

I think packaging CmdStan is definitely the place to start. RStan and
PyStan will be more difficult.

Best,

Allen
Reply all
Reply to author
Forward
0 new messages