From 4159ac548554335d73c285fce1512fcc5ab16f31 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 25 Jun 2026 15:17:53 -0400 Subject: [PATCH] PERF: Set the default threader to Pool Continue to enable TBB support, but change the default threader to Pool. TBB can exhibit decreased performance in some cases, and it seems that more refinement is needed with the number of work units, etc. See: https://discourse.itk.org/t/8x-slower-registration-with-itk-elastix-python-api-vs-elastix-cli-minimal-reproducible-example/7736 https://github.com/InsightSoftwareConsortium/ITKElastix/issues/391 This setting is consistent with the libitk conda-forge build configuration. --- CMakeLists.txt | 1 + scripts/internal/manylinux-build-wheels.sh | 1 + scripts/macpython-build-wheels.sh | 1 + scripts/windows_build_wheels.py | 1 + 4 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 230f82a4..40e9576f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,6 +282,7 @@ if(ITKPythonPackage_SUPERBUILD) -DWRAP_ITK_INSTALL_COMPONENT_PER_MODULE:BOOL=${install_component_per_module} -DITK_LEGACY_SILENT:BOOL=ON -DITK_WRAP_PYTHON:BOOL=ON + -DITK_DEFAULT_THREADER:STRING=Pool -DDOXYGEN_EXECUTABLE:FILEPATH=${DOXYGEN_EXECUTABLE} -DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} -DPython3_LIBRARY:FILEPATH=${Python3_LIBRARY} diff --git a/scripts/internal/manylinux-build-wheels.sh b/scripts/internal/manylinux-build-wheels.sh index 11c30f61..7b1ec6d5 100755 --- a/scripts/internal/manylinux-build-wheels.sh +++ b/scripts/internal/manylinux-build-wheels.sh @@ -99,6 +99,7 @@ for PYBIN in "${PYBINARIES[@]}"; do --config-setting=cmake.define.Python3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \ --config-setting=cmake.define.Python3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \ --config-setting=cmake.define.Module_ITKTBB:BOOL=ON \ + --config.setting=cmake.define.ITK_DEFAULT_THREADER:STRING=Pool \ --config-setting=cmake.define.TBB_DIR:PATH=${tbb_dir} \ . diff --git a/scripts/macpython-build-wheels.sh b/scripts/macpython-build-wheels.sh index 2985aa87..cea66fff 100755 --- a/scripts/macpython-build-wheels.sh +++ b/scripts/macpython-build-wheels.sh @@ -180,6 +180,7 @@ for VENV in "${VENVS[@]}"; do -DITK_WRAP_DOC:BOOL=ON \ -DModule_ITKTBB:BOOL=${use_tbb} \ -DTBB_DIR:PATH=${tbb_dir} \ + -DITK_DEFAULT_THREADER:STRING=Pool \ ${CMAKE_OPTIONS} \ -G Ninja \ ${source_path} \ diff --git a/scripts/windows_build_wheels.py b/scripts/windows_build_wheels.py index 20372729..28a20bf7 100644 --- a/scripts/windows_build_wheels.py +++ b/scripts/windows_build_wheels.py @@ -85,6 +85,7 @@ def build_wrapped_itk( "-DITK_WRAP_DOC:BOOL=ON", "-DDOXYGEN_EXECUTABLE:FILEPATH=C:/P/doxygen/doxygen.exe", "-DModule_ITKTBB:BOOL=ON", + "-DITK_DEFAULT_THREADER:STRING=Pool", "-DTBB_DIR:PATH=%s" % tbb_dir, "-G", "Ninja", source_path