ProcessObject NumberOfThreads

@dzenanz I suspect this side effect has to do with the recent threading changes. It appears that I can not longer control the global default number of threads with the current ITK master:

Blockquote
In [1]: import SimpleITK as sitk

In [2]: sitk.ProcessObject_GetGlobalDefaultNumberOfThreads()
Out[2]: 88

In [3]: sitk.ProcessObject_SetGlobalDefaultNumberOfThreads(10)

In [4]: sitk.ProcessObject_GetGlobalDefaultNumberOfThreads()
Out[4]: 88

I notices this with the following SimpleITK test failure:

Blockquote
3854: [ RUN ] BasicFilters.ProcessObject_NumberOfThreads
3854: /home/blowekamp/src/SimpleITK/Testing/Unit/sitkBasicFiltersTests.cxx:354: Failure
3854: Expected: gNum+1
3854: Which is: 89
3854: To be equal to: filter.GetGlobalDefaultNumberOfThreads()
3854: Which is: 88
3854: /home/blowekamp/src/SimpleITK/Testing/Unit/sitkBasicFiltersTests.cxx:358: Failure
3854: Expected: gNum+1
3854: Which is: 89
3854: To be equal to: caster2.GetNumberOfThreads()
3854: Which is: 88
3854: /home/blowekamp/src/SimpleITK/Testing/Unit/sitkBasicFiltersTests.cxx:359: Failure
3854: Expected: gNum+1
3854: Which is: 89
3854: To be equal to: caster2.GetGlobalDefaultNumberOfThreads()
3854: Which is: 88
3854: [ FAILED ] BasicFilters.ProcessObject_NumberOfThreads (22 ms)
3854: [----------] 1 test from BasicFilters (22 ms total)

Where SimpleITK’s GoblalDefaultNumberOfThreads methods for the filters, map to the appropriate MultiThreader methods.


I took a look at the code. I only partly moved GetGlobalDefaultNumberOfThreads to ThreadPool. I am working on it.

1 Like

Patch submitted.