Repository navigation
COMP: Stop requiring ITKGPUCommon for ELASTIX_USE_OPENCL (ITK 6) - #1503
Open
hjmjohnson wants to merge 1 commit into
Open
hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
elastix builds its OpenCL support from its own copies of the ITK GPU classes (Common/OpenCL/ITKimprovements) and requires ITK_USE_GPU=OFF, in which case ITK's ITKGPUCommon module builds no library and adds only an include directory whose headers elastix does not use. ITK 6 removes the module (InsightSoftwareConsortium/ITK#7284), so requesting it makes find_package(ITK) fail. Drop it from the ITK components and from the elxOpenCL module list.
hjmjohnson
force-pushed
the
remove-itkgpucommon-dependency
branch
from
December 1, 2026 18:11
632290b to
95dce59
Compare
hjmjohnson
marked this pull request as ready for review
December 1, 2026 22:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP, for discussion. ITK 6 plans to remove its in-tree OpenCL GPU modules (InsightSoftwareConsortium/ITK#7284, issue InsightSoftwareConsortium/ITK#6075). With
ELASTIX_USE_OPENCL=ON, elastix still requestsITKGPUCommonand so would fail atfind_package(ITK). This PR drops that request.Merge danger: two-way door; blast radius:
ELASTIX_USE_OPENCL=ONbuilds only (off by default).@N-Dekker, can you confirm this is OK for elastix? On #6107 you reported that elastix builds without ITK's GPU modules. The two lines naming
ITKGPUCommonappear to be the only remaining tie, and the module turns out to be required but unused.Why ITKGPUCommon is required but unused
ITK_USE_GPU=OFF, because it overrides ITK's GPU classes. WithITK_USE_GPU=OFF, ITK'sITKGPUCommonbuilds no library and adds no link libraries (Modules/Core/GPUCommon/src/CMakeLists.txtandITKGPUCommon_LIBRARIESare both insideif(ITK_USE_GPU)). Its only contribution is an include directory.itkGPUImage.h,itkGPUDataManager.h,itkOpenCLUtil.h,itkGPUCastImageFilter.h, and others). elastix carries its own copy of every one, inCommon/OpenCL/ITKimprovementsandCommon/OpenCL/Filters. It includes no ITK GPU header that it lacks a copy of.itkGPUKernelClassMacrothat elastix's kernels use is in ITK'sitkMacro.h(ITKCommon), which #7284 keeps.Shape of the change
The
if(${ITK_USE_GPU}) message(FATAL_ERROR ...)guard stays: it still protects builds against ITK 5.4 configured withITK_USE_GPU=ON. ITK 6 setsITK_USE_GPUtoOFFinITKConfig.cmake.Evidence
Local, macOS arm64, conda clang,
ELASTIX_USE_OPENCL=ON, against an ITK build of #7284 (no GPU modules), with the Apple OpenCL framework:mainunchanged: configure fails withNo such module: "ITKGPUCommon".itkOpenCLVectorBase.cxx('vcl_atomic_count.h' file not found). That is a separate problem in elastix's own OpenCL code: ITKmaindropped the header in ENH: Update vendored VNL to the ITK-stripped numerics-only vxl (UpdateFromUpstream) InsightSoftwareConsortium/ITK#6421, whether or not ITK#7284 lands. Its fix is COMP: Use std::atomic for the OpenCLVectorBase reference count #1504.-Winconsistent-missing-overrideand-Woverloaded-virtualkind.OpenCLContextsupports only Intel, NVIDIA, and AMD SDKs, chosen at compile time, so Apple's platform is rejected with or without this change. They need a runner with one of those SDKs.AI assistance
Prepared with Claude Code (Opus 5.5) under Hans Johnson's direction; reviewed by Hans Johnson.