[Yt-svn] commit/yt: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Tue Aug 23 05:15:22 PDT 2011


3 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/062b4dd40731/
changeset:   062b4dd40731
branch:      yt
user:        MatthewTurk
date:        2011-08-23 13:43:16
summary:     Reduce by a good factor the number of items in grid_file_locations for RAMSES grids.  Speeds up 20yt/frontends/ramses/_ramses_reader.pyx the reading operation.
affected #:  1 file (5 bytes)

--- a/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 07:14:10 2011 -0400
+++ b/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 07:43:16 2011 -0400
@@ -789,8 +789,8 @@
                         i = i2 - self.left_edge[2]
                         sig2[i] += 1
                         efficiency += 1
-                        used += 1
                         mask[gi] = 1
+            used += mask[gi]
         cdef np.ndarray[np.int64_t, ndim=2] gfl
         gfl = np.zeros((used, 6), 'int64')
         used = 0


http://bitbucket.org/yt_analysis/yt/changeset/0cef60314c2a/
changeset:   0cef60314c2a
branch:      yt
user:        MatthewTurk
date:        2011-08-23 13:59:00
summary:     A few more minor speedups for RAMSES reader
affected #:  2 files (165 bytes)

--- a/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 07:43:16 2011 -0400
+++ b/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 07:59:00 2011 -0400
@@ -488,9 +488,9 @@
 
         return cell_count
 
-    def ensure_loaded(self, char *varname, int domain_index):
+    def ensure_loaded(self, char *varname, int domain_index, int varindex = -1):
         # this domain_index must be zero-indexed
-        cdef int varindex = self.field_ind[varname]
+        if varindex == -1: varindex = self.field_ind[varname]
         if self.loaded[domain_index][varindex] == 1:
             return
         cdef string *field_name = new string(varname)
@@ -647,14 +647,16 @@
             data[i] = local_hydro_data.m_var_array[level][8*grid_id+i]
         return tr
 
-    def read_grid(self, char *field, 
+    @cython.cdivision(True)
+    @cython.boundscheck(False)
+    @cython.wraparound(False)
+    def read_grid(self, int varindex, char *field,
                   np.ndarray[np.int64_t, ndim=1] start_index,
                   np.ndarray[np.int32_t, ndim=1] grid_dims,
                   np.ndarray[np.float64_t, ndim=3] data,
                   np.ndarray[np.int32_t, ndim=3] filled,
                   int level, int ref_factor,
                   np.ndarray[np.int64_t, ndim=2] component_grid_info):
-        cdef int varindex = self.field_ind[field]
         cdef RAMSES_tree *local_tree = NULL
         cdef RAMSES_hydro_data *local_hydro_data = NULL
 
@@ -674,7 +676,7 @@
         for gi in range(component_grid_info.shape[0]):
             domain = component_grid_info[gi,0]
             if domain == 0: continue
-            self.ensure_loaded(field, domain - 1)
+            self.ensure_loaded(field, domain - 1, varindex = varindex)
             local_tree = self.trees[domain - 1]
             local_hydro_data = self.hydro_datas[domain - 1][varindex]
             offset = component_grid_info[gi,1]


--- a/yt/frontends/ramses/io.py	Tue Aug 23 07:43:16 2011 -0400
+++ b/yt/frontends/ramses/io.py	Tue Aug 23 07:59:00 2011 -0400
@@ -41,10 +41,11 @@
         to_fill = grid.ActiveDimensions.prod()
         grids = [grid]
         l_delta = 0
+        varindex = self.ramses_tree.field_ind[field]
         while to_fill > 0 and len(grids) > 0:
             next_grids = []
             for g in grids:
-                to_fill -= self.ramses_tree.read_grid(field,
+                to_fill -= self.ramses_tree.read_grid(varindex, field,
                         grid.get_global_startindex(), grid.ActiveDimensions,
                         tr, filled, g.Level, 2**l_delta, g.locations)
                 next_grids += g.Parent


http://bitbucket.org/yt_analysis/yt/changeset/43146c56c7db/
changeset:   43146c56c7db
branch:      yt
user:        MatthewTurk
date:        2011-08-23 14:14:55
summary:     This minor change to function declarations in Cython sped the RAMSES projection
time up by more than a factor of two.  I think RAMSES is now competitive with
Enzo and Orion in speed!
affected #:  1 file (10 bytes)

--- a/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 07:59:00 2011 -0400
+++ b/yt/frontends/ramses/_ramses_reader.pyx	Tue Aug 23 08:14:55 2011 -0400
@@ -488,7 +488,7 @@
 
         return cell_count
 
-    def ensure_loaded(self, char *varname, int domain_index, int varindex = -1):
+    cdef ensure_loaded(self, char *varname, int domain_index, int varindex = -1):
         # this domain_index must be zero-indexed
         if varindex == -1: varindex = self.field_ind[varname]
         if self.loaded[domain_index][varindex] == 1:
@@ -676,7 +676,7 @@
         for gi in range(component_grid_info.shape[0]):
             domain = component_grid_info[gi,0]
             if domain == 0: continue
-            self.ensure_loaded(field, domain - 1, varindex = varindex)
+            self.ensure_loaded(field, domain - 1, varindex)
             local_tree = self.trees[domain - 1]
             local_hydro_data = self.hydro_datas[domain - 1][varindex]
             offset = component_grid_info[gi,1]

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