Stan代码工作正常,但在Linux群集上失败

时间:2019-05-29 11:00:48

标签: r cluster-computing stan

我有一个stan模型,可以在我自己的笔记本电脑(Ubuntu 16.04)上很好地运行,但是在群集上(Centos 7.3)运行时失败。在群集上安装Stan似乎工作正常(8schools.stan示例运行没有问题)。

这是我收到的错误消息:

Loading R/3.5.3
  Loading requirement: java/1.8.0_171-oracle
Loading required package: ggplot2
Loading required package: StanHeaders

 *** caught illegal operation ***
address 0x2b87c71f0061, cause 'illegal operand'

Traceback:
 1: get_rng(0)
 2: assign(x, value, envir = ns, inherits = FALSE)
 3: assignInMyNamespace("RNG", value = get_rng(0))
 4: fun(libname, pkgname)
 5: doTryCatch(return(expr), name, parentenv, handler)
 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 7: tryCatchList(expr, classes, parentenv, handlers)
 8: tryCatch(fun(libname, pkgname), error = identity)
 9: runHook(".onLoad", env, package.lib, package)
10: loadNamespace(package, lib.loc)
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
15: library(rstan)
An irrecoverable exception occurred. R is aborting now ...
/opt/sge_spool/8.5.4/dn110/job_scripts/695494: line 9: 31202 Illegal instruction     Rscript MLDS_stan_v3.R

我不明白问题出在哪里,因为相同的脚本可以在笔记本电脑上正常运行。有什么建议吗?

1 个答案:

答案 0 :(得分:1)

如评论中所建议,问题出在用于安装RStan的编译标志中。在我的情况下,可以通过在单独的库文件夹中重新安装RStan和Rcpp并使用正确的编译标志来解决此问题。具体来说,在我的案例中,~/.R/Makevars文件的内容设置为

CXX14 = g++ -std=c++1y
CXX14FLAGS = -O3 -Wno-unused-variable -Wno-unused-function -fPIC