[yt-svn] commit/yt: jwise77: This changeset reduces memory usage in the rockstar interface.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Feb 4 14:24:25 PST 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/1b17b7e8bcf0/
Changeset:   1b17b7e8bcf0
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-04 22:00:11
Summary:     This changeset reduces memory usage in the rockstar interface.

First, the interface will add the particle_filter if it does not exist
already in the output.  This reduces the need to load the hierarchy in
every process in every output.  In the first output, it adds the
filter on all processes, but for all subsequent outputs, only the
readers add the filter.

Second, I have added a hierarchy destructor that deallocates all of
the hierarchy metadata and grids.  This is called at the end of
rh_read_particles().
Affected #:  3 files

diff -r ff3258d638cd28886685094651ab13368ba16aec -r 1b17b7e8bcf0c9a131f8660adf6601d69302fedf yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -222,6 +222,10 @@
         if self.workgroup.name != "readers": return None
         tpf = ts[0]
         ptype = self.particle_type
+        if ptype not in tpf.particle_types:
+            has_particle_filter = tpf.add_particle_filter(ptype)
+            if not has_particle_filter:
+                raise RuntimeError("Particle type (filter) %s not found." % (ptype))
 
         dd = tpf.h.all_data()
         # Get DM particle mass.
@@ -250,6 +254,7 @@
         p['right_edge'] = tpf.domain_right_edge
         p['center'] = (tpf.domain_right_edge + tpf.domain_left_edge)/2.0
         p['particle_mass'] = self.particle_mass = particle_mass
+        del tpf
         return p
 
     def __del__(self):

diff -r ff3258d638cd28886685094651ab13368ba16aec -r 1b17b7e8bcf0c9a131f8660adf6601d69302fedf yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -188,6 +188,10 @@
     # if the number of readers > 1.
     dd = pf.h.all_data()
 
+    # Add particle type filter if not defined
+    if rh.particle_type not in pf.particle_types:
+        pf.add_particle_filter(rh.particle_type)
+
     if NUM_BLOCKS > 1:
         local_parts = 0
         for chunk in parallel_objects(
@@ -226,6 +230,8 @@
             fi += 1
         pi += npart
     num_p[0] = local_parts
+    del pf._instantiated_hierarchy
+    del pf
 
 cdef class RockstarInterface:
 

diff -r ff3258d638cd28886685094651ab13368ba16aec -r 1b17b7e8bcf0c9a131f8660adf6601d69302fedf yt/geometry/grid_geometry_handler.py
--- a/yt/geometry/grid_geometry_handler.py
+++ b/yt/geometry/grid_geometry_handler.py
@@ -56,6 +56,14 @@
         mylog.debug("Re-examining hierarchy")
         self._initialize_level_stats()
 
+    def __del__(self):
+        del self.grid_dimensions
+        del self.grid_left_edge
+        del self.grid_right_edge
+        del self.grid_levels
+        del self.grid_particle_count
+        del self.grids
+
     @property
     def parameters(self):
         return self.parameter_file.parameters

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