Reputation: 446
I am relatively new to working with the parallel
and doParallel
packages in R.
I have an R script already written. (I can't upload it due to some privacy reasons.) But, in terms of parallelisation, I am using the following:
no_cores = parallel::detectCores() - 2
doParallel::registerDoParallel(cores = no_cores)
cl = parallel::makeCluster(no_cores, type = "FORK")
`%dopar%` <- foreach::`%dopar%`
output = foreach::foreach(sim = 1:10) %dopar% {
# blah blah blah ...
}
parallel::stopCluster(cl)
I was using this script several months ago and it worked perfectly. I made no changes to it. Today, it ran successfully and as expected on the first try. However, after this (and for several hours today), I received the following output/warnings/errors/messages:
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFUNDATION_FUNCTIONALITY___YOU_MUST_EXE
C() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFUNDATION_FUNCTIONALITY___YOU_MUST_EXE
C() to debug.
...
objc[60561]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[60561]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
objc[60559]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[60559]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
objc[60562]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
...
Warning message:
In mclapply(argsList, FUN, preschedule = preschedule, mc.set.seed = set.seed, : all values of the jobs will be affected...
Since posting this question, I tried running it again and this time it was successful. But, I don't know why.
Can anyone tell me the reason behind this output/warnings/errors/messages? I want to be prepared for if it happens again.
I did find several questions related to this exact issue on SO; however, they all seem to be Python related, and I can't seem to find an approach to solving this issue happening in R/RStudio.
Would greatly appreciate any help!
Also, if it matters, I'm using a MacBook Air M1 (2020) running 14.6.1.
[Edited to try to provide more detail and replace the image with a code block.]
Upvotes: 0
Views: 79