library(parallel)
cl=makeCluster(4)
txts = c("I", "AM", "NOT", "PRINTED")
clusterApply(cl, txts, function(txt){write(txt, stderr())})
stopCluster(cl)
txts = c("WHILE", "I", "AM", "PRINTED")
lapply(txts, function(txt){write(txt,stderr())})
When the above code is run, calls to write
from clusterApply
seem to be ignored: nothing is printed.
The reason I want to print from clusterApply
is that the code I'm going to run is expected to take many hours to complete; I want to be able to monitor progress.
I've found a surprising way to print from clusterApply
; namely C++ code run through Rcpp fromclusterApply
may print to console via std::cerr
. Still, doing this seems overkillish enough.
Is there any other way to print from clusterApply
?