[Yt-svn] yt: Fixing parallelism for the case where Nproc > Ngrids.

hg at spacepope.org hg at spacepope.org
Sun Feb 20 15:12:25 PST 2011


hg Repository: yt
details:   yt/rev/6e876d5e0203
changeset: 3758:6e876d5e0203
user:      John Wise <jwise at astro.princeton.edu>
date:
Sun Feb 20 18:11:14 2011 -0500
description:
Fixing parallelism for the case where Nproc > Ngrids.

diffstat:

 yt/frontends/enzo/io.py                                    |  3 +++
 yt/utilities/parallel_tools/parallel_analysis_interface.py |  7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 2164bd47f1f9 -r 6e876d5e0203 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py	Sat Feb 19 17:46:24 2011 -0500
+++ b/yt/frontends/enzo/io.py	Sun Feb 20 18:11:14 2011 -0500
@@ -159,6 +159,9 @@
         return field.swapaxes(0,2)
 
     def preload(self, grids, sets):
+        if len(grids) == 0:
+            data = None
+            return
         # We need to deal with files first
         files_keys = defaultdict(lambda: [])
         pf_field_list = grids[0].pf.h.field_list
diff -r 2164bd47f1f9 -r 6e876d5e0203 yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py	Sat Feb 19 17:46:24 2011 -0500
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py	Sun Feb 20 18:11:14 2011 -0500
@@ -1041,13 +1041,16 @@
             ncols = -1
             size = 0
         else:
-            if len(data.shape) == 1:
+            if len(data) == 0:
+                ncols = -1
+                size = 0
+            elif len(data.shape) == 1:
                 ncols = 1
                 size = data.shape[0]
             else:
                 ncols, size = data.shape
         ncols = MPI.COMM_WORLD.allreduce(ncols, op=MPI.MAX)
-        if data is None:
+        if size == 0:
             data = na.empty((ncols,0), dtype='float64') # This only works for
         size = data.shape[-1]
         sizes = na.zeros(MPI.COMM_WORLD.size, dtype='int64')



More information about the yt-svn mailing list