Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comm: add alternate version of scatter #7

Merged
merged 1 commit into from
Oct 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions python/lsst/ctrl/pool/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,30 @@ def broadcast(self, value, root=0):
with PickleHolder(value):
return super(Comm, self).bcast(value, root=root)

def scatter(self, dataList, root=0, tag=0):
"""Scatter data across the nodes

The default version apparently pickles the entire 'dataList',
which can cause errors if the pickle size grows over 2^31 bytes
due to fundamental problems with pickle in python 2. Instead,
we send the data to each slave node in turn; this reduces the
pickle size.

@param dataList List of data to distribute; one per node
(including root)
@param root Index of root node
@param tag Message tag (integer)
@return Data for this node
"""
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider using numpy style documentation here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would, but I think using the old style is preferred to using heterogeneous styles in the same file, and also preferred to investing time in updating the entire file to use numpydoc.

if self.Get_rank() == root:
for rank, data in enumerate(dataList):
if rank == root:
continue
self.send(data, rank, tag=tag)
return dataList[root]
else:
return self.recv(source=root, tag=tag)

def Free(self):
if self._barrierComm is not None:
self._barrierComm.Free()
Expand Down