[Insight-users] Cannot abort properlly multithreaded filters

Luis Ibanez luis.ibanez at kitware.com
Sat Sep 11 22:06:03 EDT 2004


Hi Didier,

Before continuing on the hunt for a multi-threading issue
please do the following:

Make sure that after you abort the filter, you call
ResetPipeline() before attempting to rerun the filter.

It is likely that the segmentation fault is caused by trying
to execute the pipeline while it is in an invalid state resulting
from the abort call.

Please let us know what your find.


     Thanks


       Luis



--------------------------
Didier Rajon wrote:

> Hi,
> I'm having problem trying to abort an itk filter which is multi-threaded 
> (such as itkResampleImageFilter).
> I'm using itk (v. 1.8), vtk (v.4.2) for the rendering, and Qt (v. 3.3.3) 
> for the user interface on Linux red-hat . In my user interface, I have a 
> dialog window that shows the progress of the filters and allows the user 
> to stop the process by clicking an "abort" button.
> If I run my program on a single processor machine, everything works 
> fine, I see the progression of the filter on  the progress bar (for this 
> I set an observer on the ProgressEvent), I can abort the filter (By 
> calling the AbortGenerateDataOn() member of the filter), and I can 
> re-execute the filter as I wish.  On the other hand, if I run my program 
> on a 2-processor machine, each time I abort a multi-threaded filter and 
> try to re-execute the filter right after the abort, a "segmentation 
> fault" is produced.
> I think this has to do with itkProgressReporter. I went to look at the 
> code of itkProgressReporter and it seems to me, that the abort only 
> affects the threadId 0, which means that the second thread (and probably 
> all other threads if I had more than 2 processors) is still running 
> after I abort the filter. If I re-execute the process just after the 
> abort, I get the "segmentation fault". On the other hand, if I wait long 
> enough before I re-execute the filter so that the second thread has time 
> to complete, everything works fine.
> I also checked the CPU consumption of my system (using the "top" 
> command) and my process is still using CPU time after I abort the 
> filter.  If I re-execute the filter before the CPU time of my process is 
> down to 0, the "segmentation fault" occurs.  If I wait until the CPU 
> time is finally down to 0, then I can re-execute the filter without problem.
> Do I need to do something special in order to be able to abort my 
> multithreaded filters, or is this a problem that should be handled by 
> itkProgressReporter?
>  
> I also noticed that filters that use itkProgressAccumulator (such as 
> itkDiscreteGaussianFilter) are not abortable (what ever the number of 
> processors).  I went to look at the code of itkProgressAccumulator and I 
> found that there is nothing done in this class (nor in 
> itkDiscreteGaussianImageFilter) to propagate the AbortGenerateData flag 
> to the sub-filters of the mini pipe-line.
> Is this also a problem that I can solve be doing some special things in 
> order to propagate the AbortGenerateData flag, or is this a problem that 
> should be handled by itkProgressAccumulator?
>  
> Thanks for helping me solving these two problems.
>  
> Didier.
>  
>  
>  
> Didier A. Rajon
> University of Florida
> Department of Neurological Surgery
> MBI L2100, PO Box 100265
> GAINESVILLE, FL, 32610-0265
> Tel: (352) 294 0144
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users






More information about the Insight-users mailing list