Hello everyone,
I am currently working on parallel computing. When I use core=1,2,3,4 it takes almost the same amount of time even though it was supposed to take approximately one-fourth of the time when I used core=4 compared to core=1. But when I use core=5,6,... it takes more time than before. Please note that my 2022 Dell XPS has 10 cores. Can anyone help me out? The sample code is shown below.
library(parallel)
library(doParallel)
library(foreach)
core=3
cl <- parallel::makeCluster(core, setup_strategy = "sequential")
# Activate cluster for foreach library
registerDoParallel(cl)
unregister_dopar <- function() {
env <- foreach:::.foreachGlobals
rm(list=ls(name=env), pos=env)
}
result=foreach(i = 1:iter, .packages = c("VSURF", "MASS")) %dopar%{
...
}