简体   繁体   English

使用mclapply的并行软件包仅适用于2个内核,而不是全部4个内核

[英]Parallel package using mclapply works with only 2 cores instead of all 4

I have this example data 我有这个例子数据

library("parallel")
DV<-runif(1000,min=-5,max=5)
RV_1<-runif(1000,min=-5,max=5)
RV_2<--runif(1000,min=-5,max=5)
df<-data.frame(DV,RV_1,RV_2)
fun<-function(x){
  n<-neuralnet(DV~RV_1+RV_2,data=df,hidden=x)
  return(n)
}

and if I use for example 如果我用例如

mclapply(c(1:5),fun)

the task manager shows that only 2 cores works on 100 %. 任务管理器显示,只有2个内核可以100%工作。 But if I check this 但是如果我检查这个

detectCores()

It sees all 4 cores. 它可以看到所有4个核心。 Any advices how to fix it? 有什么建议如何解决吗? I've bought new i5-4960k for improve my computation speed but it won't be much better this way. 我已经购买了新的i5-4960k,以提高计算速度,但这种方法不会更好。 Thanks anybody 谢谢大家

通过使用mclapply(c(1:5),fun,mc.cores = 4)来解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM