efficient icon indicating copy to clipboard operation
efficient copied to clipboard

Snakes and Ladders needs Function definition in Windows

Open aegerton opened this issue 4 years ago • 0 comments

When I run the Snakes and Ladders example on Windows with the following code;-

cl = makeCluster(4)
parSapply(cl, 1:N, snakes_ladders)

I get the following error message;-

Error in checkForRemoteErrors(val) : 
  4 nodes produced errors; first error: could not find function "move"

Researching further elsewhere, I seem to need the following code in addition when using Windows;-

clusterExport(cl, list("move", "check_snake", "check_ladders", "snakes_ladders"))

Something about under Windows, "Parallel Socket Cluster (PSOCK) starting out with only the base packages loaded, whereas on Mac/Linux it automatically contains all environment variables" (https://stackoverflow.com/questions/12532257/could-not-find-function-inside-clusterapply) . Is that right, please?

aegerton avatar May 02 '20 06:05 aegerton