On 12/2/13, 12:04 AM, Ben Goodrich wrote:
> On Sunday, December 1, 2013 11:22:02 PM UTC-5, Bob Carpenter wrote:
> Although it would be nice if we shared memory between R and Stan,
> we don't currently do that. The memory gets copied from R into member
> variables in the Stan model.
>
>
> I did not know that. Was there a reason besides my inability to recognize the need to add DUP = FALSE to all the .C()
> and .Call() calls?
Only that Stan itself copies the data in its model constructor.
Nothing you can do about that from the outside. We could potentially
rewrite it so that if the memory were local coming from R, we could
share the memory in Eigen using Map. It'd be a pretty big change to
Stan and it wouldn't be possible with array (std::vector) types, because
they don't have constructors that don't copy the data (at least as far
as I know).
>
> > Iff we make regular Stan a system requirement,
>
> I don't know what this means.
>
>
> I thought that was what you were advocating: Requiring the users to have Stan locally and then installing an R package
> that accesses that. No?
Yes. I just didn't know if the "system requirement" terminology
entailed something more than that.
> > but binary installs of an R package doesn't help that much if the user
> > has to compile stanc, libstan, etc. from source.
>
> It would break the dependency between R's compiler config and
> Stan's. So far, a huge number of our R install problems have been
> due to R's compiler config.
>
>
> There have been a number of issues where the user has -g or something in their Makevars and then they can't build it.
> But that is a solved problem for the latest version of R.
That's good news --- it should cut down on our install help mail.
> In any event, if we could just have users do
> install.packages("rstan") and have it prompt to install Rtools if necessary, that would minimize the problems.
Yes, that would be great. That's still just stanc and libstan, though.
And I'm not sure how much libstan is even saving us in compile time
for models vs. a header-only approach.
We could distribute Windows binaries of it ourselves. In
fact, we probably should given the problems people have been
having getting it to build given Windows' poor tool chain.
> We just
> have to get the binary package to build on the CRAN servers.
No idea what that entails. Making the model compiles go faster
by precompiling things is probably in direct opposition to getting
CRAN to build our packages for us.
> I hate Windows as much as anyone, but I don't think this is going to help with Windows nearly as much as having binary
> Windows packages on CRAN. I think Windows users are going to have just as many problems getting stanc, libstan, etc. built.
Windows was fine when I was doing Java development.
But the C++ tool chain there is miserable. So users will
still have trouble getting stanc, libstan and models built.
My point was just that it won't be an RStan issue any more,
so whoever maintains RStan won't have to deal with it.
> RStudio's caused some issues that would go away.
> And installing Rcpp has been the major pain, though
> we're left with a large part of that pain in getting the
> toolchain installed.
>
>
> I think it would be within our rights to refer people to the Rcpp list.
We could. But I want to try to be more helpful. The Rcpp list
wasn't particularly friendly to us when we were trying to build in
the first place.
>
> I think porting the command as it stands is pretty challenging.
> Jiqiang's done a great job of it, but it's still work and it's
> still error prone and it still means every time we change Stan's command
> line, we have to change RStan and PyStan. A process-based approach reduces
> dependencies. It means we only have to update RStan when the
> output of Stan command-line changes formats, which we don't anticipate
> happening as frequently as the sampler and its config through args gets
> updated.
>
>
> I can see the value in having the rstan package just make system calls, but that is a separate issue from what to do
> about CRAN or whether rstan should include Stan.
It won't help us get on CRAN if there isn't any C++ code
in RStan? I thought that'd make it trivial, but admit I
know squat about CRAN or R package build and distribution.
> There is another issue in that we would be lucky if we could get CRAN to update a local installation of Stan once a year
> on three platforms.
Given our development cycle, I don't think that'll work.
At least not until we have much more stable versions of Stan.
> Once a year might be enough if the old Stan were adequate to build the new rstan package and users
> were downloading the new Stan themselves. But there would be a lot of emails with us pleading for CRAN to update Stan
> and CRAN telling us to fuck off, that we are ignoring the fact that they have to manage thousands of packages, that we
> don't know how to develop software in a civilized fashion, etc.
I'd rather just reduce our dependence on the kindness of strangers.
- Bob