I am slightly confused by the way the standard output is redirected in a R snow cluster environment. I am using parLapply from the snow package to execute a function on my MPI/LAM cluster. How can I redirect standard output (produced using "cat") from this function back to the terminal where I invoked it? I intend to transmit some status information in advance to the final result of the function. I investigated the chain of functions called by parLapply and it seems that snow is designed to just retrieve the final result of the computation. Thanks in advance for any hints, Frank Preiswerk [[alternative HTML version deleted]]
On Tue, 27 Mar 2007, Frank Preiswerk wrote:> I am slightly confused by the way the standard output is redirected in a R > snow cluster environment. > I am using parLapply from the snow package to execute a function on my > MPI/LAM cluster. How can I redirect standard output (produced using "cat") > from this function back to the terminal where I invoked it? I intend to > transmit some status information in advance to the final result of the > function. I investigated the chain of functions called by parLapply and it > seems that snow is designed to just retrieve the final result of the > computation.The R level only deals with final values. There is currently no means within snow to communicate status information back to the master. By default output is redirected to /dev/null. You can provide an alternate destination with the outfile option and monitor those files from another process. Best, luke> > Thanks in advance for any hints, > Frank Preiswerk > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke at stat.uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu
Frank -- Perhaps what you want to do is summarize <- function(lst) { lapply(lst, function(elt) { if (elt$status=="ok") elt$value else NA }) } summarize(parLapply(tasks, function(elt) { # fancy calculation, then list(status="ok", value=...) })) i.e., return status along with value from the nodes, and 'post-process' the result. Perhaps status is set by capture.output on the node. Maybe you're hoping to change how later tasks are evaluated based on results of earlier tasks; but this makes the lapply sequential rather than parallel. Martin "Frank Preiswerk" <frank.preiswerk at stud.unibas.ch> writes:> I am slightly confused by the way the standard output is redirected in a R > snow cluster environment. > I am using parLapply from the snow package to execute a function on my > MPI/LAM cluster. How can I redirect standard output (produced using "cat") > from this function back to the terminal where I invoked it? I intend to > transmit some status information in advance to the final result of the > function. I investigated the chain of functions called by parLapply and it > seems that snow is designed to just retrieve the final result of the > computation. > > Thanks in advance for any hints, > Frank Preiswerk > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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.-- Martin Morgan Bioconductor / Computational Biology http://bioconductor.org