library(parallel) #example 1 cl <- makeCluster(getOption("cl.cores", 2)) clusterApply(cl, c(9,5), get("+"),1) #加 parSapply(cl, c(9,5), get("+"), 3) stopCluster(cl) #example 2 xx <- 1 cl <- makeCluster(getOption("cl.cores", 2)) clusterExport(cl, "xx") cy = f...
library(parallel) #example 1 cl <- makeCluster(getOption("cl.cores", 2)) clusterApply(cl, c(9,5), get("+"),1) #加 parSapply(cl, c(9,5), get("+"), 3) stopCluster(cl) #example 2 xx <- 1 cl <- makeCluster(getOption("cl.cores", 2)) clusterExport(cl, "xx") cy = f...