[IPython-dev] Node in cluster know its rank, or cluster size?

Doug Blank doug.blank at gmail.com
Wed Sep 10 13:51:48 EDT 2014


On Wed, Sep 10, 2014 at 1:40 PM, MinRK <benjaminrk at gmail.com> wrote:

> On Wed, Sep 10, 2014 at 7:14 AM, Doug Blank <doug.blank at gmail.com> wrote:
>
> After reading the docs and tutorial on the parallel tools, and looking at
>> defined variables in the remote environment, I couldn't find a place where
>> a node in a cluster (not using mpi, but just starting the cluster via the
>> notebook with default profile) knows its rank (or some id) and knows the
>> cluster size.
>>
>> Is rank and size information available to a node in the cluster?
>>
> No, you would have to pass this yourself from the client. The code that’s
> in many of the parallel examples uses scatter:
>
> rc[:]['size'] = len(rc)
> rc[:].scatter('rank', rc.ids, flatten=True)
>
> Thanks! short, sweet, and answers my question!

-Doug

 -MinRK
>
>
>> I guess this could work:
>>
>> view["size"] = len(view)
>>
>> def set_rank(n):
>>     global rank
>>     rank = n
>>
>> view.execute("""
>> def set_rank(n):
>>     global rank
>>     rank = n
>> """)
>> view.map(set_rank, range(len(view)))
>>
>> Better way? My parallel-foo is week.
>>
>> -Doug
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140910/7a08dc4e/attachment.html>


More information about the IPython-dev mailing list