[R-SIG-Mac] Re : Re : Re : Snow package on bi-proc G5

Naji nassar at noos.fr
Mon Jun 20 15:47:47 CEST 2005


Simon, dear all

Thanks for your quick reply.

The first point is fixed, I had put the .profile at /usr directory. I moved
it at $HOME, restarted and it worked perfectly.

I adopted the clusterExport solution.. And it's running quite fine..

Clusterapplylb is sending back a list where each element contains the
results of on replication. I'm only interested with the mean of of those
replications (+ memory limitations)
One solution to circumvent that is a loop (say 10) over cl (say 1:2)
Rather than a cl(1:200).. The first is taking 1min, the 2nd 2min20
for (j in 1:(each/2)){
    sim=clusterApplyLB(cl,1:2,iterate)
    titles=titles+sim[[1]]+sim[[2]]
    }
Rather than
sim=clusterApplyLB(cl,1:each,iterate)

A more elegant solution is highly welcome (for the first solution, I guess
the node occupation won't be optimized in case of lot of nodes. All the
nodes have to finish their job, actualize the list before getting to the
next loop)

Can I define an array that stores the sum of the simulations
 ie in the ClustrApplyLB function:
Iterate=function(iter){
..
Clusterexport(cl,SumSimul)
SumSimul=SumSimul+simul
}
I don't think it would work as clusterapply is at the node level and
clusterexport at the master level, and performance will suffer from
communicating the SumSimul...

Best regards
Naji

Le 20/06/05 8:07, « Simon Urbanek » <simon.urbanek at r-project.org> a écrit :

> Hi Naji,
> 
> On Jun 19, 2005, at 9:41 PM, Naji wrote:
> 
>> I'm encountering 2 problems
>> - a silly one (how to fix env. var on my machine OS Tiger)
>>     in order to run PVM (and snow) I need to declare the following
> 
> You don't need all those - pvm sets them up automatically. The only
> one you really need is PVM_ROOT. You can set it in many places -
> depending how you start R and pvm.  For the shell you can use
> ~/.profile - that's sourced by bash and friends (the site version is
> in /etc/profile btw). For R you can use .Renviron (see ?Startup). I'm
> not sure how exactly you setup your PVM, but for a cluster I use
> ~/.ssh/environment (see sshd docs for details) - that works on any
> platform and allows inhomogenous clusters.
> 
>> - the second is adapting a loop for a Cluster (a replication eiher
>> a loop or a job for one proc)
>>     The loop code (working fine) & the cluster code giving the
>> following
>> errors
> 
> You have to keep in mind that the master node (the one you're running
> interactively) is separate from the working nodes. If you want
> variables to be assigned in other nodes as well, you have to use
> clusterExport (or use assignments in clusterCall and friends). In
> your case all the variables you define on top have to be exported (as
> well as any data you need) - if you don't have too much junk in your
> workspace you could even use something like clusterExport(cl, ls())
> 
> Cheers,
> Simon
>



More information about the R-SIG-Mac mailing list