<div dir="ltr">I am not objecting to the concept but I have a question. Is it really faster? Don't you have to take compute time into account if you have a memory mapped file? That's when disk activity will actually occur. I am wondering if this approach doesn't simply postpone the inevitable till later. I understand this should be fast if processing only touches part of the data but then it shouldn't be loaded in the first place.<div>

<br></div><div>-berk</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 16, 2014 at 2:08 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Burlen,<br>
<br>
Thanks for the links.  I guess that I'm looking for deeper integration<br>
(though less general) than a callback.  The idea is to have something<br>
like a vtkMemoryMap class to take care of all the platform-specific<br>
details of creating/deleting memory maps, and to have vtkAbstractArray<br>
be aware of this class and use it to delete mmaps when appropriate.<br>
<span class="HOEnZb"><font color="#888888"><br>
  David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, May 16, 2014 at 11:56 AM, Burlen Loring <<a href="mailto:burlen.loring@gmail.com">burlen.loring@gmail.com</a>> wrote:<br>
> meant to say "no special memory management issues"<br>
> and (in case you actually would look at the code) mmap use is here:<br>
> <a href="https://github.com/burlen/SC11-100GB-Demo/blob/master/SC11DemoReader.h" target="_blank">https://github.com/burlen/SC11-100GB-Demo/blob/master/SC11DemoReader.h</a><br>
><br>
> On 05/16/2014 10:50 AM, Burlen Loring wrote:<br>
><br>
> Hi David,<br>
><br>
> I've used mmap with VTK in C++ for the SC11 100GB network demo.<br>
><br>
> <a href="http://dl.acm.org/citation.cfm?id=2287004" target="_blank">http://dl.acm.org/citation.cfm?id=2287004</a><br>
> <a href="https://github.com/burlen/SC11-100GB-Demo" target="_blank">https://github.com/burlen/SC11-100GB-Demo</a><br>
><br>
> This use was very ad-hoc and we wanted the data mapped for the life of the<br>
> app so there were special memory management issues.<br>
><br>
> patch(<a href="http://review.source.kitware.com/#/c/14072/" target="_blank">http://review.source.kitware.com/#/c/14072/</a>) would have handled<br>
> situations such as this through a callback invoked when the data array is<br>
> finished with the pointer. However, that patch was rejected for being<br>
> overkill. Instead Berk suggested that I simply use the delete event<br>
> observer, which will always result in data being released but perhaps not as<br>
> quickly as with the callback or the method that you proposed(eg nothing<br>
> happens if the array is resized). This approach has worked well for me. I<br>
> wonder if using the delete event observer would work well in your case?<br>
><br>
> Burlen<br>
><br>
><br>
> On 05/16/2014 10:21 AM, David Gobbi wrote:<br>
><br>
> Hi All,<br>
><br>
> I've used memory mapped files with VTK in the past, using the python<br>
> "mmap" object to create the map and then passing the resulting pointer<br>
> to VTK via the SetVoidArray() method.  For large files (several GB) I've<br>
> found this to be many times faster than e.g. vtkImageReader2.<br>
><br>
> My question: has anyone used mmap with VTK in C++?  Specifically,<br>
> what I'm interested in doing is adding a new "delete method" to the<br>
> SetVoidPointer() method in vtkDataArrayTemplate.h: it already has<br>
> "delete methods" for "malloc" and "new", so the idea is to add another<br>
> delete method for "mmap" that will call munmap on the pointer.<br>
><br>
>    David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br></div>