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

MinRK benjaminrk at gmail.com
Wed Sep 10 13:40:57 EDT 2014


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)

-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
>
>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140910/14a854ca/attachment.html>


More information about the IPython-dev mailing list