[Yt-svn] commit/yt: MatthewTurk: Adding a buffer-aware version of _mpi_allsum.

Bitbucket commits-noreply at bitbucket.org
Fri Feb 25 08:40:02 PST 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/f35629ccd48b/
changeset:   r3773:f35629ccd48b
branch:      yt
user:        MatthewTurk
date:        2011-02-25 17:39:43
summary:     Adding a buffer-aware version of _mpi_allsum.
affected #:  1 file (240 bytes)

--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py	Thu Feb 24 23:29:10 2011 -0700
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py	Fri Feb 25 08:39:43 2011 -0800
@@ -1117,7 +1117,13 @@
         self._barrier()
         # We use old-school pickling here on the assumption the arrays are
         # relatively small ( < 1e7 elements )
-        return MPI.COMM_WORLD.allreduce(data, op=MPI.SUM)
+        if isinstance(data, na.ndarray):
+            tr = na.zeros_like(data)
+            if not data.flags.c_contiguous: data = data.copy()
+            MPI.COMM_WORLD.Allreduce(data, tr, op=MPI.SUM)
+            return tr
+        else:
+            return MPI.COMM_WORLD.allreduce(data, op=MPI.SUM)
 
     @parallel_passthrough
     def _mpi_Allsum_double(self, data):

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list