[Yt-svn] yt-commit r710 - in branches/parallel_profiles/yt: . lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Jul 30 20:29:27 PDT 2008


Author: mturk
Date: Wed Jul 30 20:29:26 2008
New Revision: 710
URL: http://yt.spacepope.org/changeset/710

Log:
Testing out moving stuff around inside the parallel interface.  This might
actually fix the problem of switching on and off the parallel behavior.



Modified:
   branches/parallel_profiles/yt/lagos/Profiles.py
   branches/parallel_profiles/yt/parallel_tools.py

Modified: branches/parallel_profiles/yt/lagos/Profiles.py
==============================================================================
--- branches/parallel_profiles/yt/lagos/Profiles.py	(original)
+++ branches/parallel_profiles/yt/lagos/Profiles.py	Wed Jul 30 20:29:26 2008
@@ -61,19 +61,21 @@
             deps += fieldInfo[field].get_dependencies().requested
         return list(set(deps))
 
+    def _initialize_parallel(self, fields):
+        if hasattr(self._data_source.hierarchy, 'queue'):
+            self._data_source.hierarchy.queue.preload(self._get_grid_objs(), 
+                                                      self._get_dependencies(fields))
+
     def _lazy_add_fields(self, fields, weight, accumulation):
         self._ngrids = 0
         self.__data = {}         # final results will go here
         self.__weight_data = {}  # we need to track the weights as we go
-        if hasattr(self._data_source.hierarchy, 'queue'):
-            self._data_source.hierarchy.queue.preload(self._get_grid_objs(), 
-                                                      self._get_dependencies(fields))
         for field in fields:
             self.__data[field] = self._get_empty_field()
             self.__weight_data[field] = self._get_empty_field()
         self.__used = self._get_empty_field().astype('bool')
         #pbar = get_pbar('Binning grids', len(self._data_source._grids))
-        for gi,grid in enumerate(self._get_grids()):
+        for gi,grid in enumerate(self._get_grids(fields)):
             self._ngrids += 1
             #pbar.update(gi)
             args = self._get_bins(grid, check_cut=True)

Modified: branches/parallel_profiles/yt/parallel_tools.py
==============================================================================
--- branches/parallel_profiles/yt/parallel_tools.py	(original)
+++ branches/parallel_profiles/yt/parallel_tools.py	Wed Jul 30 20:29:26 2008
@@ -74,7 +74,6 @@
         self.my_grid_ids = na.mgrid[upper:lower-1].astype("int64")
         
     def __iter__(self):
-        if not self.just_list: self.pobj._initialize_parallel()
         self.pos = 0
         return self
 
@@ -89,9 +88,10 @@
 class ParallelAnalysisInterface(object):
     _grids = None
 
-    def _get_grids(self):
+    def _get_grids(self, *args, **kwargs):
         if parallel_capable and \
            ytcfg.getboolean("yt","parallel"):
+            self._initialize_parallel(*args, **kwargs)
             return ParallelGridIterator(self)
         return GridIterator(self)
 



More information about the yt-svn mailing list