在使用专有的NVIDIA驱动程序时尝试使用ACML数学库编译R 3.2.1时的Segfault

时间:2015-07-09 18:03:43

标签: r ubuntu nvidia blas

运行Ubuntu 14.04,尝试使用ACML数学库编译R,我收到此错误:

byte-compiling package 'grDevices'

 *** caught segfault ***
address (nil), cause 'memory not mapped'

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: solve.default(rgb)

 *** caught segfault ***
address (nil), cause 'memory not mapped'
 2: solve(rgb)
 3: drop(whitexyz %*% solve(rgb))
 4: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155,     0.07), gamma = 1.8, white = "D65", name = "Apple RGB")
 5: eval(expr, envir, enclos)
 6: eval(exprs[i], envir)
 7: sys.source(codeFile, env, keep.source = keep.source)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
12: try(sys.source(codeFile, env, keep.source = keep.source))
13: loadNamespace(package, lib.loc, keep.source, partial = TRUE)
14: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
15: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))
16: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)
17: tools:::makeLazyLoading("grDevices")
aborting ...

Traceback:
 1: solve.default(rgb)
 2: solve(rgb)
 3: drop(whitexyz %*% solve(rgb))
 4: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155,     0.07), gamma = 1.8, white = "D65", name = "Apple RGB")
 5: eval(expr, envir, enclos)

Traceback:
 1: solve.default(rgb)
 2: solve(rgb)
 3: drop(whitexyz %*% solve(rgb))
 4: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155,     0.07), gamma = 1.8, white = "D65", name = "Apple RGB")
 5: eval(expr, envir, enclos)
 6: eval(exprs[i], envir)
 7: sys.source(codeFile, env, keep.source = keep.source)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "\n  ", condition = e))})
 6: eval(exprs[i], envir)
12: try(sys.source(codeFile, env, keep.source = keep.source))
13:  7: sys.source(codeFile, env, keep.source = keep.source)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
loadNamespace(package, lib.loc, keep.source, partial = TRUE)
11: tryCatch(expr, error = function(e) {    call <- conditionCall(e)14: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
15: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))
16: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)
17: tools:::makeLazyLoading("grDevices")
    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]aborting ...
        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
12: try(sys.source(codeFile, env, keep.source = keep.source))
13: loadNamespace(package, lib.loc, keep.source, partial = TRUE)
14: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
15: suppressPackageStartupMessages(loadNamespace(package, lib.loc,     keep.source, partial = TRUE))
16: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     compress = compress)
17: tools:::makeLazyLoading("grDevices")
aborting ...
/bin/bash: line 8: 54105 Done                    echo "tools:::makeLazyLoading(\"grDevices\")"
     54106 Segmentation fault      (core dumped) | R_COMPILE_PKGS=1 R_COMPILER_SUPPRESS_ALL=1 R_DEFAULT_PACKAGES=NULL LC_ALL=C ../../../bin/R --vanilla --slave > /dev/null

我使用./configure --with-blas=-lacml_mp --with-lapack --enable-R-shlib

进行了配置

我正在运行专有的NVIDIA显卡驱动程序,这似乎是导致问题的原因,但我不知道如何。以下是其他编译尝试的结果:

  • 使用开源的nouveau驱动程序,它就像这样编译好(但我需要使用专有的NVIDIA驱动程序,因为其他原因)
  • 如果我遗漏--with-blas=-lacml_mp --with-lapack我即使使用NVIDIA驱动程序也可以正常编译
  • R 3.2.0
  • 也是如此

此外,libacml_mp.so位于正确的位置,因此问题是没有链接到它 - 我可以使用nouveau驱动程序编译并链接到它。

我的猜测是,这是无望的,要么我必须使用nouveau驱动程序,要么我必须找到一些其他BLAS / LAPACK实现来使用。但如果有人知道这里发生了什么,我会非常感激。

1 个答案:

答案 0 :(得分:0)

我认为ACML库是针对AMD GPU上的OpenCL的,尽管我仍在将它拼凑在一起。整个事情都在变化,你会看到ACML现在正在退休,转向开源替代品。请参阅http://developer.amd.com/tools-and-sdks/archive/amd-core-math-library-acml/顶部的消息。

由于你有NVIDIA显卡,你不会安装FLGRX,我认为这是ACML的先决条件。你有AMD CPU,这就是你选择ACML库的原因吗?

我建议不要使用ACML。我也很好奇为什么你要编译R直接链接到库:使用接口libblas.so.3提供的通用接口更容易,然后你可以切换BLAS而无需重新编译R.这样你就可以得到你的运行时错误更快......

ACML从来没有和我一起使用R,我很想把它的封闭源性质和多个FGLRX / ACML /显卡版本归咎于地狱。