[Yt-svn] yt: Some more minor improvements, using allgather[v] instead of ...

hg at spacepope.org hg at spacepope.org
Sat Sep 25 13:53:02 PDT 2010


hg Repository: yt
details:   yt/rev/164ec43b20d7
changeset: 3414:164ec43b20d7
user:      Matthew Turk <matthewturk at gmail.com>
date:
Sat Sep 25 13:52:58 2010 -0700
description:
Some more minor improvements, using allgather[v] instead of alltoall[v].

diffstat:

 yt/utilities/parallel_tools/parallel_analysis_interface.py |  21 +++++-----
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (47 lines):

diff -r d075b21170dd -r 164ec43b20d7 yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py	Sat Sep 25 12:56:27 2010 -0700
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py	Sat Sep 25 13:52:58 2010 -0700
@@ -881,10 +881,10 @@
         field_keys = data.keys()
         field_keys.sort()
         size = data[field_keys[0]].shape[-1]
-        # MPI_Scan is an inclusive scan
-        outsizes = na.array([size] * MPI.COMM_WORLD.size, dtype='int64')
-        sizes = outsizes.copy()
-        MPI.COMM_WORLD.Alltoall( [outsizes, MPI.LONG], [sizes, MPI.LONG] )
+        sizes = na.zeros(MPI.COMM_WORLD.size, dtype='int64')
+        outsize = na.array(size, dtype='int64')
+        MPI.COMM_WORLD.Allgather([outsize, 1, MPI.LONG],
+                                 [sizes, 1, MPI.LONG] )
         # This nested concatenate is to get the shapes to work out correctly;
         # if we just add [0] to sizes, it will broadcast a summation, not a
         # concatenation.
@@ -1305,9 +1305,10 @@
     @parallel_passthrough
     def _mpi_catarray(self, data):
         size = data.shape[-1]
-        outsizes = na.array([size] * MPI.COMM_WORLD.size, dtype='int64')
-        sizes = outsizes.copy()
-        MPI.COMM_WORLD.Alltoall( [outsizes, MPI.LONG], [sizes, MPI.LONG] )
+        sizes = na.zeros(MPI.COMM_WORLD.size, dtype='int64')
+        outsize = na.array(size, dtype='int64')
+        MPI.COMM_WORLD.Allgather([outsize, 1, MPI.LONG],
+                                 [sizes, 1, MPI.LONG] )
         # This nested concatenate is to get the shapes to work out correctly;
         # if we just add [0] to sizes, it will broadcast a summation, not a
         # concatenation.
@@ -1529,12 +1530,10 @@
     recv = na.empty(total_size, dtype=send.dtype)
     recv[offset:offset+send.size] = send[:]
     dtr = send.dtype.itemsize / tmp_send.dtype.itemsize # > 1
-    soff = [0] * MPI.COMM_WORLD.size
-    ssize = [tmp_send.size] * MPI.COMM_WORLD.size
     roff = [off * dtr for off in offsets]
     rsize = [siz * dtr for siz in sizes]
     tmp_recv = recv.view(__tocast)
-    MPI.COMM_WORLD.Alltoallv((tmp_send, (ssize, soff), MPI.CHAR),
-                             (tmp_recv, (rsize, roff), MPI.CHAR))
+    MPI.COMM_WORLD.Allgatherv((tmp_send, tmp_send.size, MPI.CHAR),
+                              (tmp_recv, (rsize, roff), MPI.CHAR))
     return recv
     



More information about the yt-svn mailing list