[R-sig-hpc] parallel code using snowfall

Mario Valle mvalle at cscs.ch
Wed Mar 24 11:40:11 CET 2010


sfLibrary could be useful (check example)

Ciao!
		mario

On 24-Mar-10 11:31, Carl Boettiger wrote:
> Dear R-sig-phylo,
>
> Is there a way to export all functions from a particular namespace in
> sfExport?
>
> I find I can export all functions I have declared using sfExportAll(),
> but functions I have imported from a library I have to export one by one:
>
> sfExport("fn1", namespace="packagename")
> sfExport("fn2", namespace="packagename")
> sfExport("fn3", namespace="packagename2")
>
> Also, is it computationally inefficient to export more functions than
> necessary for the computation?  Thanks again for the help,
>
> Carl
>
> On Wed, Mar 24, 2010 at 3:07 AM, Carl Boettiger <cboettig at gmail.com
> <mailto:cboettig at gmail.com>> wrote:
>
>     Dear Mario, list,
>
>     Thank you very much.  Seems I need quotes, sfExport("f"), and this
>     works perfectly.
>
>     Yours,
>     Carl
>
>
>     On Wed, Mar 24, 2010 at 2:59 AM, Mario Valle <mvalle at cscs.ch
>     <mailto:mvalle at cscs.ch>> wrote:
>
>         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
>
>
>
>
>     --
>     Carl Boettiger
>     Population Biology, UC Davis
>     http://two.ucdavis.edu/~cboettig
>
>
>
>
> --
> Carl Boettiger
> Population Biology, UC Davis
> http://two.ucdavis.edu/~cboettig

-- 
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