ingridm
ingridm

Reputation: 51

Error in makeCluster(detectCores(), type = "PSOCK") : unknown cluster type

I have a Mac and parallelized my code, which works fine. I recently realized that I need to run the code on Windows too, and the way I wrote it doesn't work on Windows computers. To make it work on Windows, I've tried to use Makecluster, but it keeps returning this error and I can't figure out why this is happening:

Error in makeCluster(detectCores(), type = "PSOCK") :    unknown cluster type

Here's a look at my code:

coefold <- rep(0,160)

cl <- makeCluster(detectCores(), type='PSOCK')
registerDoParallel(cl)

# Uses parallel to perform bootstrap; adds the result of each 
# foreach loop to a list of lists called coefold_storer
coefold_storer <- list()
coefold_storer <- foreach(i=1:bootrep, .combine=c) %dopar%{
  # cat("847 on bootstrap run: ",bootrun,".\n",sep="")
  rndsamp <- sample(1:length(yi),length(yi),replace=TRUE)
  indxrun <- repeatsales(yi[rndsamp],xi[rndsamp,],
                        maxdailyreturn,vweighti[rndsamp])
  coefold_storer[[length(coefold_storer)+1]] <- list(indxrun)
}
registerDoSEQ()

Upvotes: 2

Views: 874

Answers (1)

SeGa
SeGa

Reputation: 9809

Try with the parallel package. They have both the function makeCluster.

  • With parallel I can create a cluster on Windows 7 & 10.
  • With package snow I get the same error as you.

And you can just create the cluster without adding the argument "PSOCK" as it is taken by default.

Upvotes: 2

Related Questions