Bury
Bury

Reputation: 567

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 %. But if I check this

detectCores()

It sees all 4 cores. 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. Thanks anybody

Upvotes: 1

Views: 692

Answers (1)

Bury
Bury

Reputation: 567

SOLVED by using mclapply(c(1:5),fun,mc.cores=4)

Upvotes: 1

Related Questions