[Yt-dev] Periodic grid boxes

Matthew Turk matthewturk at gmail.com
Wed Aug 24 14:01:39 PDT 2011


Hi all,

I have been looking at FLASH data today, which suffers from a
particular oddity which will impact users of every other code;
however, block structured AMR will bring it out more often.

In the covering_grid code, we have this routine:

    def _get_list_of_grids(self, buffer = 0.0):
        import pdb;pdb.set_trace()
        if self._grids is not None: return
        if na.any(self.left_edge - buffer < self.pf.domain_left_edge) or \
           na.any(self.right_edge + buffer > self.pf.domain_right_edge):
            grids,ind = self.pf.hierarchy.get_periodic_box_grids(
                            self.left_edge - buffer,
                            self.right_edge + buffer)
            ind = slice(None)
        else:
            grids,ind = self.pf.hierarchy.get_box_grids(
                            self.left_edge - buffer,
                            self.right_edge + buffer)
        level_ind = (self.pf.hierarchy.grid_levels.ravel()[ind] <= self.level)
        sort_ind = na.argsort(self.pf.h.grid_levels.ravel()[ind][level_ind])
        self._grids = self.pf.hierarchy.grids[ind][level_ind][(sort_ind,)][::-1]

This is used to identify grids that overlap with a given region in
space.  As you can see, if the grid abuts the domain boundary, yt will
look for grids assuming a period.

But then that information is basically completely discarded, and all
grids are selected.  This absolutely *kills* performance.  I looked
into it, and this dates back several years.

Can anyone -- Stephen, Britton, Sam, you have all looked at periodic
grids -- think of a reason why we should err on the side of not
following the results of get_periodic_box_grids?  Or is it safe to
remove that line, and improve performance by a factor of tons?

Thanks,

-Matt



More information about the yt-dev mailing list