Skip to content

Commit 588755f

Browse files
committed
DOC: do not mention ThreadedGenerateData, and other review fixes
1 parent d5cfd14 commit 588755f

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

SoftwareGuide/Latex/Architecture/SystemOverview.tex

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,15 +473,14 @@ \subsection{Multi-Threading}
473473
the filter's user or downstream filter in the pipeline. The best place for
474474
invoking \code{this->DynamicMultiThreadingOff();} is the filter's constructor.
475475

476-
In image filters and other descendants of `ProcessObject`, method
477-
`SetNumberOfThreads` has been renamed into `SetNumberOfWorkUnits`.
478-
For `MultiThreaderBase` and descendants, `SetNumberOfThreads` has been
479-
split into `SetMaximumNumberOfThreads` and `SetNumberOfWorkUnits`.
480-
Load balancing is possible when `NumberOfWorkUnits` is greater
481-
than the number of threads. In most places where number of threads was
482-
being manipulated before, work units shoud be accessed or changed now.
483-
`MaximumNumberOfThreads` should not generally be changed, except when
484-
testing performance and scalability, profilng and sometimes debugging code.
476+
In image filters and other descendants of \code{ProcessObject}, method
477+
\code{SetNumberOfWorkUnits} controls the level of parallelism.
478+
Load balancing is possible when \code{NumberOfWorkUnits} is greater
479+
than the number of threads. In most places where developer would like to
480+
restrict number of threads, work units should be changed instead.
481+
\doxygen{MultiThreaderBase}'s \code{MaximumNumberOfThreads} should not
482+
generally be changed, except when testing performance and scalability,
483+
profiling and sometimes debugging code.
485484

486485
The general philosophy in ITK regarding thread safety is that accessing
487486
different instances of a class (and its methods) is a thread-safe operation.

SoftwareGuide/Latex/DevelopmentGuidelines/WriteAFilter.tex

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -473,21 +473,16 @@ \section{Threaded Filter Execution}
473473

474474
Multi-threading requires caution when performing I/O (including using
475475
\code{cout} or \code{cerr}) or invoking events. A safe practice is to allow
476-
only thread id zero to perform I/O or generate events. (The thread id is
477-
passed as argument into \code{ThreadedGenerateData(Region, ThreadId)}).
476+
only the invoking thread to perform I/O or generate events.
478477
If more than one thread tries to write to the same place at the same time,
479478
the program can behave badly, and possibly even deadlock or crash.
480479

481-
In ITK version 5.0, `DynamicThreadedGenerateData` signature was introduced.
482-
This allows number of pieces (output regions) to be processed to be different,
483-
usually bigger than the number of real threads executing the work. In turn,
484-
this allows load balancing. The number of pieces has been renamed into
485-
work units, and the name `threads' is now reserved for real threads,
486-
as exposed by \doxygen{MultiThreaderBase} and descendants.
487-
488-
Filters which need thread identifier (id) should implement the
489-
\code{ThreadedGenerateData(Region, ThreadId)} method and call
490-
\code{this->DynamicMultiThreadingOff();} in the filter's constructor.
480+
\code{DynamicThreadedGenerateData} signature allows number of pieces
481+
(output regions) to be processed to be different, usually bigger than the
482+
number of real threads executing the work. In turn, this allows load
483+
balancing. The number of work units controls filter parallelism,
484+
and the name `threads' is reserved for real threads as exposed by
485+
\doxygen{MultiThreaderBase} and its descendants.
491486

492487

493488

0 commit comments

Comments
 (0)