Skip to content

Mclapply and print statement

2 messages · Alaios, Steve Lianoglou

#
Dear all.
I am using the mclapply function to split my code to the many cores my system has. It seems that is working fine. This is the parallel version of lcapply.

The only problem that I seem to have is that the printf cannot print messages. 

The ideal to me is to have fro my function an output of the form
Shadowlist<-mclapply(1:dimz, function(i) {
			      print(sprintf('Creating the %d map',i));
			      GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean,variance,nugget,scale,Whit.alpha))
			    }
	    ) 

'I am the processor %d and I work with the task %d',processorid,i

So far I get not output from my print(sprintf(... function.

What do you think I should try out?

Best Regards
Alex
#
Hi,
On Mon, Apr 11, 2011 at 5:26 AM, Alaios <alaios at yahoo.com> wrote:
Use `cat`:

R> x <- mclapply(1:20, function(i) cat(i, "\n"))
1
9
17
2
10
18
3
11
19
4
12
20
5
13
6
14
7
15
8
16