GlobalDefaultNumberOfThreads should not be greater than GlobalMaximumNumberOfThreads #4773
Labels
type:Bug
Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Milestone
Description
Users typically call
MultiThreaderBase::SetGlobalMaximumNumberOfThreads
when they want to reduce (limit) the number of threads used by a process. However, when a user sets theGlobalMaximumNumberOfThreads
while leaving theGlobalDefaultNumberOfThreads
unspecified, this "default number" may end up becoming larger than the "maximum number"!Steps to Reproduce
Expected behavior
With this example, both Maximum and Default should end up being
3
(at least, if the machine supports having 3 simultaneous threads).Actual behavior
Output on my (LKEB/LUMC) multi-core machine:
Versions
ITK 5.4.0
Environment
Windows
Additional Information
GlobalDefaultNumberOfThreads
is being used when constructing the ThreadPool:ITK/Modules/Core/Common/src/itkThreadPool.cxx
Line 114 in 01e133c
So the number of threads held by the thread pool appears to also occasionally exceed
GlobalMaximumNumberOfThreads
!The text was updated successfully, but these errors were encountered: