R 3.4和mclapply奇怪的行为 - 这是一个错误吗?

时间:2017-05-01 06:48:41

标签: c++ r mclapply

我不确定这是不是一个错误,所以我更愿意在提交前将其发布在此处。

从R 3.3.3升级到R 3.4后,我遇到以下消息:mclapply:

kmp_runtime.cpp(6480)的断言失败:__ kmp_thread_pool == __null。 OMP:错误#13:kmp_runtime.cpp(6480)的断言失败。 OMP:提示:请提交包含此消息的错误报告,编译和运行使用的命令以及包括本机编译器和操作系统版本的计算机配置信息。通过包括所有程序源可以获得更快的响应。有关提交此问题的信息,请参阅

请注意,在同一台计算机上的R 3.3.3中不存在此行为,并且所有批处理工作都没有任何错误。另请注意,我尝试使用具有相同结果的enableJIT(X)的所有可能值。

要(有希望)重现它的批次在这里:

library(data.table)
load(file = "z.RData")
firmnames <- as.list(unique(z[, firm_name]))
f <- function(x, d = z) { 
        tmp <- d[dealid %in% unique(d[firm_name %in% x, dealid]), .(firm_name, firm_type, dealid, investment_year, investment_yearQ, round_number)][firm_name != x, ]
        tmpY <- tmp[, .N, by = .(firm_type, investment_year, round_number)]
        tmpQ <- tmp[, .N, by = .(firm_type, investment_yearQ, round_number)]
        return(list(
            firm_name = x, 
            by_year = tmpY, 
            by_quarter = tmpQ,
            allroundsY = tmpY[, sum(N), by = .(firm_type, investment_year)],
            allroundsQ = tmpQ[, sum(N), by = .(firm_type, investment_yearQ)]))
    }
r <- mclapply(firmnames, f, mc.cores = detectCores(), mc.preschedule = FALSE)

可重现示例的数据如下: https://www.dropbox.com/s/2enoeapu7jgcxwd/z.Rdata?dl=0

sessionInfo():

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] data.table_1.10.4      numbers_0.6-6          microbenchmark_1.4-2.1 zoo_1.8-0              doParallel_1.0.10      iterators_1.0.8      
 [7] foreach_1.4.3          RSclient_0.7-3         stringi_1.1.5          stringr_1.2.0          lubridate_1.6.0        plyr_1.8.4            

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10     lattice_0.20-35  codetools_0.2-15 grid_3.4.0       gtable_0.2.0     magrittr_1.5     scales_0.4.1     ggplot2_2.2.1   
 [9] lazyeval_0.2.0   tools_3.4.0      munsell_0.4.3    colorspace_1.3-2 tibble_1.3.0    

提前感谢您的帮助/提示, 颜

编辑:轻微编辑,事实证明此代码无法真正重现该问题...但是,我将其留在data.table开发人员的建议中以防万一其他人发现它很有帮助。

0 个答案:

没有答案