欢迎posit.cloud有rstan
软件包经验的用户反馈。
我正在尝试在RStudio Cloud会话中使用rstan。install.packages("rstan")
工作正常,也阅读了库。
但是在这个玩具示例之后它返回了下面的错误
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
x=rnorm(1000,5,1)
my_data=list(N=1000,x~x)
stancode = 'data{ int N; real x[N];} parameters{real mu;real sigma;}
model{ x ~ normal(mu,sigma);}'
fit = stan(model_code = stancode,data=my_data)
它返回此错误
Error in compileCode(f, code, language = language, verbose = verbose) :
/cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes] 55 | >::type PacketReturnType; | ^~~~~~~~~~~~~~~~g++: fatal error: Killed signal terminated program cc1pluscompilation terminated.make: *** [/opt/R/4.2.2/lib/R/etc/Makeconf:178: file189644bbcfc.o] Error 1
Error in sink(type = "output") : invalid connection``
我的会话信息:
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.21.8 ggplot2_3.4.1 StanHeaders_2.21.0-7
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 pillar_1.8.1 compiler_4.2.2 prettyunits_1.1.1 tools_4.2.2 digest_0.6.31 pkgbuild_1.4.0
[8] evaluate_0.20 lifecycle_1.0.3 tibble_3.1.8 gtable_0.3.1 pkgconfig_2.0.3 rlang_1.0.6 cli_3.6.0
[15] rstudioapi_0.14 yaml_2.3.7 parallel_4.2.2 xfun_0.37 loo_2.5.1 fastmap_1.1.0 gridExtra_2.3
[22] withr_2.5.0 dplyr_1.1.0 knitr_1.42 generics_0.1.3 vctrs_0.5.2 stats4_4.2.2 grid_4.2.2
[29] tidyselect_1.2.0 glue_1.6.2 inline_0.3.19 R6_2.5.1 processx_3.8.0 fansi_1.0.4 rmarkdown_2.20
[36] callr_3.7.3 magrittr_2.0.3 htmltools_0.5.4 codetools_0.2-18 matrixStats_0.63.0 scales_1.2.1 ps_1.7.2
[43] colorspace_2.1-0 utf8_1.2.3 RcppParallel_5.1.6 munsell_0.5.0 crayon_1.5.2
1条答案
按热度按时间wztqucjr1#
编译C++代码需要相当多的内存。您可以看到右上角的RAM Jmeter 在进程被终止之前变红。
如果你点击RAM表,你可以进入“资源”选项卡,在那里你可以更改RAM的数量。对于您的示例,使用4 GB的RAM似乎就足够了。
顺便说一句,
parallel::detectCores()
在这样的情况下工作得不好。更好地使用parallelly::availableCores()
,这也考虑到了由喉痹造成的限制。您可以在“资源”选项卡中更改可用CPU的数量。