[yt-dev] YTSliceBase.reslice broken

Matthew Turk matthewturk at gmail.com
Tue Jul 23 09:36:03 PDT 2013


Hi Doug,

My vote is for number four.

Matt
On Jul 23, 2013 9:17 AM, "Douglas Harvey Rudd" <drudd at uchicago.edu> wrote:

> Hi all,
>
> In writing test cases for the slice selector I discovered that the reslice
> function of YTSliceBase appears to be broken due to caching at several
> levels.
>
> 1) the selector object stores the slice coordinate and was never updated
> 2) the grid selection is cached
> 3) the cell mask (created by fill_mask) is only updated when the selector
> id changes
>
> I fixed 1) and 2) by overloading the clear_data function in
> YTSelectionDataContainer:
>
>     def clear_data(self):
>         """
>         Clears out all data from the YTSelectionDataContainer instance,
> freeing memory.
>         """
>         self._selector = None
>         self._current_chunk = None
>         self.field_data.clear()
>
> and replaced the call to self.field_data.clear() in YTSliceBase.reslice
> with self.clear_data()
>
> This forces the selector to be recreated when it is next requested.
>  Unfortunately the problem persisted, inconsistently, and I tracked it down
> to 3).  The id of the newly created selector was sometimes identical to the
> one prior to the reslice command.  In the grid_patch hierarchy, the cell
> mask is only recreated if the id of the selector object has changed, and so
> in this case an old mask persisted.
>
> I see several options for solving the problem:
>
> 1) replace using the python id function with a random identifier or hash
> of the actual selector data, to ensure it detects when the parameters have
> changed
> 2) reach into the hierarchy from the clear_data function and erase the
> cached cell mask
> 3) add a check in the hierarchy to detect if the chunking has changed
> along with the selector (not sure how this could be done, but probably a
> good idea anyway, for consistency)
> 4) remove the reslice function and prevent selection data containers from
> changing after creation
>
>
> Thoughts?
>
>
> Douglas Rudd
> Scientific Computing Consultant
> Research Computing Center
> drudd at uchicago.edu
>
>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20130723/9dd69675/attachment.html>


More information about the yt-dev mailing list