[ITK] ProgressReporter and Multi-Threading
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Jun 15 08:51:18 EDT 2015
Hello,
There are lots of reasons this could occur.
1) You are correct that it could be because you algorithms is horribly unbalanced and not making even use of the threads. I don't know your filter.
2) Your filter could be completed, then your program is doing something else. Observe other events such EndEvent to know when all threads in the filter have completed.
3) This ITK approach is generally reasonably accurate, and more complicated thread locking methods are generally not worth the trouble or performance penalty.
I suspect there is a problem with your algorithm or how you are using the progress reporter.
HTH,
Brad
On Jun 15, 2015, at 5:15 AM, Wood, Tobias <tobias.wood at kcl.ac.uk> wrote:
> Hello,
>
> I am using ITK 4.7.2. I added a ProgressReporter to the ThreadedGenerateData() method of a filter I am writing, with the following definition:
>
> ProgressReporter progress(this, threadId, region.GetNumberOfPixels(), 10);
>
> as per the documentation here: http://www.itk.org/Doxygen/html/classitk_1_1ProgressReporter.html. I then added a simple itk::Command subclass to print progress in percent.
>
> However, when I run the program, the progress quite quickly reaches 100%, then no further ProgressEvents are raised. The program continues to execute and does finish eventually. After looking at the code for ProgressReporter, I assume this is because thread 0 somehow out-competes the other threads and finishes its processing quite fast. The other threads then continue to run peacefully, but they don't touch the Progress counter.
>
> Is there a way to get a more accurate Progress report with multi-threading? Am I missing something?
>
> Thanks in advance,
> Toby
>
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150615/7ddae0da/attachment.html>
More information about the Community
mailing list