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

Stan code works fine but fails on Linux cluster

我有一个 stan 模型,它 运行 在我自己的笔记本电脑 (Ubuntu 16.04) 上完全正常,但在集群 (Centos 7.3) 上 运行 时失败。

这是我收到的错误消息:

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

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

如评论中所述,问题出在用于安装 RStan 的编译标志中。在我的例子中,通过在单独的库文件夹中重新安装 RStan 和 Rcpp 并使用正确的编译标志解决了这个问题。具体来说,我的 ~/.R/Makevars 文件的内容设置为

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