[R-sig-hpc] parallel code using snowfall
Mario Valle
mvalle at cscs.ch
Wed Mar 24 10:59:30 CET 2010
sfExport(f)
On 24-Mar-10 10:55, Carl Boettiger wrote:
> Dear r-sig-hpc,
>
> I am puzzled why my parallel command loses track of my function definitions
> during the call. For instance, consider the following codeblock:
>
>
> sfInit(parallel=TRUE, cpus=2)
> f<- function(x){ dnorm(x, 1, 2) }
> g<- function(x){ 2*f(x)}
> sfSapply(1:10, g)
>
>
> This fails to run, giving the error:
> Error in checkForRemoteErrors(val) :
> 2 nodes produced errors; first error: could not find function "f"
>
> even though it runs fine in serial, with sfInit(parallel=F). Why does the
> package loose track of f? This becomes quite problematic when writing
> functions such as g that depend on functions provided by other packages,
> etc. Any suggestions or possible workarounds?
>
> Thanks for your help,
>
> Carl
>
--
Ing. Mario Valle
Data Analysis and Visualization Group |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
More information about the R-sig-hpc
mailing list