Closed bgoodri closed 9 months ago
Thanks for tracking it down to that line of code and sharing data.
How was that data created? Is this what was created automatically in the test? If so, I think it means that prep_car_data
is acting differently there than on my computer (and elsewhere it seems).
In that data, WCAR = 0
, and that will cause car_normal_lpdf
to run instead of wcar_normal_lpdf
. So then it needs an array of index positionsCidx
, but in your data Cidx=array(0)
(which is what happens by default when WCAR=1
but not otherwise).
The test that's failing uses this code to prep the data:
> data(georgia)
A <- shape2mat(georgia)
cars <- prep_car_data(A)
Range of permissible rho values: -1.661134 1
> cars$WCAR
[1] 1
and this output that I'm getting is how I expect it to look (and so the test works).
The call to car_normal_lpdf
is inside a conditional statement, wrapped in this auto_normal_lpdf
function:
real auto_normal_lpdf(vector y, vector mu,
real tau, real rho,
vector Ax_w, array[] int Ax_v, array[] int Ax_u,
array[] int Cidx,
vector D_inv, real log_det_D_inv,
vector lambda,
int n, int WCAR) {
if (WCAR) {
return wcar_normal_lpdf(y | mu, tau, rho, Ax_w, Ax_v, Ax_u, D_inv, log_det_D_inv, lambda, n);
} else {
return car_normal_lpdf(y | mu, tau, rho, Ax_w, Ax_v, Ax_u, Cidx, D_inv, log_det_D_inv, lambda, n);
}
}
I made the data file by stepping into stan_car
until it got to the point where it called rstan::sampling
and then I assigned standata
into R's global environment and called rstan::stan_rdump
. I was perplexed that it was happening on CRAN and my laptop but not with the GitHub server or my Ubuntu server in my office where I tested all the packages that have StanHeaders in their LinkingTo.
If I just do (on my laptop, where it is failing)
packageVersion("geostan") # 0.5.2
data(georgia)
A <- shape2mat(georgia)
cars <- prep_car_data(A)
str(cars)
I get
List of 13
$ Ax_w : num [1:860] 1 1 1 1 1 1 1 1 1 1 ...
$ Ax_v : int [1:860] 23 58 59 131 148 159 9 12 35 76 ...
$ Ax_u : int [1:160] 1 7 12 18 23 26 31 38 42 47 ...
$ nAx_w : int 860
$ Cidx : num [1(1d)] 0
$ nC : num 1
$ WCAR : num 1
$ Delta_inv : num [1:159] 6 5 6 5 3 5 7 4 5 5 ...
$ style : chr "WCAR"
$ log_det_Delta_inv: num 261
..- attr(*, "logarithm")= logi TRUE
$ n : int 159
$ lambda : num [1:159] -0.602 -0.564 -0.55 -0.548 -0.545 ...
$ C :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:860] 22 57 58 130 147 158 8 11 34 75 ...
.. ..@ p : int [1:160] 0 6 11 17 22 25 30 37 41 46 ...
.. ..@ Dim : int [1:2] 159 159
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:860] 0.167 0.143 0.167 0.2 0.143 ...
.. ..@ factors : list()
So, I would agree it is presumably an issue with that function.
When I do it on the Ubuntu server, I get the same cars
but it somehow runs with StanHeaders 2.26.x (which is presumably a bug).
Oh! That list looks correct:
$ Cidx : num [1(1d)] 0 # a placeholder because wcar_normal_lpdf doesn't need Cidx
$ nC : num 1
$ WCAR : num 1 ## this means it should use wcar_normal_lpdf instead of car_normal_lpdf
Since WCAR=1
the car_normal_lpdf
shouldn't be called, so I don't know how it could fail.
I haven't tried myself with StanHeaders 2.32.x yet but I can start working on it this afternoon, its definitely a priority.
I think I figured out what the problem is. The prep_car_data
function returns a list where $WCAR
is 1, in which case $Cidx
should be an array of size zero. But inside the stan_car
function, it creates standata
, appends car_parts
to it (with $WCAR
as 1), and then eventually does
me.list <- make_me_data(ME, xraw)
standata <- c(standata, me.list)
where me.list
also has a $WCAR
element that is 0. Thus, the latter is what is used when everything is passed to the data block of the Stan program.
Thanks, I think I'll create create a second named indicator for the ME models (and look for any other duplication). If you want I can post a development version on GitHub for you to test or see before I send it to CRAN (you're also welcome to make a pull request of course)
On Thu, Oct 19, 2023, 10:34 AM bgoodri @.***> wrote:
I think I figured out what the problem is. The prep_car_data function returns a list where $WCAR is 1, in which case $Cidx should be an array of size zero. But inside the stan_car function, it creates standata, appends car_parts to it (with $WCAR as 1), and then eventually does
me.list <- make_me_data(ME, xraw) standata <- c(standata, me.list)
where me.list also has a $WCAR element that is 0. Thus, the latter is what is used when everything is passed to the data block of the Stan program.
— Reply to this email directly, view it on GitHub https://github.com/ConnorDonegan/geostan/issues/17#issuecomment-1771231659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5RV2OF3VSOIVMEVDNOYL3YAFB6RAVCNFSM6AAAAAA6EY5ICWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGIZTCNRVHE . You are receiving this because you commented.Message ID: @.***>
I've got one or two other problems to deal with but what you said should be fine.
When I build it with the new StanHeaders (that you linked to) it still segfaults.
Here's what I've done (basically):
ME_WCAR
variable for the measurement error models, then rebuilt the package. [Actually I'm going to have to change the way I fixed it---as is it could cause errors for an unusual case, but I don't think its causing any issues in these tests.]
devtools::test()
and devtools::check()
and didn't get any errors~/.R/Makevars
was like this:
CXX14FLAGS=-O0 -march=native -mtune=native -fPIC
CXX14=g++
devtools::check()
which I think builds it again with the new StanHeaders, and it fails on (at least) one of the tests. Next time I can sit down with this (tomorrow) I will look into the error more closely.
(I pushed all the changes to the dev
branch)
The problem seems to come from the model for missing/censored outcome data, although I haven't seen any other indication yet that there's something wrong with this model.
Compiling with StanHeaders 2.32, it will break/sometimes segfault with this one (in addition to the case you identified):
devtools::load_all("~/dev/geostan")
fit <- stan_glm(deaths.female ~ offset(log(pop.at.risk.female)),
censor_point = 9,
data = georgia,
family = poisson()
)
I haven't been able to create any segfaults with geostan from GitHub.
Is that using the same StanHeaders 2.32 that you shared with me earlier, and my dev branch?
I can update geostan with something similar to the current dev branch, though I'm somewhat concerned that using the new StanHeaders doesn't work on my computer
Yeah. Can you follow https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Debugging-compiled-code on the computer where it is not working? Also, you probably need to recompile geostan without optimization.
I checked that its segfaulting after recompiling without optimization (it is)
Using
$ R -d gdb --vanilla
...
gdb> run
and then in the R session:
devtools::load_all('~/dev/geostan')
fit <- stan_glm(deaths.female ~ offset(log(pop.at.risk.female)),
censor_point = 9,
data = georgia,
family = poisson()
)
...
SAMPLING FOR MODEL 'foundation' NOW (CHAIN 1).
Thread 1 "R" received signal SIGSEGV, Segmentation fault.
Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdb5f0) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
69 Index rows() const { return m_xpr.rows(); }
(gdb)
It ends with at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
There aren't any more duplicated variables defined in R. This is using the dev2
branch that I just pushed
If you enter bt
at the (gdb)
prompt at that point, it will given you something like traceback()
in R, which would help figure out where it is trying to calculate the number of rows of something that does not exist.
Thanks. Here's what I've found so far.
Are you ready to submit to cran and waiting for this to be fixed still? Just want to be clear; I had a deadline to meet last week but this week will be able to respond much more quickly if needed.
The first line of code from geostan that appears in the traceback is here (this is the line that's unique to the censor_point argument):
target += poisson_lpmf(y_int[y_obs_idx] | fitted[y_obs_idx]);
if (censor_point > 0) target += poisson_lcdf(censor_point | fitted[y_mis_idx]); # right here
where fitted
is declared as a transformed parameter
vector[n] fitted;
if (!car) fitted = input_offset + intercept; # car=0
if (is_poisson) fitted = exp(fitted);
This model for censored observations also has a function for initial values, but the model segfaults whether the inits function is used or not (in this case it initiates the intercept at values near -4.7)
I pulled out the data just before it gets passed to Stan, and don't see anything that I would expect to cause an error.
> x$censor_point
[1] 9
> x$y_mis_idx
[1] 55 126 157
> x$car
[1] 0
> x$input_offset[x$y_mis_idx]
[1] 6.986566 6.523562 7.004882
Is there something wrong with my using a single integer for censor_point
with a vector for the second argument to poisson_lcdf
? It seems like I should be looking for something that could possibly run without causing an error, but really shouldn't be allowed (by Stan's syntax?). The models return reasonable results on the current version.
# flagged line 3857, StanExports_foundation.h
if (is_poisson) {
current_statement__ = 176;
lp_accum__.add(stan::math::poisson_lpmf<false>(
stan::model::rvalue(y_int, "y_int",
stan::model::index_multi(y_obs_idx)),
stan::model::rvalue(fitted, "fitted",
stan::model::index_multi(y_obs_idx))));
current_statement__ = 178;
if (stan::math::logical_gt(censor_point, 0)) {
current_statement__ = 177;
[3857] lp_accum__.add(stan::math::poisson_lcdf(censor_point,
stan::model::rvalue(fitted, "fitted",
stan::model::index_multi(y_mis_idx))));
}
}
no. 8 is StanExports_foundation.h
(gdb) bt
#0 Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (
this=0x7ffffffdb5f0)
--Type <RET> for more, q to quit, c to continue without paging--
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#1 stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const--Type <RET> for more, q to quit, c to continue without paging--
::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}>::rows() const (this=0x7ffffffdb5f0)
at /home/connor/R-packages/StanHeaders/include/stan/math/prim/meta/holder.hpp:132
#2 Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<dou--Type <RET> for more, q to quit, c to continue without paging--
ble, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const>::rows() const (this=<optimized out>)
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#3 Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*--Type <RET> for more, q to quit, c to continue without paging--
)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::rows() const (this=<optimized out>)
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:59
#4 Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>,--Type <RET> for more, q to quit, c to continue without paging--
stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double cons--Type <RET> for more, q to quit, c to continue without paging--
t&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::size() const (this=<optimized out>)
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:66
#5 Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Ei--Type <RET> for more, q to quit, c to continue without paging--
gen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::sum() const (this=<optimized out>)
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/Redux.h:451
#6 _ZN4stan4math3sumIN5Eigen12CwiseUnaryOpINS2_8internal13scalar_log_opIdEEKNS0_6HolderINS3_IZZNS0_19apply_scalar_binaryIRKdRKNS2_5ArrayIdLin1ELi1ELi0ELin1ELi1EEEZNS0_7gamma_qIdSC_LPv0EEEDaRKT_RKT0_EUlSJ_SM_E_LSG_0ELSG_0EEEDaOSH_OSK_OT1_ENKUlRSH_RSK_RSQ_E_clISN_S9_SD_EEDaSS_ST_SU_EUlSJ_E_SD_EEJSN_EEEEELSG_0EEENS_10value_typeISH_vE4typeESJ_ (m=...)
at /home/connor/R-packages/StanHeaders/include/stan/math/prim/fun/sum.hpp:47
#7 stan::math::poisson_lcdf<int, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, ---Type <RET> for more, q to quit, c to continue without paging--
1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(int const&, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&) (lambda=...,
n=<optimized out>, n=<optimized out>)
at /home/connor/R-packages/StanHeaders/include/stan/math/prim/prob/poisson_lcdf.hpp:57
#8 0x00007fffe1bc163e in model_foundation_namespace::model_foundation::log_prob_impl<false, true, std::vector<double, std::allocator<double> >, std::vector<int, std::allocator<int> >, (void*)0, (void*)0> (this=this@entry=0x5555678dd990,
params_r__=std::vector of length 1, capacity 1 = {...},
params_i__=std::vector of length 0, capacity 0,
--Type <RET> for more, q to quit, c to continue without paging--
pstream__=pstream__@entry=0x7ffffffdc260)
at /home/connor/dev/geostan/src/stanExports_foundation.h:3857
#9 0x00007fffe1bf27d5 in model_foundation_namespace::model_foundation::log_prob<false, true, double> (pstream=0x7ffffffdc260,
params_i=std::vector of length 0, capacity 0,
params_r=std::vector of length 1, capacity 1 = {...}, this=0x5555678dd990)
at /home/connor/dev/geostan/src/stanExports_foundation.h:5849
#10 stan::services::util::initialize<true, model_foundation_namespace::model_foundation, stan::io::var_context, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > (
model=..., init=..., rng=..., init_radius=init_radius@entry=2,
print_timing=print_timing@entry=true, logger=..., init_writer=...)
at /home/connor/R-packages/StanHeaders/include/src/stan/services/util/initialize.hpp:129
#11 0x00007fffe1bfd957 in stan::services::sample::hmc_nuts_diag_e_adapt<model_fo--Type <RET> for more, q to quit, c to continue without paging--
undation_namespace::model_foundation> (model=..., init=...,
init_inv_metric=..., random_seed=random_seed@entry=167159160,
chain=chain@entry=1, init_radius=init_radius@entry=2,
num_warmup=num_warmup@entry=1000, num_samples=1000, num_thin=1,
save_warmup=true, refresh=1000, stepsize=stepsize@entry=1,
stepsize_jitter=stepsize_jitter@entry=0, max_depth=10,
delta=delta@entry=0.80000000000000004,
gamma=gamma@entry=0.050000000000000003, kappa=kappa@entry=0.75,
t0=t0@entry=10, init_buffer=75, term_buffer=50, window=25, interrupt=...,
logger=..., init_writer=..., sample_writer=..., diagnostic_writer=...)
at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:73
#12 0x00007fffe1c1b75f in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (diagnostic_writer=...,
sample_writer=..., init_writer=..., logger=..., interrupt=...,
window=<optimized out>, term_buffer=<optimized out>,
--Type <RET> for more, q to quit, c to continue without paging--
init_buffer=<optimized out>, t0=<optimized out>, kappa=<optimized out>,
gamma=<optimized out>, delta=<optimized out>, max_depth=10,
stepsize_jitter=0, stepsize=1, refresh=<optimized out>,
save_warmup=<optimized out>, num_thin=1, num_samples=1000,
num_warmup=1000, init_radius=2, chain=1, random_seed=167159160, init=...,
model=...)
at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:151
#13 rstan::(anonymous namespace)::command<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > > (args=..., model=...,
holder=..., qoi_idx=std::vector of length 320, capacity 512 = {...},
fnames_oi=std::vector of length 320, capacity 320 = {...}, base_rng=...)
at /home/connor/R-packages/rstan/include/rstan/stan_fit.hpp:668
#14 0x00007fffe1c1cdd3 in rstan::stan_fit<model_foundation_namespace::model_foun--Type <RET> for more, q to quit, c to continue without paging--
dation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > >::call_sampler (
this=0x5555678dd8b0, args_=<optimized out>)
at /home/connor/R-packages/Rcpp/include/Rcpp/vector/Vector.h:616
#15 0x00007fffe1b08530 in Rcpp::class_<rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > >::invoke_notvoid (this=<optimized out>, method_xp=<optimized out>, object=0x555564f5ce40,
args=0x7ffffffde2f0, nargs=<optimized out>)
at /home/connor/R-packages/Rcpp/include/Rcpp/module/class.h:234
#16 0x00007ffff2e69ff2 in CppMethod__invoke_notvoid (args=<optimized out>)
at module.cpp:220
#17 0x00007ffff7c506fb in ?? () from /usr/lib/R/lib/libR.so
#18 0x00007ffff7caa340 in Rf_eval () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#19 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#20 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#21 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#22 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#23 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#24 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#25 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#26 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#27 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#28 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#29 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#30 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#31 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#32 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#33 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#34 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#35 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#36 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#37 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#38 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#39 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#40 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#41 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#42 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#43 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#44 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#45 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#46 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#47 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#48 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#49 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#50 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#51 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#52 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#53 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#54 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#55 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#56 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#57 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#58 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#59 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#60 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#61 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#62 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#63 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#64 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#65 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#66 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#67 0x00007ffff7cb1530 in ?? () from /usr/lib/R/lib/libR.so
#68 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#69 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#70 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#71 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#72 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#73 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#74 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#75 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#76 0x00007ffff7cacee9 in R_execMethod () from /usr/lib/R/lib/libR.so
#77 0x00007ffff44d1940 in ?? () from /usr/lib/R/library/methods/libs/methods.so
#78 0x00007ffff7cf4869 in ?? () from /usr/lib/R/lib/libR.so
#79 0x00007ffff7c9c0e5 in ?? () from /usr/lib/R/lib/libR.so
#80 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#81 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#82 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#83 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#84 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#85 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#86 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#87 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#88 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#89 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#90 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#91 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#92 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#93 0x00007ffff7cdfd0a in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#94 0x00007ffff7ce00a0 in ?? () from /usr/lib/R/lib/libR.so
#95 0x00007ffff7ce0160 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#96 0x000055555555509f in main ()
#97 0x00007ffff7958d90 in __libc_start_call_main (
main=main@entry=0x555555555080 <main>, argc=argc@entry=2,
--Type <RET> for more, q to quit, c to continue without paging--
argv=argv@entry=0x7fffffffdf98)
at ../sysdeps/nptl/libc_start_call_main.h:58
#98 0x00007ffff7958e40 in __libc_start_main_impl (main=0x555555555080 <main>,
argc=2, argv=0x7fffffffdf98, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffdf88)
at ../csu/libc-start.c:392
#99 0x00005555555550d5 in _start ()
Can you install rstantools from GitHub locally, except remove the -DEIGEN_NO_DEBUG
from line 4 of
rstantools/inst/include/sys/Makevars
Then, recompile geostan with debug symbols but without optimization and run it under gdb
again to see if we can get Eigen to tell us more about what is going wrong.
I set my ~/.R/Makevars
like this
CXX14FLAGS=-00 -march=native -mtune=native -fPIC -g
CXX14=g++
Its not looking any different for me.
Sorry I can't be of more help here.
Would it make sense to debug this after StanHeaders is updated on CRAN? I.e., I submit a new version of geostan (dev2
) that allows StanHeaders to update on CRAN [you're saying my dev branch seems to work?], and then figure out this issue? I can't tell how serious this issue might be from your perspective @bgoodri @jgabry
Thread 1 "R" received signal SIGSEGV, Segmentation fault.
Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdbac0) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
69 Index rows() const { return m_xpr.rows(); }
(gdb) bt
#0 Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdbac0)
at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#1 stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double c--Type <RET> for more, q to quit, c to continue without paging--c
onst&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}>::rows() const (this=0x7ffffffdbac0) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/meta/holder.hpp:132
#2 Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const>::rows() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#3 Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::rows() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:59
#4 Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::size() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:66
#5 Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::sum() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/Redux.h:451
#6 _ZN4stan4math3sumIN5Eigen12CwiseUnaryOpINS2_8internal13scalar_log_opIdEEKNS0_6HolderINS3_IZZNS0_19apply_scalar_binaryIRKdRKNS2_5ArrayIdLin1ELi1ELi0ELin1ELi1EEEZNS0_7gamma_qIdSC_LPv0EEEDaRKT_RKT0_EUlSJ_SM_E_LSG_0ELSG_0EEEDaOSH_OSK_OT1_ENKUlRSH_RSK_RSQ_E_clISN_S9_SD_EEDaSS_ST_SU_EUlSJ_E_SD_EEJSN_EEEEELSG_0EEENS_10value_typeISH_vE4typeESJ_ (m=...) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/fun/sum.hpp:47
#7 stan::math::poisson_lcdf<int, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(int const&, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&) (lambda=..., n=<optimized out>, n=<optimized out>) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/prob/poisson_lcdf.hpp:57
#8 0x00007fffe1bc8bd5 in model_foundation_namespace::model_foundation::log_prob_impl<false, true, std::vector<double, std::allocator<double> >, std::vector<int, std::allocator<int> >, (void*)0, (void*)0> (this=this@entry=0x55555f33c9c0, params_r__=std::vector of length 1, capacity 1 = {...}, params_i__=std::vector of length 0, capacity 0, pstream__=pstream__@entry=0x7ffffffdc830) at /home/connor/dev/geostan/src/stanExports_foundation.h:3857
#9 0x00007fffe1bd37ca in model_foundation_namespace::model_foundation::log_prob<false, true, double> (pstream=0x7ffffffdc830, params_i=std::vector of length 0, capacity 0, params_r=std::vector of length 1, capacity 1 = {...}, this=0x55555f33c9c0) at /home/connor/dev/geostan/src/stanExports_foundation.h:5847
#10 stan::services::util::initialize<true, model_foundation_namespace::model_foundation, stan::io::var_context, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > (model=..., init=..., rng=..., init_radius=init_radius@entry=2, print_timing=print_timing@entry=true, logger=..., init_writer=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/util/initialize.hpp:129
#11 0x00007fffe1bfd279 in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (model=..., init=..., init_inv_metric=..., random_seed=random_seed@entry=559171561, chain=chain@entry=1, init_radius=init_radius@entry=2, num_warmup=num_warmup@entry=1000, num_samples=1000, num_thin=1, save_warmup=true, refresh=1000, stepsize=stepsize@entry=1, stepsize_jitter=stepsize_jitter@entry=0, max_depth=10, delta=delta@entry=0.80000000000000004, gamma=gamma@entry=0.050000000000000003, kappa=kappa@entry=0.75, t0=t0@entry=10, init_buffer=75, term_buffer=50, window=25, interrupt=..., logger=..., init_writer=..., sample_writer=..., diagnostic_writer=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:73
#12 0x00007fffe1c1e096 in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (diagnostic_writer=..., sample_writer=..., init_writer=..., logger=..., interrupt=..., window=<optimized out>, term_buffer=<optimized out>, init_buffer=<optimized out>, t0=<optimized out>, kappa=<optimized out>, gamma=<optimized out>, delta=<optimized out>, max_depth=10, stepsize_jitter=0, stepsize=1, refresh=1000, save_warmup=<optimized out>, num_thin=1, num_samples=1000, num_warmup=1000, init_radius=2, chain=1, random_seed=559171561, init=..., model=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:151
#13 rstan::(anonymous namespace)::command<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > > (args=..., model=..., holder=..., qoi_idx=std::vector of length 320, capacity 512 = {...}, fnames_oi=std::vector of length 320, capacity 320 = {...}, base_rng=...) at /home/connor/R-packages/rstan/include/rstan/stan_fit.hpp:668
#14 0x00007fffe1c1f2ac in rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > >::call_sampler (this=0x55555f33c8e0, args_=0x55556056a5c8) at /home/connor/R-packages/Rcpp/include/Rcpp/vector/Vector.h:616
#15 0x00007fffe1b4c2cc in Rcpp::class_<rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > >::invoke_notvoid (this=<optimized out>, method_xp=<optimized out>, object=0x5555643642d0, args=0x7ffffffde300, nargs=<optimized out>) at /home/connor/R-packages/Rcpp/include/Rcpp/module/class.h:234
#16 0x00007ffff2e67ff2 in CppMethod__invoke_notvoid (args=<optimized out>) at module.cpp:220
#17 0x00007ffff7c5070b in ?? () from /usr/lib/R/lib/libR.so
#18 0x00007ffff7caa350 in Rf_eval () from /usr/lib/R/lib/libR.so
#19 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#20 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#21 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#22 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#23 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#24 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#25 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#26 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#27 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#28 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#29 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#30 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#31 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#32 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#33 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#34 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#35 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#36 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#37 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#38 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#39 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#40 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#41 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#42 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#43 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#44 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#45 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#46 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#47 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#48 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#49 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#50 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#51 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#52 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#53 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#54 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#55 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#56 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#57 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#58 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#59 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#60 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#61 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#62 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#63 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#64 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#65 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#66 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#67 0x00007ffff7cb1540 in ?? () from /usr/lib/R/lib/libR.so
#68 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#69 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#70 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#71 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#72 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#73 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#74 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#75 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#76 0x00007ffff7cacef9 in R_execMethod () from /usr/lib/R/lib/libR.so
#77 0x00007ffff44d1940 in ?? () from /usr/lib/R/library/methods/libs/methods.so
#78 0x00007ffff7cf4879 in ?? () from /usr/lib/R/lib/libR.so
#79 0x00007ffff7c9c0f5 in ?? () from /usr/lib/R/lib/libR.so
#80 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#81 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#82 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#83 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#84 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#85 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#86 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#87 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#88 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#89 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#90 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#91 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#92 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#93 0x00007ffff7cdfd1a in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#94 0x00007ffff7ce00b0 in ?? () from /usr/lib/R/lib/libR.so
#95 0x00007ffff7ce0170 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#96 0x000055555555509f in main ()
#97 0x00007ffff7958d90 in __libc_start_call_main (main=main@entry=0x555555555080 <main>, argc=argc@entry=2, argv=argv@entry=0x7fffffffdfa8) at ../sysdeps/nptl/libc_start_call_main.h:58
#98 0x00007ffff7958e40 in __libc_start_main_impl (main=0x555555555080 <main>, argc=2, argv=0x7fffffffdfa8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf98) at ../csu/libc-start.c:392
#99 0x00005555555550d5 in _start ()
(gdb)
There's now an updated version on CRAN; let me know if it addresses the original issue
I'm going to close this issue assuming that the original problem has been addressed, but feel free to open a new one (or I can re-open this one) if needed
Can you run the geostan currently on CRAN through winbuilder again? It's r-devel has the StanHeaders that ostensibly does not crash geostan anymore. Thanks.
Yeah, looks good!
No errors using r-dev:
If you run the "CAR with censored y" unit test with StanHeaders / rstan 2.32.x and compile the model without optimization (i.e.
-00
in ~/.R/Makevars), you should seeLine 88 in the file -- after resolving the
#include
s is from this functionI don't know how this didn't get caught by a previous version of Stan or how it works on my Ubuntu server, but it is now causing a segfault on CRAN when I try to upload StanHeaders 2.32. If you need a StanHeaders 2.32, you can get it from here and you can install rstan 2.32 from CRAN, even though it is currently using the Stan 2.26 era parser.
Below is a file of data that can be loaded with
rstan::read_rdump("geostan_data.R")