segmentation fault with Rstan2.5 but not with Rstan 2.2

62 views
Skip to first unread message

David Champredon

unread,
Nov 3, 2014, 12:37:24 PM11/3/14
to stan-...@googlegroups.com
Hi Rstan team,

I’m running R scripts on computer “A”  with [Rstan 2.5 + R3.1.1 + x86_64-apple-darwin13.1.0]  which produces the error message below. 

However, running exactly the same scripts on computer “B” [Rstan 2.2 + R3.0.2 + x86_64-apple-darwin10.8.0], everything runs well. 

I had R, RStudio and RStan newly re-installed on computer “A” and I guess the problem may come from here (for RStan, I followed the steps given here). I’ve been searching unsuccessfully the web for solutions. Maybe I've missed something obvious... 

I attach “stan_fit.R” which calls stan() (but unfortunately this is part of a relatively large project, so can’t share the whole code)

Thanks in advance for your help.
David

*** caught segfault ***
address 0x20, cause 'memory not mapped'

Traceback:
 1: .Call(Module__functions_names, xp)
 2: Module(module, mustStart = TRUE)
 3: .getModulePointer(x)
 4: <S4 object of class "Module">$stan_fit4model96220031bf1_meta_analysis
 5: <S4 object of class "Module">$stan_fit4model96220031bf1_meta_analysis
 6: eval(expr, envir, enclos)
 7: eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
 8: .local(object, ...)
 9: sampling(sm, data, pars, chains, iter, warmup, thin, seed, init,     check_data = TRUE, sample_file = sample_file, diagnostic_file = diagnostic_file,     verbose = verbose, algorithm = match.arg(algorithm), control = control,     ...)
10: sampling(sm, data, pars, chains, iter, warmup, thin, seed, init,     check_data = TRUE, sample_file = sample_file, diagnostic_file = diagnostic_file,     verbose = verbose, algorithm = match.arg(algorithm), control = control,     ...)
11: stan(file = stan.file, data = meta_analysis_dat, chains = 0,     pars = vint)
12: eval(expr, envir, enclos)
13: eval(ei, envir)
14: withVisible(eval(ei, envir))
15: source("stan_fit.R")
aborting ...
stan_fit.R

David Champredon

unread,
Nov 3, 2014, 2:23:58 PM11/3/14
to stan-...@googlegroups.com
Forgot this:

seesionInfo() on computer A:

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rstan_2.5.0     inline_0.3.13   Rcpp_0.11.3     ggmcmc_0.5.1    coda_0.16-1     lattice_0.20-29 ggplot2_1.0.0  
 [8] plyr_1.8.1      reshape2_1.4    reshape_0.8.5  

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4     grid_3.1.1       gtable_0.1.2     MASS_7.3-33      munsell_0.4.2   
 [7] proto_0.3-10     scales_0.2.4     stats4_3.1.1     stringr_0.6.2    tools_3.1.1 



sessionInfo() on computer B:

R version 3.0.2 (2013-09-25)

Platform: x86_64-apple-darwin10.8.0 (64-bit)


locale:

[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8


attached base packages:

[1] parallel  stats     graphics  grDevices utils     datasets  methods  

[8] base     


other attached packages:

 [1] rstan_2.2.0     inline_0.3.13   Rcpp_0.11.1     ggmcmc_0.5.1   

 [5] coda_0.16-1     lattice_0.20-24 ggplot2_0.9.3.1 reshape2_1.2.2 

 [9] reshape_0.8.4   plyr_1.8       


loaded via a namespace (and not attached):

 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3      

 [4] grid_3.0.2         gtable_0.1.2       labeling_0.2      

 [7] MASS_7.3-29        munsell_0.4.2      proto_0.3-10      

[10] RColorBrewer_1.0-5 scales_0.2.3       stats4_3.0.2      

[13] stringr_0.6.2      tools_3.0.2

Ben Goodrich

unread,
Nov 3, 2014, 2:32:12 PM11/3/14
to stan-...@googlegroups.com
On Monday, November 3, 2014 12:37:24 PM UTC-5, David Champredon wrote:
I attach “stan_fit.R” which calls stan() (but unfortunately this is part of a relatively large project, so can’t share the whole code)

The stan_fit.R file doesn't help much. I would suggest changing chains = 0 to iter = 0 in

  fit.unit.run <- stan(file = stan.file, 
                       data
= meta_analysis_dat,
                       iter
= 0, # chains = 0,
                       pars
= vint)

Ben

David Champredon

unread,
Nov 3, 2014, 2:39:23 PM11/3/14
to stan-...@googlegroups.com
Thanks for the prompt reply.

I've made the change (iter instead of chains), but still the same problem. 

I'm sorry the file is not helpful... Is there anything else I could send that could help? In the mean time, I've run the exactly same scripts on linux servers using Rstan 2.2 and R 3.0.3 and it runs well here too.

Thanks again,
David

Ben Goodrich

unread,
Nov 3, 2014, 3:25:59 PM11/3/14
to stan-...@googlegroups.com
On Monday, November 3, 2014 2:39:23 PM UTC-5, David Champredon wrote:
Thanks for the prompt reply.

I've made the change (iter instead of chains), but still the same problem. 

I'm sorry the file is not helpful... Is there anything else I could send that could help? In the mean time, I've run the exactly same scripts on linux servers using Rstan 2.2 and R 3.0.3 and it runs well here too.

OK. The next thing I would do would be to compare the C++ files generated by rstan 2.2 and rstan 2.5, perhaps with a diff tool. Maybe that would point out the memory problem. On Linux, it is easy enough to run the file under gdb, although it is best to compile it with the -g and -O0 flags.

Also, you might try with -fsanitize=address added to the CFLAGS and paste whatever info you get from that.

Ben
Reply all
Reply to author
Forward
0 new messages