<HTML>
<HEAD>
<TITLE>Re: [Paraview] problem with parallel filter, segfault after last process returns</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Christine,<BR>
<BR>
I’m glad you figured that out. This is probably unrelated, but I noticed in your original post that you said the Controller was initialized with<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>this->SetController(vtkMultiProcessController::GetGlobalController());<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
This is mostly correct, but you need to make sure that you first set the Controller ivar to NULL in your constructor so that the SetController method understands that there is nothing set currently and that it does not attempt to unreference a non-existent controller.<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>this->Controller = NULL;<BR>
this->SetController(vtkMultiProcessController::GetGlobalController());<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
-Ken<BR>
<BR>
<BR>
On 11/6/09 3:53 PM, "Christine Corbett Moran" <<a href="corbett@physik.uzh.ch">corbett@physik.uzh.ch</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Berk, Burlen,<BR>
<BR>
Yes this was exactly what was happening. I had allocated too small of<BR>
a buffer to receive a piece of data, which corrupted memory and was<BR>
only a problem on returning the function. Doh!; I was looking for<BR>
bigger issues when it was basic.<BR>
<BR>
Cheers,<BR>
Christine<BR>
<BR>
On Fri, Nov 6, 2009 at 10:35 PM, Berk Geveci <<a href="berk.geveci@kitware.com">berk.geveci@kitware.com</a>> wrote:<BR>
> This makes me think that something is writing beyond the bounds of an<BR>
> array corrupting memory. Any chance you can run this within valgrind?<BR>
><BR>
> On Fri, Nov 6, 2009 at 12:34 PM, Christine Corbett Moran<BR>
> <<a href="corbett@physik.uzh.ch">corbett@physik.uzh.ch</a>> wrote:<BR>
>> Hi,<BR>
>><BR>
>> I'm converting my serial filters to work in parallel. In this process,<BR>
>> I'm run into trouble at the very last stage, after verifying that at<BR>
>> every stage, on every processor, that correct data was being<BR>
>> sent/received, and that the final output was identical to the<BR>
>> algorithm as run in serial.<BR>
>><BR>
>> The entire method runs as planned, but immediately after returning<BR>
>> from the RequestData method on processes 0 (the last one to return as<BR>
>> I have process 0 receiving data sent by other processes, and perform a<BR>
>> final computation). I get a segfault:<BR>
>> "*** Process received signal ***<BR>
>> Signal: Segmentation fault (11)<BR>
>> Signal code: (128)<BR>
>> Failing at address: (nil)"<BR>
>><BR>
>> I initially thought this had something to do with the way I am using<BR>
>> the output vector. So as a test, I simply copy the input to the output<BR>
>> before doing all my computations taking into account the controller,<BR>
>> check these computations at every step, but actually ignore their<BR>
>> output in the end<BR>
>><BR>
>> pseudocode for my test<BR>
>> RequstData:<BR>
>> 1. copy input to output<BR>
>> 2. if there's a controller specified and number of processors>1,<BR>
>> perform parallel computation using controller, otherwise perform<BR>
>> serial computation. I don't actually store the result<BR>
>> 3. Return<BR>
>><BR>
>> The segfault is not present on returning if I comment out all code in<BR>
>> step 2, or if the algorithm is run in serial. I know the segfault<BR>
>> happens after RequestData returns on process Since in this test case,<BR>
>> all computations in 2. are local with no results written to output, I<BR>
>> am not sure what is going on. Do I need to do something special to<BR>
>> "shutdown" the controller? My destructor uses<BR>
>> vtkCxxSetObjectMacro(vtkCenterOfMassFilter,Controller,<BR>
>> vtkMultiProcessController);<BR>
>> via<BR>
>> this->SetController(0);<BR>
>> but the segfault is still present if I comment this out. My controller<BR>
>> was set in the constructor via<BR>
>> this->SetController(vtkMultiProcessController::GetGlobalController());<BR>
>><BR>
>> Christine<BR>
>> _______________________________________________<BR>
>> Powered by www.kitware.com<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>
>><BR>
><BR>
_______________________________________________<BR>
Powered by www.kitware.com<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>
<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>
**** Kenneth Moreland<BR>
*** Sandia National Laboratories<BR>
*********** <BR>
*** *** *** email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** *** ** phone: (505) 844-8919<BR>
*** web: <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>