Skip to content
Back to formatted view

Raw Message

Message-ID: <AANLkTim7KO55wb7t5vLLZmCGGk_eQamHDxRfXpAhEg3F@mail.gmail.com>
Date: 2010-12-05T14:49:09Z
From: Santosh Srinivas
Subject: foreach question

Hello Group,

I am experimenting with parallel processing ... here is part of my code.

require(snow)
require(doSNOW)
require(foreach)
cl.tmp = makeCluster(rep("localhost",4), type="SOCK")
registerDoSNOW(cl.tmp)
	
foreach(i=1:NROW(sDat),.packages="gdata",.verbose=TRUE) %dopar% {

do something 1
do something 2
do something 3
}

I ran this individually without a parallel setup and it works perfectly

Now when I do the parallel invocation the error being thrown is that
the functions which I created are not being passed to the parallel
instances.
do something 1,2,3 above use my functions which I created in the code itself.

Is there someway that I can have then pass to the parallel routines?
Is this the right approach?

Thanks and have a nice weekend.
S