-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kenstone Algorithm is not running in parallel #22
Comments
Hi, |
Hi @soottikkal , library("prospectr")
library("future.apply")
# Custom function
myfunc <- function(x) {
data(NIRsoil)
sel <- kenStone(NIRsoil$spc, k = 30, pc = .99)
}
# Set up PSOCK cluster (no forking on Windows); launch new R processes
plan(multiprocess)
# execute on all available cores
future_lapply(X = 1:2, FUN = myfunc)
# or classic way via `parallel::parLapply`
# make cluster
library("parallel")
ncores <- detectCores()
cl <- makeCluster(spec = ncores)
clusterExport(cl = cl, c("kenStone", "NIRsoil"))
parLapply(cl = cl, X = 1:2, fun = myfunc)
stopCluster(cl) |
I just also tested |
I am trying to parallelize my R code. All of my functions are running in parallel as expected, but when the KenStone algorithm is called the R process just hangs. You can test it with the following code.
Any suggestions? Thanks
The text was updated successfully, but these errors were encountered: