On 08.12.2012 21:04, Martin Ivanov wrote:
Dear R Community,
I am running R version 2.15.2 with package parallel version 2.15.2.
The problem is that cat and print do not produce any output. Also assigning
objects to the .GlobalEnv does not work. This makes it difficult for me to
debug code. This can be seen from the
following minimal working example:
print: You are printing in the R client, not on the master
assign: You are assigning to the .GlobalEnv of the client, not the one
of the master.
Best,
Uwe Ligges
library(parallel)
fun2 <- function(x) {
b <<- x; # try to export the object to the workspace
print(x); # try to print x
}
fun1 <- function(d) {
cl <- makeCluster(getOption("cl.cores", detectCores()));
parSapply(cl=cl, X=seq_along(d), FUN=fun2);
stopCluster(cl=cl);
}
fun3 <- function(d) sapply(X=seq_along(d), FUN=fun2);
fun1(d=1:5)
a <- fun3(d=1:5)
print only works when fun3 is called, that is when there is no parallelisation.
The
same is also true for the <<- assignment.
I am almost sure this is not a bug, but a feature, so I would like to ask you
for some explanation and also for some ideas how to handle debugging code when
no printing or exporting objects to the workspace works.
Any suggestions will be appreciated.
Best regards,
Martin Ivanov
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.