I am not sure if this is a bug, so I prefer to post it here before filing.
After upgrading to from R 3.3.3 to R 3.4 I encounter the following message with mclapply:
Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null. OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480). OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see
Note that this behavior was not present in R 3.3.3 on the same machine and all the batch was working without any errors. Also note that I tried this with all possible values for enableJIT(X) with the same result.
The batch to (hopefully) reproduce it is here:
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)
The data for the reproducible example is here: https://www.dropbox.com/s/2enoeapu7jgcxwd/z.Rdata?dl=0
The 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
Thank you in advance for help/hints, Yan
EDIT: Slight edit, it turns out that this code cannot really reproduce the issue... However, I leave it here following the advice of data.table developer just in case someone else finds it helpful.