R:段错误:使用设备“ gpu”时未映射内存

时间:2018-08-14 16:49:53

标签: r lightgbm

我正在尝试通过.cv()训练模型,如果我将device参数设置为"gpu",它就会像这样在我身上崩溃:

错误消息

[LightGBM] [Info] Number of positive: 1117, number of negative: 78883
[LightGBM] [Info] This is the GPU trainer!!
  [LightGBM] [Info] Total Bins 91915
[LightGBM] [Info] Number of data: 80000, number of used features: 482

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

环境信息

R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

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

other attached packages:
[1] lightgbm_2.1.2 R6_2.2.2

可复制的示例

rm(list = ls())
library(lightgbm)
library(data.table)

set.seed(0)
n_samples = 100
n_features = 450
binary_labels = rbinom(n_samples, size = 1, prob = 0.5)
features = data.table(
  do.call(cbind,
          lapply(1:n_features,
                 function(x){
                   sample(1:10, size = n_samples, replace = TRUE)
                 }
          )
  )
)
features = as.matrix(lightgbm::lgb.prepare2(features))
features[, 1] <- as.numeric(features[, 1])
train = lightgbm::lgb.Dataset(data = features, label = binary_labels)

bst = lightgbm::lgb.cv(
  objective = "binary", 
  data = train, 
  nrounds = 40L,
  verbose = 0,
  device = "gpu") # change this to "cpu"

复制步骤

  1. 使用lgb.Dataset
  2. 准备数据集
  3. lgb.cv设置为device的情况下运行"gpu"
  4. 开始运行时获取错误消息。

请注意,如果我在CPU设备上运行它就可以正常运行,那么当我将device设置为"gpu"时,就会遇到问题。据我所知,我在启用GPU支持的情况下编译了LightGBM。据我了解,如果没有,错误会有所不同。

此外,矩阵的确至少有一个numeric列,因此它似乎与#964 (issue on Github)没有关系,但是在经过特定数量的功能后确实崩溃了(我认为是450)

0 个答案:

没有答案