I'm trying to generate rasters using the nlm_gaussianfield() function. However, the generation fails whenever the function is called in a parallel session.
# Required packages
library(NLMR)
library(parallel)
# Works
mclapply(1:2, mc.cores = 1, function(x) {
nlm_gaussianfield(ncol = 5, nrow = 5)
})
# Does not work
mclapply(1:2, mc.cores = 2, function(x) {
nlm_gaussianfield(ncol = 5, nrow = 5)
})
This yields the following error message:
[[1]]
[1] "Error in RandomFieldsUtils::RFoptions(...) : \n 'RFoptions(...)' may be used only outside any parallel code\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in RandomFieldsUtils::RFoptions(...): 'RFoptions(...)' may be used only outside any parallel code>
This appears to be an issue related to the RandomFields and RandomFieldsUtils packages, as the same code works when I install older package versions from the archive:
devtools::install_version("RandomFieldsUtils", version = "0.5", repos = "http://cran.us.r-project.org")
devtools::install_version("RandomFields", version = "3.3.1", repos = "http://cran.us.r-project.org", dependencies = F)
Hello
I'm trying to generate rasters using the
nlm_gaussianfield()
function. However, the generation fails whenever the function is called in a parallel session.This yields the following error message:
This appears to be an issue related to the
RandomFields
andRandomFieldsUtils
packages, as the same code works when I install older package versions from the archive:Here's my
sessionInfo()