<HTML>
<HEAD>
<TITLE>Re: [Paraview] Ridiculously slow D3 (a bug in vtkMergeCells)</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I would recommend submitting a bug report to make sure we don&#8217;t forget about this. &nbsp;Make sure you attach your patch to the report.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 9/30/09 6:15 AM, &quot;John Biddiscombe&quot; &lt;<a href="biddisco@cscs.ch">biddisco@cscs.ch</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Takuya <BR>
<BR>
Good work. If the kitware/Sandia guys don't respond, then I'll look at your patch in a week or two and get it in. (A lot of locator changes have been made recently, so do make sure you're using CVS pv)<BR>
<BR>
JB<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> <BR>
Hi,<BR>
<BR>
I have had a problem of ridiculously slow D3 of PV 3.6.1/3.7-cvs under<BR>
some conditions. Most of the time the problem occurs when I have more<BR>
pvserver processes than the number of data pieces, in which case D3<BR>
takes two orders of magnitude more time than usual, despite that the<BR>
resulting repartitioned dataset looks fine.<BR>
<BR>
Attaching a performance analyzer (Apple's Shark) to the pvserver<BR>
processes revealed that, in one of the pvserver processes<BR>
vtkMergePoints::InsertUniquePoint() took up virtually all of the<BR>
processor time, as attached sharkOutput.jpg.<BR>
<BR>
It further turned out that this is because the instance of<BR>
vtkMergePoints is given indeterminate bounds by its caller<BR>
vtkMergeCells::MapPointsToIdsUsingLocator() and hence hashing based on<BR>
relative point coordinates in the bounds is not working. Here is a<BR>
proposed fix to the problem (the comment &quot;points0-&gt;GetNumberOfPoints()<BR>
is equal to...&quot; was taken from about 50 lines below the patched lines<BR>
in the same function. I believe it explains everything.).<BR>
<BR>
Index: vtkMergeCells.cxx<BR>
===================================================================<BR>
RCS file: /cvsroot/ParaView3/ParaView3/VTK/Graphics/vtkMergeCells.cxx,v<BR>
retrieving revision 1.9<BR>
diff -u -r1.9 vtkMergeCells.cxx<BR>
--- vtkMergeCells.cxx&nbsp;23 Jan 2009 03:25:07 -0000&nbsp;1.9<BR>
+++ vtkMergeCells.cxx&nbsp;30 Sep 2009 06:47:09 -0000<BR>
@@ -723,7 +723,12 @@<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (npoints0 &gt; 0)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double tmpbounds[6];<BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// points0-&gt;GetNumberOfPoints() is equal to the upper bound <BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// on the points in the final merged grid. &nbsp;We need to temporarily <BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// set it to the number of points added to the merged grid so far.<BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points0-&gt;GetData()-&gt;SetNumberOfTuples(npoints0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grid-&gt;GetBounds(tmpbounds);<BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points0-&gt;GetData()-&gt;SetNumberOfTuples(this-&gt;TotalNumberOfPoints);<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bounds[0] = ((tmpbounds[0] &lt; bounds[0]) ? tmpbounds[0] : bounds[0]);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bounds[2] = ((tmpbounds[2] &lt; bounds[2]) ? tmpbounds[2] : bounds[2]);<BR>
<BR>
<BR>
Regards,<BR>
Takuya<BR>
<BR>
Takuya OSHIMA, Ph.D.<BR>
Faculty of Engineering, Niigata University<BR>
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN<BR>
&nbsp;&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
<HR ALIGN=CENTER SIZE="4" WIDTH="90%"><BR>
&nbsp;<BR>
&nbsp;<BR>
<BR>
<HR ALIGN=CENTER SIZE="4" WIDTH="90%"><BR>
_______________________________________________<BR>
Powered by www.kitware.com &lt;<a href="http://www.kitware.com">http://www.kitware.com</a>&gt; <BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
<BR>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><BR>
<BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><BR>
&nbsp;&nbsp;<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
&nbsp;&nbsp;&nbsp;**** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kenneth Moreland<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sandia National Laboratories<BR>
*********** &nbsp;<BR>
*** *** *** &nbsp;email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** &nbsp;*** &nbsp;** &nbsp;phone: (505) 844-8919<BR>
&nbsp;&nbsp;&nbsp;&nbsp;*** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;web: &nbsp;&nbsp;<a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>